Merge pull request #1 from JupiterMetaLabs/chore/update-dependencies #39
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", "release/**" ] | |
| pull_request: | |
| branches: [ "main", "release/**" ] | |
| # Cancel any in-progress run for the same branch when a new push arrives. | |
| # This avoids wasting runner minutes on stale commits. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Single source of truth for the linter version. | |
| # Using v2.x to natively support Go 1.25/1.26 toolchains. | |
| GOLANGCI_LINT_VERSION: v2.10.1 | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint & Hygiene | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh \ | |
| | sh -s -- -b $(go env GOPATH)/bin ${{ env.GOLANGCI_LINT_VERSION }} | |
| - name: Verify module metadata is tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code go.mod go.sum || { | |
| echo "::error::go.mod or go.sum is out of sync. Run 'go mod tidy' locally." | |
| exit 1 | |
| } | |
| - name: Format check | |
| run: | | |
| $(go env GOPATH)/bin/golangci-lint fmt --diff || { | |
| echo "::error::Formatting issues found. Run 'golangci-lint fmt' locally." | |
| exit 1 | |
| } | |
| - name: Run golangci-lint | |
| run: | | |
| $(go env GOPATH)/bin/golangci-lint run --timeout=5m | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go-version: [ "1.25", "1.26" ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Run Tests with Coverage | |
| run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-${{ matrix.go-version }} | |
| path: coverage.txt | |
| retention-days: 5 | |
| build: | |
| name: Build (Cross-Compile) | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| goos: [linux, darwin, windows] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Verify compilation for ${{ matrix.goos }}/${{ matrix.goarch }} | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: go build -v ./... |