Skip to content

Commit 5091197

Browse files
committed
feat: add auto test workflow
1 parent e630156 commit 5091197

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Run Tests"
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '*.md'
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
jobs:
12+
test:
13+
name: Run Go tests
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.20
24+
cache: true
25+
26+
- name: Cache Go modules
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.cache/go-build
31+
~/go/pkg/mod
32+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
33+
restore-keys: |
34+
${{ runner.os }}-go-
35+
36+
- name: Install dependencies
37+
run: go mod download
38+
39+
- name: Run tests with coverage
40+
run: |
41+
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...

0 commit comments

Comments
 (0)