Skip to content

Implement load ndjson files dumped by event listener #47

Implement load ndjson files dumped by event listener

Implement load ndjson files dumped by event listener #47

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test ./... -v -race -count=1 -timeout 120s
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Run tests with coverage
run: go test ./... -coverprofile=coverage.out -covermode=atomic -timeout 120s
- name: Check coverage threshold
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
echo "Total coverage: ${COVERAGE}%"
THRESHOLD=50
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
echo "Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
exit 1
fi
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.out
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Run go vet
run: go vet ./...
- name: Check formatting
run: |
UNFORMATTED=$(gofmt -l .)
if [ -n "$UNFORMATTED" ]; then
echo "The following files are not formatted:"
echo "$UNFORMATTED"
exit 1
fi
- name: Run staticcheck
uses: dominikh/staticcheck-action@v1
with:
version: "latest"
vuln:
name: Vulnerability Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck
run: govulncheck ./...
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Build
run: go build ./...
- name: Verify go.mod is tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum
commit-messages:
name: Commit Messages
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check semantic commit messages
run: |
MERGE_BASE=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
COMMITS=$(git log --format='%s' "$MERGE_BASE"..${{ github.event.pull_request.head.sha }})
PATTERN='^(feat|fix|refactor|test|docs|ci|chore|perf|style|build|revert)(\(.+\))?: .+'
FAILED=0
while IFS= read -r msg; do
if [[ ! "$msg" =~ $PATTERN ]]; then
echo "::error::Non-compliant commit message: $msg"
FAILED=1
fi
done <<< "$COMMITS"
if [ "$FAILED" -eq 1 ]; then
echo ""
echo "Commit messages must follow: <type>: <description>"
echo "Valid types: feat, fix, refactor, test, docs, ci, chore, perf, style, build, revert"
exit 1
fi
genconfig:
name: Verify Generated Configs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Build pbench
run: go build -o pbench
- name: Regenerate cluster configs
run: ./pbench genconfig -p clusters/params.json -t clusters/templates clusters
- name: Check for stale configs
run: |
if ! git diff --exit-code clusters/; then
echo ""
echo "ERROR: Generated cluster configs are out of date."
echo "Run 'make clusters' and commit the results."
exit 1
fi