2022-08-24 21:12:08 +08:00
|
|
|
name: Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- "release/v*.*.*"
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
jobs:
|
2022-08-31 19:27:17 +08:00
|
|
|
eslint-checks:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
2022-11-19 14:51:28 +08:00
|
|
|
node-version: "18"
|
2022-08-31 19:27:17 +08:00
|
|
|
cache: yarn
|
|
|
|
cache-dependency-path: "web/yarn.lock"
|
|
|
|
- run: yarn
|
|
|
|
working-directory: web
|
|
|
|
- name: Run eslint check
|
|
|
|
run: yarn lint
|
|
|
|
working-directory: web
|
|
|
|
|
2022-10-01 22:57:32 +08:00
|
|
|
jest-tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
2022-11-19 14:51:28 +08:00
|
|
|
node-version: "18"
|
2022-10-01 22:57:32 +08:00
|
|
|
cache: yarn
|
|
|
|
cache-dependency-path: "web/yarn.lock"
|
|
|
|
- run: yarn
|
|
|
|
working-directory: web
|
|
|
|
- name: Run jest
|
|
|
|
run: yarn test
|
|
|
|
working-directory: web
|
|
|
|
|
2022-08-31 20:21:56 +08:00
|
|
|
frontend-build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
2022-11-19 14:51:28 +08:00
|
|
|
node-version: "18"
|
2022-08-31 20:21:56 +08:00
|
|
|
cache: yarn
|
|
|
|
cache-dependency-path: "web/yarn.lock"
|
|
|
|
- run: yarn
|
|
|
|
working-directory: web
|
|
|
|
- name: Run frontend build
|
|
|
|
run: yarn build
|
|
|
|
working-directory: web
|
|
|
|
|
2022-11-19 14:51:28 +08:00
|
|
|
go-static-checks:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: 1.19
|
|
|
|
check-latest: true
|
|
|
|
cache: true
|
|
|
|
- name: Verify go.mod is tidy
|
|
|
|
run: |
|
2022-11-19 16:58:55 +08:00
|
|
|
go mod tidy -go=1.19
|
2022-11-19 14:51:28 +08:00
|
|
|
git diff --exit-code
|
|
|
|
- name: golangci-lint
|
|
|
|
uses: golangci/golangci-lint-action@v3
|
|
|
|
with:
|
|
|
|
args: -v
|
|
|
|
skip-cache: true
|
|
|
|
|
2022-08-24 21:53:12 +08:00
|
|
|
go-tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-08-25 20:44:17 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-24 21:53:12 +08:00
|
|
|
- uses: actions/setup-go@v3
|
|
|
|
with:
|
2022-11-19 14:51:28 +08:00
|
|
|
go-version: 1.19
|
2022-08-24 21:53:12 +08:00
|
|
|
check-latest: true
|
|
|
|
cache: true
|
|
|
|
- name: Run all tests
|
|
|
|
run: go test -v ./... | tee test.log; exit ${PIPESTATUS[0]}
|
|
|
|
- name: Pretty print tests running time
|
|
|
|
run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'
|