Add API version 2026-04-16 support #122
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, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| test: | |
| name: Test Go ${{ matrix.go-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| go-version: ['1.23'] | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go ${{ matrix.go-version }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum', '**/go.mod') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go-${{ matrix.go-version }}- | |
| - name: Download and verify dependencies | |
| run: | | |
| go mod download | |
| go mod verify | |
| - name: Run vet | |
| run: go vet ./... | |
| - name: Run tests | |
| run: go test -race -coverprofile=coverage.out -covermode=atomic -v $(go list ./... | grep -v /examples) | |
| - name: Run tests for enums package | |
| run: go test -race -v ./resource/enums | |
| - name: Generate badge.json | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| PERCENT=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') | |
| if [ "$(echo "$PERCENT >= 90" | bc)" -eq 1 ]; then COLOR="brightgreen" | |
| elif [ "$(echo "$PERCENT >= 75" | bc)" -eq 1 ]; then COLOR="green" | |
| elif [ "$(echo "$PERCENT >= 60" | bc)" -eq 1 ]; then COLOR="yellow" | |
| else COLOR="red"; fi | |
| mkdir -p coverage | |
| echo "{\"schemaVersion\":1,\"label\":\"coverage\",\"message\":\"${PERCENT}%\",\"color\":\"${COLOR}\"}" > coverage/badge.json | |
| - name: Upload coverage artifact | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-badge | |
| path: coverage | |
| deploy-coverage: | |
| needs: test | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Download coverage badge | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage-badge | |
| path: coverage | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: coverage | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |