1
0

go.yml 1.4 KB

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