backend-tests.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. version: v1.52.0
  25. args: -v --timeout=3m
  26. skip-cache: true
  27. go-tests:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - uses: actions/checkout@v3
  31. - uses: actions/setup-go@v3
  32. with:
  33. go-version: 1.19
  34. check-latest: true
  35. cache: true
  36. - name: Run all tests
  37. run: go test -v ./... | tee test.log; exit ${PIPESTATUS[0]}
  38. - name: Pretty print tests running time
  39. 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"}'