-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (41 loc) · 1.05 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: continuous integration
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.21, 1.22]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Install dependencies
run: go mod download
- name: Check Go fmt
run: |
if ! go fmt ./...; then
echo "Go fmt check failed"
exit 1
fi
- name: Run Go vet
run: go vet ./...
- name: Run tests
run: go test ./... -v -cover