-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (63 loc) · 1.7 KB
/
ci.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
ci:
name: Run CI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
go: [ '1.17', '1.18' ]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v2
# copy-pasta from https://github.com/caddyserver/caddy/blob/master/.github/workflows/ci.yml
- name: Print Go version and environment
id: vars
run: |
printf "Using go at: $(which go)\n"
printf "Go version: $(go version)\n"
printf "\n\nGo environment:\n\n"
go env
printf "\n\nSystem environment:\n\n"
env
echo "::set-output name=go_cache::$(go env GOCACHE)"
- name: Cache the build cache
uses: actions/cache@v2
with:
path: ${{ steps.vars.outputs.go_cache }}
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go }}-go-ci
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
lint:
name: Run golangci linter
timeout-minutes: 5
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
go: [ '1.17', '1.18' ]
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Run linter
uses: golangci/golangci-lint-action@v2
with:
version: v1.46