ci: verify generated configs, cancel stale runs, dedupe tests #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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Verify module files | |
| run: go mod tidy -diff | |
| - name: Verify generated configs | |
| run: make conf conf9 && git diff --exit-code pg_exporter.yml legacy/pg_exporter.yml | |
| - name: Run tests | |
| run: go test -race -count=1 ./... | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Cross-build supported targets | |
| run: | | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./... | |
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./... | |
| CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build ./... | |
| CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ./... | |
| CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ./... | |
| CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ./... |