chore(main): release 0.2.0 #15
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
| # This workflow builds and tests pull requests. | |
| name: Build and Test PR | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| # Restrict permissions to the minimum required (read-only) | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| build_and_test: | |
| name: Build and Test PR | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| GOTOOLCHAIN: local | |
| steps: | |
| - name: Checkout PR Code | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: 'false' | |
| - name: Resolve Go patch series | |
| id: go-version | |
| run: | | |
| set -euo pipefail | |
| GO_DIRECTIVE=$(awk '$1 == "go" { print $2; exit }' go.mod) | |
| if ! [[ "${GO_DIRECTIVE}" =~ ^([0-9]+)\.([0-9]+)(\.[0-9]+)?$ ]]; then | |
| echo "Unsupported go directive: ${GO_DIRECTIVE}" | |
| exit 1 | |
| fi | |
| echo "version=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x" >> "$GITHUB_OUTPUT" | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ steps.go-version.outputs.version }} | |
| check-latest: true | |
| cache: true | |
| - name: Download Dependencies | |
| run: go mod download | |
| - name: Verify Dependencies | |
| run: go mod verify | |
| - name: Check Go Modules Are Tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code -- go.mod go.sum | |
| - name: Run Tests | |
| run: go test -count 1 -v ./... | |
| - name: Build | |
| run: go build -v . |