-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (52 loc) · 1.43 KB
/
go.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
52
name: CI
"on":
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
check:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: go build -v ./...
- name: Test
run: go test -v "-test.v=true" ./...
- name: Check examples
run: |
./_examples/clean.sh
./_examples/build-examples.sh
if $(git diff --quiet); then
echo "examples are clean"
else
echo "examples are dirty, rebuild it locally before commiting"
git diff | cat
exit 1
fi
- name: Coverage report
run: |
go test -v -covermode=count -coverprofile=coverage.out -tags coverage ./...
go tool cover -func=coverage.out
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Vet
run: go vet
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.61.0