ci.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. on:
  2. push:
  3. pull_request:
  4. name: CI
  5. jobs:
  6. format:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - name: Install Go
  10. uses: actions/setup-go@v2
  11. with:
  12. go-version: 1.17
  13. - name: Code
  14. uses: actions/checkout@v2
  15. - name: Check diff between gofmt and code
  16. run: diff <(gofmt -d .) <(echo -n)
  17. test:
  18. runs-on: ubuntu-latest
  19. strategy:
  20. matrix:
  21. go-version: [1.13, 1.14, 1.15, 1.16, 1.17]
  22. steps:
  23. - name: Install Go
  24. uses: actions/setup-go@v2
  25. with:
  26. go-version: ${{ matrix.go-version }}
  27. - name: Code
  28. uses: actions/checkout@v2
  29. - run: go test -v -race ./...
  30. lint:
  31. runs-on: ubuntu-latest
  32. steps:
  33. - name: Install Go
  34. uses: actions/setup-go@v2
  35. with:
  36. go-version: 1.17
  37. - name: Code
  38. uses: actions/checkout@v2
  39. - name: Go vet
  40. run: go vet -x ./...
  41. - name: GolangCI-Lint
  42. uses: golangci/golangci-lint-action@v2.5.2
  43. if: github.event.name == 'pull_request'
  44. with:
  45. only-new-issues: true
  46. skip-pkg-cache: true
  47. skip-build-cache: true
  48. - name: GolangCI-Lint
  49. if: github.event.name != 'pull_request' # See https://github.com/golangci/golangci-lint-action/issues/362
  50. run: |
  51. curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.43.0
  52. $(go env GOPATH)/bin/golangci-lint run