Skip to content

Commit 3d95668

Browse files
committed
ci: add GitHub Actions test workflow
Add automated testing workflow that runs on push and pull requests to main branch. Includes Go module caching and code coverage reporting via Codecov.
1 parent 126ff82 commit 3d95668

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/test.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: "1.23"
23+
24+
- name: Cache Go modules
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/go/pkg/mod
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Download dependencies
33+
run: go mod download
34+
35+
- name: Run tests
36+
run: go test -v ./...
37+
38+
- name: Run tests with coverage
39+
run: go test -v -coverprofile=coverage.out ./...
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v3

0 commit comments

Comments
 (0)