Skip to content

chore: risk dml

chore: risk dml #7751

Workflow file for this run

name: Backend Tests
on:
pull_request:
branches:
- main
- "release/*.*.*"
paths:
- "backend/**"
- "go.mod"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
go-tests:
runs-on: self-hosted
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.6
cache: false
- name: Verify go.mod is tidy
run: |
go mod tidy
git diff --exit-code
- name: Cache MySQL
uses: actions/cache@v4
with:
path: |
./backend/resources/mysql/*.tar.gz
./backend/resources/mysql/*.tar.xz
key: ${{ runner.OS }}-build-mysql-cache
- name: Install dependencies
run: go generate -tags mysql ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
version: v1.57.2
args: -j 8 --verbose --timeout 20m --max-same-issues=30 --allow-parallel-runners
skip-cache: true
- name: Run all tests
run: go test -p=8 -tags=mysql -v ./backend/... | tee test.log; exit ${PIPESTATUS[0]}
- name: Pretty print tests running time
# grep: filter out lines like "--- PASS: TestVCS (15.04s)"
# sed: remove unnecessary characters
# awk: re-format lines to "PASS: TestVCS (15.04s)"
# sort: cut into columns by delimiter ' ' (single space) and sort by column 3 (test time in seconds) as numeric type in reverse order (largest comes first)
# awk: accumulate sum by test time in seconds
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"}'