-
Notifications
You must be signed in to change notification settings - Fork 8
55 lines (44 loc) · 1.49 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
52
53
54
55
name: ci
on:
- push
- pull_request
jobs:
go:
name: Go ${{matrix.go}} - ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["windows-latest", "ubuntu-latest", "macOS-latest"]
go: ["1.19.x"]
fail-fast: false
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{matrix.go}}
- name: Get Go cache path
id: go-cache
shell: bash
run: |
echo "goos=$(go env GOOS)" >> $GITHUB_OUTPUT
echo "goarch=$(go env GOARCH)" >> $GITHUB_OUTPUT
echo "goversion=$(go env GOVERSION)" >> $GITHUB_OUTPUT
echo "gocache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "gomodcache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
- name: Go build cache
uses: actions/cache@v3
with:
path: ${{steps.go-cache.outputs.gocache}}
key: ${{steps.go-cache.outputs.goversion}}-${{steps.go-cache.outputs.goos}}-${{steps.go-cache.outputs.goarch}}-go-build-${{hashFiles('**/go.sum')}}
- name: Go mod cache
uses: actions/cache@v3
with:
path: ${{steps.go-cache.outputs.gomodcache}}
key: ${{steps.go-cache.outputs.goversion}}-${{steps.go-cache.outputs.goos}}-${{steps.go-cache.outputs.goarch}}-go-mod-${{hashFiles('**/go.sum')}}
- name: Go test
run: go test -v ./...
- name: Go vet
run: go vet ./...
- name: Go staticcheck
run: go run honnef.co/go/tools/cmd/[email protected] ./...