Skip to content

ci(deps): bump github/codeql-action from 4 to 4.37.4 #33

ci(deps): bump github/codeql-action from 4 to 4.37.4

ci(deps): bump github/codeql-action from 4 to 4.37.4 #33

Workflow file for this run

name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Read-only by default. This workflow never writes back to the repo —
# badges are served directly by shields.io from public GitHub APIs and
# pkg.go.dev, so there is no self-hosted JSON to commit.
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Install dependencies
run: go mod download
# Build validation (cross-platform).
# Conditionally diffs go.sum only if present — pure-stdlib children have none.
- name: Build validation
shell: bash
run: |
go build ./...
go mod tidy
git diff --exit-code go.mod
if [ -f go.sum ]; then
git diff --exit-code go.sum
fi
- name: Run tests (Unix)
if: runner.os != 'Windows'
run: go test -v -race -coverprofile=coverage.out ./...
- name: Run tests (Windows)
if: runner.os == 'Windows'
run: go test -v -coverprofile="coverage.out" ./...
- name: Run benchmarks
run: go test -bench=. -benchmem ./...
# Coverage badge: on a successful push to main from ubuntu-latest only,
# extract the total coverage percent from coverage.out and write it to
# the repo's public gist via schneegans/dynamic-badges-action. shields.io
# reads the gist via endpoint= mode. Requires GIST_TOKEN repo secret
# (gist scope only). PRs and Windows/macOS runs skip this step.
- name: Extract coverage percent
id: coverage
if: matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
pct=$(go tool cover -func=coverage.out | awk '/^total:/ {gsub("%",""); print $3}')
echo "pct=$pct" >> "$GITHUB_OUTPUT"
- name: Update coverage badge gist
if: matrix.os == 'ubuntu-latest' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: schneegans/dynamic-badges-action@v1.8.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: c2a8724a8f078f1d3b7c20a3489bf84d
filename: coverage.json
label: coverage
message: ${{ steps.coverage.outputs.pct }}%
valColorRange: ${{ steps.coverage.outputs.pct }}
minColorRange: 50
maxColorRange: 95