go.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: Go
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - 'release/**'
  7. paths:
  8. - '**.go'
  9. - 'go.mod'
  10. pull_request:
  11. paths:
  12. - '**.go'
  13. - 'go.mod'
  14. - '.github/workflows/go.yml'
  15. env:
  16. GOPROXY: "https://proxy.golang.org"
  17. jobs:
  18. lint:
  19. name: Lint
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v2
  23. - name: Run golangci-lint
  24. uses: actions-contrib/golangci-lint@v1
  25. with:
  26. args: 'run --timeout=30m'
  27. test:
  28. name: Test
  29. strategy:
  30. matrix:
  31. go-version: [1.14.x, 1.15.x]
  32. platform: [ubuntu-latest, macos-latest, windows-latest]
  33. runs-on: ${{ matrix.platform }}
  34. steps:
  35. - name: Install Go
  36. uses: actions/setup-go@v1
  37. with:
  38. go-version: ${{ matrix.go-version }}
  39. - name: Checkout code
  40. uses: actions/checkout@v2
  41. - name: Run unit tests
  42. run: go test -v -race -coverprofile=coverage -covermode=atomic ./...
  43. - name: Upload coverage report to Codecov
  44. uses: codecov/[email protected]
  45. with:
  46. file: ./coverage
  47. flags: unittests
  48. - name: Cache downloaded modules
  49. uses: actions/cache@v1
  50. with:
  51. path: ~/go/pkg/mod
  52. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  53. restore-keys: |
  54. ${{ runner.os }}-go-