backend-tests.yml 1.2 KB

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