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.

41 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. jobs:
  9. test:
  10. name: Test
  11. strategy:
  12. matrix:
  13. go-version: [1.13.x, 1.14.x, 1.15.x]
  14. platform: [ubuntu-latest, macos-latest, windows-latest]
  15. runs-on: ${{ matrix.platform }}
  16. steps:
  17. - name: Install Go
  18. uses: actions/setup-go@v1
  19. with:
  20. go-version: ${{ matrix.go-version }}
  21. - name: Checkout code
  22. uses: actions/checkout@v2
  23. - name: Run unit tests
  24. run: |
  25. # go mod init guanguans/id-validator
  26. go test -v -race -coverprofile=coverage -covermode=atomic ./...
  27. - name: Upload coverage report to Codecov
  28. uses: codecov/codecov-action@v1.0.6
  29. with:
  30. file: ./coverage
  31. flags: unittests
  32. - name: Cache downloaded modules
  33. uses: actions/cache@v1
  34. with:
  35. path: ~/go/pkg/mod
  36. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  37. restore-keys: |
  38. ${{ runner.os }}-go-