-
Notifications
You must be signed in to change notification settings - Fork 2.4k
193 lines (168 loc) · 4.89 KB
/
test.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Test
on:
push:
branches-ignore:
- 'main'
- 'gh-readonly-queue/**'
paths-ignore:
- '**.md'
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
merge_group:
jobs:
test:
name: Test
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3.5.3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: oldstable
- name: go mod tidy
run: |
go mod tidy
if [ -n "$(git status --porcelain)" ]; then
echo "Run 'go mod tidy' and push it"
exit 1
fi
if: matrix.operating-system == 'ubuntu-latest'
- name: Lint
uses: golangci/golangci-lint-action@v3.6.0
with:
version: v1.52
args: --deadline=30m
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
if: matrix.operating-system == 'ubuntu-latest'
- name: Install tools
uses: aquaproj/aqua-installer@v2.1.2
with:
aqua_version: v1.25.0
aqua_opts: ""
- name: Check if CLI references are up-to-date
run: |
mage docs:generate
if [ -n "$(git status --porcelain)" ]; then
echo "Run 'mage docs:generate' and push it"
exit 1
fi
if: matrix.operating-system == 'ubuntu-latest'
- name: Run unit tests
run: mage test:unit
integration:
name: Integration Test
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3.5.3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install tools
uses: aquaproj/aqua-installer@v2.1.2
with:
aqua_version: v1.25.0
- name: Run integration tests
run: mage test:integration
k8s-integration:
name: K8s Integration Test
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3.5.3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install tools
uses: aquaproj/aqua-installer@v2.1.2
with:
aqua_version: v1.25.0
- name: Run k8s integration tests
run: mage test:k8s
module-test:
name: Module Integration Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install tools
uses: aquaproj/aqua-installer@v2.1.2
with:
aqua_version: v1.25.0
- name: Run module integration tests
shell: bash
run: |
mage test:module
vm-test:
name: VM Integration Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install tools
uses: aquaproj/aqua-installer@v2.1.2
with:
aqua_version: v1.25.0
- name: Run vm integration tests
run: |
mage test:vm
build-test:
name: Build Test
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v7
with:
root-reserve-mb: 35840 # The Go cache (`~/.cache/go-build` and `~/go/pkg`) requires a lot of storage space.
remove-android: 'true'
remove-docker-images: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
if: matrix.operating-system == 'ubuntu-latest'
- name: Checkout
uses: actions/checkout@v3.5.3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Determine GoReleaser ID
id: goreleaser_id
shell: bash
run: |
if [ "${{ matrix.operating-system }}" == "windows-latest" ]; then
echo "id=--id build-windows" >> $GITHUB_OUTPUT
elif [ "${{ matrix.operating-system }}" == "macos-latest" ]; then
echo "id=--id build-macos --id build-bsd" >> $GITHUB_OUTPUT
else
echo "id=--id build-linux" >> $GITHUB_OUTPUT
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: v1.16.2
args: build --snapshot --clean --timeout 90m ${{ steps.goreleaser_id.outputs.id }}