test: improve coverage from 43.7% to 56.8% #1
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 SDK | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| - ".github/workflows/go-sdk.yml" | |
| pull_request: | |
| paths: | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| - ".github/workflows/go-sdk.yml" | |
| concurrency: | |
| group: go-sdk-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go: ["1.21", "1.22", "1.23", "1.24"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go ${{ matrix.go }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| cache-dependency-path: go.sum | |
| - name: Download modules | |
| run: go mod download | |
| - name: Build | |
| run: go build ./... | |
| - name: Test (with race detector) | |
| run: go test ./... -race -count=1 | |
| - name: Collect coverage (Go 1.24 only) | |
| if: matrix.go == '1.24' | |
| run: go test ./... -race -count=1 -coverprofile=coverage.out -covermode=atomic | |
| - name: Upload coverage to Codecov | |
| if: matrix.go == '1.24' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: coverage.out | |
| fail_ci_if_error: false | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| cache-dependency-path: go.sum | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: latest |