Fix action syntax #546
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| - push | |
| name: Build and test | |
| permissions: | |
| contents: read | |
| jobs: | |
| go-version: | |
| name: Lookup go versions | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| minimal: ${{ steps.go-version.outputs.minimal }} | |
| matrix: ${{ steps.go-version.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: arnested/go-version-action@v1 | |
| id: go-version | |
| go_generate: | |
| name: Check generated code is up to date | |
| needs: go-version | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Go ${{ needs.go-version.outputs.minimal }} | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ needs.go-version.outputs.minimal }} | |
| - run: go version | |
| - name: go generate | |
| env: | |
| GO111MODULE: 'on' | |
| run: go generate -x | |
| - name: Diff after go generate | |
| run: git diff --exit-code | |
| build_and_test: | |
| name: Build and test | |
| needs: go-version | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| go-version: ${{ fromJSON(needs.go-version.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Go ${{ matrix.go-version }} | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ matrix.go-version }}.x | |
| - run: go version | |
| - name: go test | |
| env: | |
| GO111MODULE: 'on' | |
| # We enable cgo to be able to test with `-race`. | |
| CGO_ENABLED: 1 | |
| run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./... | |
| - name: Upload coverage report to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| flags: go${{ matrix.go-version }} |