Skip to content

Commit

Permalink
Merge branch 'YaoApp:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi authored Sep 1, 2022
2 parents 8eb08ff + babf48e commit 2e1ef3e
Show file tree
Hide file tree
Showing 174 changed files with 5,510 additions and 1,484 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-receive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.event.pull_request.head.sha }} > ./pr/SHA
- uses: actions/upload-artifact@v2
with:
name: pr
Expand Down
154 changes: 149 additions & 5 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,28 @@ on:
workflows: ["Receive PR"]
types:
- completed
env:
YAO_DEV: ${{ github.WORKSPACE }}
YAO_ENV: development
YAO_ROOT: ${{ github.WORKSPACE }}/tests
YAO_HOST: 0.0.0.0
YAO_PORT: 5099
YAO_SESSION: "memory"
YAO_LOG: "./logs/application.log"
YAO_LOG_MODE: "TEXT"
YAO_JWT_SECRET: "bLp@bi!oqo-2U+hoTRUG"
YAO_DB_AESKEY: "ZLX=T&f6refeCh-ro*r@"
OSS_TEST_ID: ${{ secrets.OSS_TEST_ID}}
OSS_TEST_SECRET: ${{ secrets.OSS_TEST_SECRET}}
ROOT_PLUGIN: ${{ github.WORKSPACE }}/../../../data/gou-unit/plugins

jobs:
upload:
UnitTest:
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.18.2]
db: [MySQL8.0, MySQL5.7, SQLite3]
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
Expand All @@ -35,21 +53,147 @@ jobs:
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- name: "Unzip"
- name: "Read NR & SHA"
run: |
unzip pr.zip
ls -l
cat NR
cat SHA
echo HEAD=$(cat SHA) >> $GITHUB_ENV
echo NR=$(cat NR) >> $GITHUB_ENV
- name: "Comment on PR"
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { NR } = process.env
var fs = require('fs');
var issue_number = NR;
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Thank you for the PR! The ${{ matrix.db }} test workflow is running, the results of the run will be commented later.'
});
- name: Setup Cache
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout Kun
uses: actions/checkout@v2
with:
repository: yaoapp/kun
path: kun

- name: Checkout Xun
uses: actions/checkout@v2
with:
repository: yaoapp/xun
path: xun

- name: Checkout Gou
uses: actions/checkout@v2
with:
repository: yaoapp/gou
path: gou

- name: Checkout V8Go
uses: actions/checkout@v2
with:
repository: rogchap/v8go
ref: 5e91d3d9dcabd2986f901b6b31590e49fc3c4dd8
path: v8go

- name: Move Kun, Xun, Gou, V8Go
run: |
mv kun ../
mv xun ../
mv gou ../
mv v8go ../
ls -l .
ls -l ../
- name: Checkout pull request HEAD commit
uses: actions/checkout@v2
with:
ref: ${{ env.HEAD }}

- name: Setup ${{ matrix.db }}
uses: ./.github/actions/setup-db
with:
kind: "${{ matrix.db }}"
db: "xiang"
user: "xiang"
password: ${{ secrets.UNIT_PASS }}

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Setup Go Tools
run: |
make tools
- name: Setup ENV & Host
env:
PASSWORD: ${{ secrets.UNIT_PASS }}
run: |
sudo echo "127.0.0.1 local.iqka.com" | sudo tee -a /etc/hosts
echo "YAO_DB_DRIVER=$DB_DRIVER" >> $GITHUB_ENV
echo "GITHUB_WORKSPACE:\n" && ls -l $GITHUB_WORKSPACE
if [ "$DB_DRIVER" = "mysql" ]; then
echo "YAO_DB_PRIMARY=$DB_USER:$PASSWORD@$DB_HOST" >> $GITHUB_ENV
elif [ "$DB_DRIVER" = "postgres" ]; then
echo "YAO_DB_PRIMARY=postgres://$DB_USER:$PASSWORD@$DB_HOST" >> $GITHUB_ENV
else
echo "YAO_DB_PRIMARY=$YAO_ROOT/$DB_HOST" >> $GITHUB_ENV
fi
echo ".:\n" && ls -l .
echo "..:\n" && ls -l ..
ping -c 1 -t 1 local.iqka.com
- name: Test Prepare
run: |
make vet
make fmt-check
make misspell-check
make plugin
mkdir -p $YAO_ROOT/plugins/
mv $ROOT_PLUGIN/user.so $YAO_ROOT/plugins/
ls -l $YAO_ROOT/plugins/
make migrate
- name: Run test
run: |
make test
- name: Codecov Report
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos

- name: "Comment on PR"
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { NR } = process.env
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
var issue_number = NR;
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Everything is OK. Thank you for the PR!'
body: '✨DONE✨ ${{ matrix.db }} passed.'
});
36 changes: 15 additions & 21 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
release:
strategy:
matrix:
go: [1.17]
go: [1.18.2]
runs-on: "ubuntu-latest"
steps:
- name: Arm Build
Expand Down Expand Up @@ -55,7 +55,6 @@ jobs:
with:
repository: yaoapp/gou
path: gou
token: ${{ secrets.TOKEN }}

- name: Checkout V8Go
uses: actions/checkout@v2
Expand All @@ -69,7 +68,6 @@ jobs:
with:
repository: yaoapp/xgen
path: ui
token: ${{ secrets.TOKEN }}

- name: Move Kun, Xun, Gou, UI, V8Go
run: |
Expand All @@ -85,17 +83,13 @@ jobs:
uses: actions/checkout@v2

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Setup Go Tools
run: |
if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi
if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
go get github.com/go-bindata/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
make tools
- name: Make Artifacts Linux
run: |
Expand All @@ -114,15 +108,15 @@ jobs:
run: |
for file in ./dist/release/*; do coscmd upload $file /archives/; done;
- name: Configure COS For Beijing
env:
SECRET_ID: ${{ secrets.COS_ID }}
SECRET_KEY: ${{ secrets.COS_KEY }}
BUCKET: release-bj-1252011659
REGION: ap-beijing
run: |
coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION
- name: Push To Beijing
run: |
for file in ./dist/release/*; do coscmd upload $file /archives/; done;
# - name: Configure COS For Beijing
# env:
# SECRET_ID: ${{ secrets.COS_ID }}
# SECRET_KEY: ${{ secrets.COS_KEY }}
# BUCKET: release-bj-1252011659
# REGION: ap-beijing
# run: |
# coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION

# - name: Push To Beijing
# run: |
# for file in ./dist/release/*; do coscmd upload $file /archives/; done;
36 changes: 15 additions & 21 deletions .github/workflows/release-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
release:
strategy:
matrix:
go: [1.17]
go: [1.18.2]
runs-on: "macos-11"
steps:
- name: Install coscmd
Expand Down Expand Up @@ -47,7 +47,6 @@ jobs:
with:
repository: yaoapp/gou
path: gou
token: ${{ secrets.TOKEN }}

- name: Checkout V8Go
uses: actions/checkout@v2
Expand All @@ -61,7 +60,6 @@ jobs:
with:
repository: yaoapp/xgen
path: ui
token: ${{ secrets.TOKEN }}

- name: Move Kun, Xun, Gou, UI, V8Go
run: |
Expand All @@ -77,17 +75,13 @@ jobs:
uses: actions/checkout@v2

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Setup Go Tools
run: |
if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi
if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
go get github.com/go-bindata/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
make tools
- name: Make Artifacts MacOS
run: |
Expand All @@ -106,15 +100,15 @@ jobs:
run: |
for file in ./dist/release/*; do coscmd upload $file /archives/; done;
- name: Configure COS For Beijing
env:
SECRET_ID: ${{ secrets.COS_ID }}
SECRET_KEY: ${{ secrets.COS_KEY }}
BUCKET: release-bj-1252011659
REGION: ap-beijing
run: |
coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION
- name: Push To Beijing
run: |
for file in ./dist/release/*; do coscmd upload $file /archives/; done;
# - name: Configure COS For Beijing
# env:
# SECRET_ID: ${{ secrets.COS_ID }}
# SECRET_KEY: ${{ secrets.COS_KEY }}
# BUCKET: release-bj-1252011659
# REGION: ap-beijing
# run: |
# coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION

# - name: Push To Beijing
# run: |
# for file in ./dist/release/*; do coscmd upload $file /archives/; done;
12 changes: 5 additions & 7 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.17]
go: [1.18.2]
db: [MySQL8.0, MySQL5.7, SQLite3]
steps:
- name: Setup Cache
Expand Down Expand Up @@ -80,22 +80,20 @@ jobs:
kind: "${{ matrix.db }}"
db: "xiang"
user: "xiang"
password: 123456
password: ${{ secrets.UNIT_PASS }}

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Setup Go Tools
run: |
if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi
if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
make tools
- name: Setup ENV & Host
env:
PASSWORD: 123456
PASSWORD: ${{ secrets.UNIT_PASS }}
run: |
sudo echo "127.0.0.1 local.iqka.com" | sudo tee -a /etc/hosts
echo "YAO_DB_DRIVER=$DB_DRIVER" >> $GITHUB_ENV
Expand Down
Loading

0 comments on commit 2e1ef3e

Please sign in to comment.