backend-tests.yml 1.1 KB

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