You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

  1. name: Tests
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. env:
  7. GOPROXY: "https://proxy.golang.org"
  8. GO111MODULE: "on"
  9. jobs:
  10. test:
  11. name: Test
  12. strategy:
  13. matrix:
  14. go-version: [1.14.x, 1.15.x]
  15. platform: [ubuntu-latest]
  16. runs-on: ${{ matrix.platform }}
  17. steps:
  18. - name: Install Go
  19. uses: actions/setup-go@v1
  20. with:
  21. go-version: ${{ matrix.go-version }}
  22. - name: Checkout code
  23. uses: actions/checkout@v2
  24. - name: Run unit tests
  25. run: |
  26. # go mod init guanguans/id-validator
  27. go test -v -race -coverprofile=coverage -covermode=atomic ./...
  28. - name: Upload coverage report to Codecov
  29. uses: codecov/codecov-action@v1.0.6
  30. with:
  31. file: ./coverage
  32. flags: unittests
  33. - name: Cache downloaded modules
  34. uses: actions/cache@v1
  35. with:
  36. path: ~/go/pkg/mod
  37. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  38. restore-keys: |
  39. ${{ runner.os }}-go-