backend-tests.yml 1.1 KB

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