-
Notifications
You must be signed in to change notification settings - Fork 3
99 lines (92 loc) · 2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17
- name: Check out
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run gofmt
shell: bash
run: |
if ! test -z $(gofmt -l .); then
echo "Some files are not formatted properly. Please run \"go fmt ./...\" and commit the changes."
echo
gofmt -d .
exit 1
fi
- name: Run vet
run: go vet ./...
docs:
name: Check documentation freshness
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17
- name: Check out
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: |
go generate
if ! git diff --quiet; then
echo "The documentation has changed. Please run `go generate` and commit the changes."
exit 1
fi
build:
name: Build
runs-on: ubuntu-20.04
strategy:
matrix:
go-version: [ 1.14.x, 1.15.x, 1.16.x, 1.17.x ]
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Install just
uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb # v1.4.0
- name: Check out
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: go build
- name: Test
run: go test ./...
- name: Test against Wistia API
run: |
set -e
just install linux_amd64
cd examples
terraform init
WISTIA_ACCESS_TOKEN="${{ secrets.READ_ONLY_TOKEN }}" terraform plan