Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Showing 2 changed files with 81 additions and 0 deletions.
| @@ -0,0 +1,45 @@ | ||
| 1 | + name: ci | |
| 2 | + | |
| 3 | + on: | |
| 4 | + push: | |
| 5 | + branches: [main] | |
| 6 | + pull_request: | |
| 7 | + | |
| 8 | + permissions: | |
| 9 | + contents: read | |
| 10 | + | |
| 11 | + jobs: | |
| 12 | + test: | |
| 13 | + name: ${{ matrix.os }} | |
| 14 | + strategy: | |
| 15 | + # One platform failing says nothing about the other, and seeing both | |
| 16 | + # at once is how a portability bug is told from a plain one. | |
| 17 | + fail-fast: false | |
| 18 | + matrix: | |
| 19 | + os: [ubuntu-latest, macos-latest] | |
| 20 | + runs-on: ${{ matrix.os }} | |
| 21 | + steps: | |
| 22 | + - uses: actions/checkout@v5 | |
| 23 | + | |
| 24 | + - uses: actions/setup-go@v6 | |
| 25 | + with: | |
| 26 | + go-version-file: go.mod | |
| 27 | + | |
| 28 | + - name: build | |
| 29 | + run: go build ./... | |
| 30 | + | |
| 31 | + - name: vet | |
| 32 | + run: go vet ./... | |
| 33 | + | |
| 34 | + - name: test | |
| 35 | + run: go test ./... | |
| 36 | + | |
| 37 | + - name: gofmt | |
| 38 | + if: runner.os == 'Linux' | |
| 39 | + run: | | |
| 40 | + unformatted=$(gofmt -l .) | |
| 41 | + if [ -n "$unformatted" ]; then | |
| 42 | + echo "These files are not gofmt-formatted:" | |
| 43 | + echo "$unformatted" | |
| 44 | + exit 1 | |
| 45 | + fi | |
| @@ -0,0 +1,36 @@ | ||
| 1 | + name: release | |
| 2 | + | |
| 3 | + on: | |
| 4 | + push: | |
| 5 | + tags: ["v*"] | |
| 6 | + | |
| 7 | + permissions: | |
| 8 | + # Creating the GitHub release and uploading its archives. | |
| 9 | + contents: write | |
| 10 | + | |
| 11 | + jobs: | |
| 12 | + goreleaser: | |
| 13 | + runs-on: ubuntu-latest | |
| 14 | + steps: | |
| 15 | + - uses: actions/checkout@v5 | |
| 16 | + with: | |
| 17 | + # The changelog is the commits since the previous tag, and a | |
| 18 | + # shallow clone has neither. | |
| 19 | + fetch-depth: 0 | |
| 20 | + | |
| 21 | + - uses: actions/setup-go@v6 | |
| 22 | + with: | |
| 23 | + go-version-file: go.mod | |
| 24 | + | |
| 25 | + # A tag is cut from a commit CI has usually already passed, but not | |
| 26 | + # necessarily: this is the last chance to not publish a broken build. | |
| 27 | + - name: test | |
| 28 | + run: go test ./... | |
| 29 | + | |
| 30 | + - uses: goreleaser/goreleaser-action@v6 | |
| 31 | + with: | |
| 32 | + distribution: goreleaser | |
| 33 | + version: "~> v2" | |
| 34 | + args: release --clean | |
| 35 | + env: | |
| 36 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |