Skip to content

Commit f92d388

Browse files
committed
test: add ci
1 parent 5b59be9 commit f92d388

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)