Skip to content

Commit 6a4e7f5

Browse files
committed
Add GitHub Action config to run tests
1 parent 79c1e6f commit 6a4e7f5

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
go-version: ['1.25']
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{ matrix.go-version }}
26+
27+
- name: Cache Go modules
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.cache/go-build
32+
~/go/pkg/mod
33+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
34+
restore-keys: |
35+
${{ runner.os }}-go-${{ matrix.go-version }}-
36+
37+
- name: Download dependencies
38+
run: go mod download
39+
40+
- name: Verify dependencies
41+
run: go mod verify
42+
43+
- name: Run tests
44+
run: make test
45+
46+
- name: Run fmt check
47+
run: |
48+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
49+
echo "The following files are not formatted:"
50+
gofmt -s -l .
51+
exit 1
52+
fi
53+
54+
build:
55+
name: Build
56+
runs-on: ubuntu-latest
57+
58+
strategy:
59+
matrix:
60+
go-version: ['1.25']
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Set up Go
67+
uses: actions/setup-go@v5
68+
with:
69+
go-version: ${{ matrix.go-version }}
70+
71+
- name: Cache Go modules
72+
uses: actions/cache@v4
73+
with:
74+
path: |
75+
~/.cache/go-build
76+
~/go/pkg/mod
77+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
78+
restore-keys: |
79+
${{ runner.os }}-go-${{ matrix.go-version }}-
80+
81+
- name: Download dependencies
82+
run: go mod download
83+
84+
- name: Build
85+
run: make build

0 commit comments

Comments
 (0)