go.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.15.x, 1.16.x, 1.17.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: Run tests with coverage
  46. run: go test -v -race -coverprofile=coverage -covermode=atomic ./...
  47. - name: Upload coverage report to Codecov
  48. uses: codecov/codecov-action@v1.5.0
  49. with:
  50. file: ./coverage
  51. flags: unittests