feat(gen): preserve explicit tool annotation presence (#12) #37
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: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| permissions: | |
| contents: read | |
| # Single source of truth for the Go version used across every job. Must | |
| # match or exceed the `go` directive in go.mod (currently 1.26.2) so Go's | |
| # auto-toolchain does not try to upgrade mid-build. | |
| env: | |
| GO_VERSION: "1.26.2" | |
| # All third-party actions are pinned to a full commit SHA per GitHub's | |
| # security guidance — a moving tag (`@v4` etc.) can be overwritten by the | |
| # action's maintainer at any time and silently pull in new code. The | |
| # comment on each line records the semver tag the SHA was resolved from | |
| # so `dependabot` and humans can still track upgrades. | |
| jobs: | |
| test: | |
| name: Go Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Verify go.mod is tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code -- go.mod go.sum | |
| - name: Build | |
| run: go build ./... | |
| - name: Test | |
| run: go test -race -count=1 -covermode=atomic -coverprofile=coverage.out ./... | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: coverage | |
| path: coverage.out | |
| retention-days: 7 | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9 | |
| with: | |
| version: v2.11.4 | |
| args: --timeout 5m | |
| proto: | |
| name: Proto lint & generate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - uses: bufbuild/buf-setup-action@a47c93e0b1648d5651a065437926377d060baa99 # v1.50.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: buf lint | |
| run: buf lint | |
| - name: buf breaking (against base branch) | |
| if: github.event_name == 'pull_request' | |
| env: | |
| REPO: ${{ github.repository }} | |
| BASE: ${{ github.base_ref }} | |
| run: buf breaking --against "https://github.com/${REPO}.git#branch=${BASE}" | |
| continue-on-error: true | |
| # Plugins run via `go tool` (see buf.gen.yaml), pinned by the tool | |
| # directives in go.mod — nothing to install here. | |
| - name: Regenerate and check diff | |
| run: | | |
| buf generate | |
| if ! git diff --quiet --exit-code; then | |
| echo "Generated files are out of date. Run 'make gen' and commit the result." | |
| git diff --stat | |
| exit 1 | |
| fi |