Skip to content

Commit 2d3f890

Browse files
committed
Add test workflow.
1 parent 01249ed commit 2d3f890

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/test.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Go Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version:
15+
- "1.18"
16+
- "1.19"
17+
- "1.20"
18+
- "1.21"
19+
- "1.22"
20+
- "1.23"
21+
- "1.24"
22+
env:
23+
GOLANGCI_LINT_VERSION: v1.64.5
24+
25+
steps:
26+
- name: Install Go
27+
if: success()
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version: ${{ matrix.go-version }}
31+
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Cache Go modules
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/go/pkg/mod
39+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
40+
restore-keys: |
41+
${{ runner.os }}-go-
42+
43+
- name: Run linter
44+
uses: golangci/golangci-lint-action@v6
45+
with:
46+
version: ${{ env.GOLANGCI_LINT_VERSION }}
47+
48+
- name: Run tests
49+
run: go run gotest.tools/gotestsum@latest --junitfile tests.xml --format pkgname -- -cover -race ./...
50+
51+
- name: Test Summary
52+
uses: test-summary/action@v2
53+
with:
54+
paths: "tests.xml"
55+
if: always()

0 commit comments

Comments
 (0)