Merge pull request #9 from sudo-bmitch/pr-examples #16
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
| name: Go | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*.*.*' ] | |
| pull_request: | |
| branches: [ '**' ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Test and Lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| gover: ['go.mod', 'oldstable', 'stable'] | |
| env: | |
| # do not automatically upgrade go to a different version: https://go.dev/doc/toolchain | |
| GOTOOLCHAIN: "local" | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: "Set up Go ${{ matrix.gover }}" | |
| uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
| with: | |
| go-version: ${{ matrix.go != 'go.mod' && matrix.go || null }} | |
| go-version-file: ${{ matrix.go == 'go.mod' && 'go.mod' || null }} | |
| check-latest: true | |
| id: go | |
| - name: Verify go fmt | |
| run: test -z "$(go fmt ./...)" | |
| - name: Verify go vet | |
| run: test -z "$(go vet ./...)" | |
| - name: Test | |
| run: make test | |
| - name: Linting | |
| if: matrix.gover == 'stable' | |
| run: make lint |