-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (36 loc) · 963 Bytes
/
ci.yml
File metadata and controls
45 lines (36 loc) · 963 Bytes
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: ['*']
jobs:
test:
name: Test (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21', '1.22', '1.23']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "The following files are not formatted correctly:"
gofmt -l .
exit 1
fi
- name: Run go vet
run: go vet ./...
- name: Run tests
run: go test -race -v ./...
- name: Run tests with coverage
run: go test -cover ./... | tee coverage.txt
- name: Show coverage summary
run: cat coverage.txt