Merge pull request #8 from nnemirovsky/fix/dns-and-channel-gate #26
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - run: go vet ./... | |
| - name: Run tests with coverage | |
| run: go test ./... -race -timeout 60s -coverprofile=coverage.out | |
| - name: Check coverage threshold | |
| run: | | |
| total=$(go tool cover -func=coverage.out | grep '^total:' | awk '{print $NF}' | tr -d '%') | |
| if [ -z "$total" ]; then | |
| echo "Failed to parse coverage from coverage.out" | |
| exit 1 | |
| fi | |
| echo "Total coverage: ${total}%" | |
| if awk "BEGIN{exit !($total < 75)}"; then | |
| echo "Coverage ${total}% is below 75% threshold" | |
| exit 1 | |
| fi | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: coverage.out |