Skip to content

Commit c547870

Browse files
schighclaude
andcommitted
Add CI workflow for linting, tests, and coverage
GitHub Actions workflow that runs on push/PR to main: - golangci-lint via golangci-lint-action - Unit tests with race detector - Coverage report with 40% threshold (CLI integration tests run via exec.Command and don't register with go cover) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent be30d04 commit c547870

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version: "1.23"
18+
- uses: golangci/golangci-lint-action@v6
19+
with:
20+
version: latest
21+
22+
test:
23+
name: Test
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-go@v5
28+
with:
29+
go-version: "1.23"
30+
31+
- name: Run library tests with coverage
32+
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
33+
34+
- name: Report coverage
35+
run: |
36+
go tool cover -func=coverage.out
37+
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
38+
echo "Total coverage: ${COVERAGE}%"
39+
if [ "$(echo "$COVERAGE < 40" | bc)" -eq 1 ]; then
40+
echo "::error::Coverage ${COVERAGE}% is below 40% threshold"
41+
exit 1
42+
fi

0 commit comments

Comments
 (0)