| 1 | name: Go |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: ['*'] |
| 6 | tags: ['v*'] |
| 7 | pull_request: |
| 8 | branches: ['*'] |
| 9 | |
| 10 | permissions: |
| 11 | contents: read |
| 12 | |
| 13 | jobs: |
| 14 | |
| 15 | build: |
| 16 | runs-on: ubuntu-latest |
| 17 | strategy: |
| 18 | matrix: |
| 19 | go: ["1.19.x", "1.20.x"] |
| 20 | include: |
| 21 | - go: 1.20.x |
| 22 | latest: true |
| 23 | |
| 24 | steps: |
| 25 | - name: Setup Go |
| 26 | uses: actions/setup-go@v4 |
| 27 | with: |
| 28 | go-version: ${{ matrix.go }} |
| 29 | |
| 30 | - name: Checkout code |
| 31 | uses: actions/checkout@v3 |
| 32 | |
| 33 | - name: Load cached dependencies |
| 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- |
| 40 | - name: Lint |
| 41 | if: matrix.latest |
| 42 | run: make lint |
| 43 | |
| 44 | - name: Test |
| 45 | run: make cover |
| 46 | |
| 47 | - name: Upload coverage to codecov.io |
| 48 | uses: codecov/codecov-action@v3 |