Skip to content

Commit e7a8909

Browse files
authored
Add GitHub Actions workflow for testing Go code
1 parent b13b596 commit e7a8909

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.24.1'
24+
cache: true
25+
26+
- name: Download dependencies
27+
run: go mod download
28+
29+
- name: Verify dependencies
30+
run: go mod verify
31+
32+
- name: Run go vet
33+
run: go vet ./...
34+
35+
- name: Run tests
36+
run: go test -v -race -coverprofile=coverage.out ./...
37+
38+
- name: Check test coverage
39+
run: go tool cover -func=coverage.out
40+
41+
- name: Upload coverage to artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report
45+
path: coverage.out

0 commit comments

Comments
 (0)