backend-tests.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. name: Backend Test
  2. on:
  3. pull_request:
  4. branches:
  5. - main
  6. - "release/v*.*.*"
  7. paths-ignore:
  8. - "web/**"
  9. jobs:
  10. go-static-checks:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v3
  14. - uses: actions/setup-go@v3
  15. with:
  16. go-version: 1.19
  17. check-latest: true
  18. cache: true
  19. - name: Verify go.mod is tidy
  20. run: |
  21. go mod tidy -go=1.19
  22. git diff --exit-code
  23. - name: golangci-lint
  24. uses: golangci/golangci-lint-action@v3
  25. with:
  26. args: -v
  27. skip-cache: true
  28. go-tests:
  29. runs-on: ubuntu-latest
  30. steps:
  31. - uses: actions/checkout@v3
  32. - uses: actions/setup-go@v3
  33. with:
  34. go-version: 1.19
  35. check-latest: true
  36. cache: true
  37. - name: Run all tests
  38. run: go test -v ./... | tee test.log; exit ${PIPESTATUS[0]}
  39. - name: Pretty print tests running time
  40. 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"}'