| 1 | on: |
| 2 | push: |
| 3 | branches: |
| 4 | - "main" |
| 5 | tags: |
| 6 | - "v*.*.*" |
| 7 | pull_request: |
| 8 | |
| 9 | |
| 10 | jobs: |
| 11 | test: |
| 12 | name: Test |
| 13 | runs-on: ubuntu-latest |
| 14 | strategy: |
| 15 | fail-fast: false |
| 16 | matrix: |
| 17 | go: |
| 18 | - '^1.18' |
| 19 | - '^1.19' |
| 20 | - '^1.20' |
| 21 | - '^1.21' |
| 22 | - '^1.22' |
| 23 | steps: |
| 24 | - name: Check out code into the Go module directory |
| 25 | uses: actions/checkout@v4 |
| 26 | - uses: actions/setup-go@v5 |
| 27 | with: |
| 28 | go-version: ${{ matrix.go }} |
| 29 | cache: true |
| 30 | - name: Test Coverage (pkg) |
| 31 | run: go test ./... -race -coverprofile="coverage.txt" |
| 32 | - name: Upload coverage |
| 33 | if: ${{ matrix.go == '^1.22' }} |
| 34 | uses: codecov/codecov-action@v4 |
| 35 | with: |
| 36 | file: "coverage.txt" |
| 37 | token: ${{ secrets.CODECOV_TOKEN }} |
| 38 |