Skip to content

Commit 385363b

Browse files
adnaanclaude
andcommitted
feat: Add GitHub Actions workflow for CI testing
Add comprehensive test workflow that runs on pull requests: - Code formatting verification (go fmt) - Linting with golangci-lint (errcheck, unused, staticcheck, etc.) - Full test suite including chromedp E2E tests - Chrome container setup for browser-based tests All checks must pass before PRs can be merged (configure branch protection in Settings > Branches after first run). Matches pre-commit hook behavior with 120s timeout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 722e743 commit 385363b

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: 'stable'
22+
cache: true
23+
24+
- name: Start Chrome container for E2E tests
25+
run: |
26+
docker run -d -p 9222:9222 --name chrome chromedp/headless-shell:latest
27+
echo "CHROMEDP_REMOTE_URL=ws://localhost:9222" >> $GITHUB_ENV
28+
29+
- name: Install dependencies
30+
run: go mod download
31+
32+
- name: Check code formatting
33+
run: |
34+
gofmt_output=$(go fmt ./...)
35+
if [ -n "$gofmt_output" ]; then
36+
echo "❌ Code is not formatted. Run 'go fmt ./...' locally."
37+
echo "Files that need formatting:"
38+
echo "$gofmt_output"
39+
exit 1
40+
fi
41+
echo "✅ Code formatting is correct"
42+
43+
- name: Run linting
44+
uses: golangci/golangci-lint-action@v6
45+
with:
46+
version: latest
47+
args: --disable-all --enable=errcheck,unused,staticcheck,gosimple,ineffassign
48+
49+
- name: Run tests
50+
run: go test -v ./... -timeout=120s
51+
52+
- name: Cleanup Chrome container
53+
if: always()
54+
run: docker stop chrome && docker rm chrome

0 commit comments

Comments
 (0)