Merge pull request #130 from jonhadfield/feat/wire-ipfetcher-providers #481
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: Test | |
| on: [push] | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| go-version: [ 'stable' ] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - | |
| name: Setup Go ${{ matrix.go-version }} | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - | |
| name: Tests | |
| run: | | |
| go mod tidy | |
| go test -cover -v -failfast -p 1 $(go list ./...) -coverprofile cover.out | |
| - | |
| name: Coverage threshold gate | |
| # Ratchet: fail if total coverage drops below MIN_COVERAGE. Raise this as | |
| # coverage improves so it can only move up. Linux-only to avoid duplication. | |
| if: runner.os == 'Linux' | |
| env: | |
| MIN_COVERAGE: "59.0" | |
| run: | | |
| total=$(go tool cover -func=cover.out | awk '/^total:/ {gsub(/%/,"",$3); print $3}') | |
| echo "total coverage: ${total}% (minimum: ${MIN_COVERAGE}%)" | |
| awk -v t="$total" -v m="$MIN_COVERAGE" 'BEGIN { if (t+0 < m+0) { printf "coverage %.1f%% is below minimum %.1f%%\n", t, m; exit 1 } }' | |
| - | |
| name: Codacy Coverage Reporter | |
| uses: codacy/codacy-coverage-reporter-action@v1.3.0 | |
| with: | |
| coverage-reports: cover.out | |
| force-coverage-parser: go | |
| if: runner.os != 'Windows' | |
| continue-on-error: true | |
| env: | |
| CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} |