Repository navigation
294 lines (287 loc) · 11.1 KB
/
Copy pathaddons-tests.yml
File metadata and controls
294 lines (287 loc) · 11.1 KB
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
---
name: 'Add-on Tests'
# Runs the suites of scripts/addons/suites.json: the add-on contract, gateway,
# policy, recovery, upgrade and host-slot suites, the add-on library sources,
# the Tables suites and the browser specs of the add-on pages. verify.sh checks
# each suite against its exact case inventory and fails on a skipped, flaky or
# missing case.
#
# The Go tests under addons/ and the tests/addons/actione2e and
# tests/addons/clientflow suites run in the
# main test workflow (make test, make test-coverage-check). The packaging suite
# runs in addons-package.yml. The UI unit tests of every add-on run in
# tests-ui-unit.yml.
#
# Concurrency. A newer push to master cancels the older in-flight run of this
# workflow, as in the other test workflows: tests are cumulative, so only the
# newest commit is worth testing. A pull request groups by its number and
# cancels its own older runs. Tag pushes group by their own ref, and schedule
# and dispatch runs group by SHA, so a master push never cancels them.
on:
pull_request:
paths:
- 'addons/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/addons-tests.yml'
- 'core/**'
- 'pkg/**'
- 'cmd/**'
- 'internal/**'
- 'backend/go/**'
- 'backend/*.proto'
- 'backend/*/*.proto'
- 'tests/**'
- 'configuration/**'
- 'swagger/**'
- 'prompt-templates/**'
- 'gallery/addons/**'
- 'docs/content/addons/contract-reference/**'
- 'docs/content/addons/catalogue/work/tables.md'
- 'docs/content/addons/tables-reference.md'
- 'docs/content/addons/manage-addons.md'
- 'docs/content/addons/install-and-update.md'
- 'docs/content/addons/catalogue/work/sandbox-settings.md'
- 'Makefile'
- 'scripts/**'
- 'examples/addon-hello/**'
- '.github/actions/**'
push:
branches: [master]
paths:
- 'addons/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/addons-tests.yml'
- 'core/**'
- 'pkg/**'
- 'cmd/**'
- 'internal/**'
- 'backend/go/**'
- 'backend/*.proto'
- 'backend/*/*.proto'
- 'tests/**'
- 'configuration/**'
- 'swagger/**'
- 'prompt-templates/**'
- 'gallery/addons/**'
- 'docs/content/addons/contract-reference/**'
- 'docs/content/addons/catalogue/work/tables.md'
- 'docs/content/addons/tables-reference.md'
- 'docs/content/addons/manage-addons.md'
- 'docs/content/addons/install-and-update.md'
- 'docs/content/addons/catalogue/work/sandbox-settings.md'
- 'Makefile'
- 'scripts/**'
- 'examples/addon-hello/**'
- '.github/actions/**'
concurrency:
group: ci-addons-tests-${{ github.event.pull_request.number || (github.event_name == 'push' && github.ref) || github.sha }}-${{ github.repository }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
permissions:
contents: read
jobs:
inventory:
# An early check that fails before the shared fixtures are built: a Ginkgo spec
# added or removed without the matching entry in scripts/addons/suites.json.
name: Ginkgo case inventories match the specs
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Clone
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.26.x'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libopus-dev
- name: Compare the inventories with the specs
# The tests of some suites import the HTTP server, which embeds the built
# UI. A dry run does not serve it, so an empty placeholder is enough.
run: |
mkdir -p core/http/react-ui/dist
touch core/http/react-ui/dist/index.html
make addons-inventory
prepare:
name: prepare shared production fixtures
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Clone
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Free disk space
# prepare.sh stops below 20 GiB free. The hosted runner image ships
# toolchains this job never uses; remove them before anything installs.
run: sh scripts/ci/free-runner-disk.sh
- name: Setup Go
uses: actions/setup-go@v6
with:
# prepare.sh accepts Go 1.26.x only and runs with GOTOOLCHAIN=local.
go-version: '1.26.x'
cache: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
# prepare.sh accepts Node 22.12 or later within Node 22.
node-version: '22'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libopus-dev unzip curl
- name: Install protoc
# prepare.sh requires exactly libprotoc 26.1.
run: |
curl -L -s https://github.com/protocolbuffers/protobuf/releases/download/v26.1/protoc-26.1-linux-x86_64.zip -o protoc.zip
sudo unzip -j -d /usr/local/bin protoc.zip bin/protoc
rm protoc.zip
protoc --version
- name: Prepare the build toolchain
# The producer installs build inputs only; consumers install Chromium.
run: sh scripts/addons/prepare.sh --prepare-build
- name: Build the UI, the mock backend and the UI test server
run: COVERAGE=false COVERAGE_V8=false sh scripts/addons/prepare.sh --integration
- name: Archive production fixtures
run: |
python3 scripts/ci/fixtures.py pack
- uses: actions/upload-artifact@v7
with:
name: addon-production-fixtures
path: ${{ runner.temp }}/addon-fixtures.tgz
if-no-files-found: error
retention-days: 1
out-of-tree:
# An add-on in another repository: the example is copied out of the checkout,
# built against it, packed with --root and checked. It needs the network for
# go mod tidy, so it does not run inside the offline suites above.
name: add-on outside the checkout
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Clone
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.26.x'
cache: false
- name: Install protoc
run: |
curl -L -s https://github.com/protocolbuffers/protobuf/releases/download/v26.1/protoc-26.1-linux-x86_64.zip -o protoc.zip
sudo unzip -j -d /usr/local/bin protoc.zip bin/protoc
rm protoc.zip
protoc --version
- name: Generate the backend protocol code
run: |
make install-go-tools
export PATH="$(go env GOPATH)/bin:$PATH"
mkdir -p pkg/grpc/proto
protoc --experimental_allow_proto3_optional -Ibackend/ --go_out=pkg/grpc/proto/ --go_opt=paths=source_relative --go-grpc_out=pkg/grpc/proto/ --go-grpc_opt=paths=source_relative backend/backend.proto
- name: Build, pack and check the example add-on
run: sh scripts/addons/outoftree_test.sh
suites:
needs: prepare
name: ${{ matrix.group }}
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
# Go suites over the owner, the carrier, the gateway and the policy.
- group: contracts and gateway
suites: prerequisites contracts catalog packages lifecycle runtime gateway oauth policy proposals artifacts apps
# Browser suites over the host pages of the add-ons.
- group: host pages
suites: gallery-ui esm-ui host-slots library-sources updates recovery
# Two frontends and an owner, with real authentication.
- group: foundation
suites: foundation-acceptance
# The Tables add-on: stores, tools and administration.
- group: tables
suites: tables-databases tables-schema tables-rows tables-tools tables-admin
# The Tables add-on: pages, CSV export and the end-to-end acceptance.
- group: tables pages
suites: tables-ui tables-csv tables-acceptance
steps:
- name: Clone
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Free disk space
# prepare.sh stops below 20 GiB free. The hosted runner image ships
# toolchains this job never uses; remove them before anything installs.
run: sh scripts/ci/free-runner-disk.sh
- name: Setup Go
uses: actions/setup-go@v6
with:
# prepare.sh accepts Go 1.26.x only and runs with GOTOOLCHAIN=local.
go-version: '1.26.x'
cache: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
# prepare.sh accepts Node 22.12 or later within Node 22.
node-version: '22'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libopus-dev unzip curl
- name: Install protoc
# prepare.sh requires exactly libprotoc 26.1.
run: |
curl -L -s https://github.com/protocolbuffers/protobuf/releases/download/v26.1/protoc-26.1-linux-x86_64.zip -o protoc.zip
sudo unzip -j -d /usr/local/bin protoc.zip bin/protoc
rm protoc.zip
protoc --version
- name: Prepare the toolchain
# Downloads the Go modules, installs the pinned protobuf plugins, runs
# npm ci and installs the Playwright Chromium. Nothing later reaches
# the network.
run: sh scripts/addons/prepare.sh --prepare
- name: Install the browser's system libraries
run: sudo env "PATH=$PATH" core/http/react-ui/node_modules/.bin/playwright install-deps chromium
- uses: actions/download-artifact@v8
with:
name: addon-production-fixtures
path: ${{ runner.temp }}
- name: Restore and check production fixtures
run: |
python3 scripts/ci/fixtures.py unpack
sh scripts/addons/prepare.sh --check
- name: Run the suites
env:
SUITES: ${{ matrix.suites }}
run: |
failed=""
for suite in $SUITES; do
echo "::group::$suite"
if ! sh scripts/addons/verify.sh "$suite"; then
failed="$failed $suite"
echo "::error::suite $suite failed"
fi
echo "::endgroup::"
done
if [ -n "$failed" ]; then
echo "failed suites:$failed" >&2
exit 1
fi
- name: Upload the suite logs
if: ${{ failure() }}
uses: actions/upload-artifact@v7
with:
name: addons-suite-logs-${{ strategy.job-index }}
path: |
.cache/addons/logs/
core/http/react-ui/playwright-report/
core/http/react-ui/test-results/
if-no-files-found: ignore
retention-days: 7