-
Notifications
You must be signed in to change notification settings - Fork 0
423 lines (356 loc) · 12.8 KB
/
Copy pathci.yml
File metadata and controls
423 lines (356 loc) · 12.8 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
name: CI/CD Workflow
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
concurrency:
# cancel any previous run on this branch or tag that is still in progress
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
RAW_VERSION: ${{ github.ref_name }}
jobs:
# -------------------------------------------------------------------------
# Core lint-and-test matrix (server + driver)
# -------------------------------------------------------------------------
lint-and-test-server-and-driver:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25.x', '1.26.x']
python-version: ['3.12']
node-version: ['20.x', '22.x']
extra: ['mock', 'aer', 'quantify', 'qblox']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: 'qpi-ui/go.sum'
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "qpi-driver/pyproject.toml"
- name: Set up nodejs
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies & formatting tools
run: |
if [ "${{ matrix.extra }}" = "mock" ]; then
uv sync --project qpi-driver --extra cli --dev
elif [ "${{ matrix.extra }}" = "aer" ]; then
uv sync --project qpi-driver --extra cli --extra aer --dev
elif [ "${{ matrix.extra }}" = "quantify" ]; then
uv sync --project qpi-driver --extra cli --extra quantify --dev
elif [ "${{ matrix.extra }}" = "qblox" ]; then
uv sync --project qpi-driver --extra cli --extra qblox --dev
fi
sudo apt-get update && sudo apt-get install -y zip
- name: Build dashboard
run: make build-dashboard
- name: Lint ochestrator
run: make lint-go
- name: Lint driver
run: make lint-py
- name: Test CLI
run: make test-py-cli
- name: Run Python Unit Tests for '${{ matrix.extra }}'
run: |
if [ "${{ matrix.extra }}" = "mock" ]; then
make test-py-base
elif [ "${{ matrix.extra }}" = "aer" ]; then
make test-py-aer
elif [ "${{ matrix.extra }}" = "quantify" ]; then
make test-py-quantify
elif [ "${{ matrix.extra }}" = "qblox" ]; then
make test-py-qblox
fi
- name: Run E2E Integration Tests for driver '${{ matrix.extra }}'
run: make test-e2e-driver EXECUTOR=${{ matrix.extra }}
# -------------------------------------------------------------------------
# qpi-client / Go SDK
# -------------------------------------------------------------------------
lint-and-test-go-client:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25.x', '1.26.x']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: 'qpi-client/go/go.sum'
- name: Lint Go Client
run: make lint-go-client
- name: Run Go Client Unit Tests
run: make test-go-client
# -------------------------------------------------------------------------
# qpi-client / Python SDK
# -------------------------------------------------------------------------
lint-and-test-py-client:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "qpi-client/py/pyproject.toml"
- name: Install Python client dependencies
run: uv sync --project qpi-client/py --dev
- name: Audit Python Client Formatting & Style
run: make lint-py-client
- name: Run Python Client Unit Tests
run: make test-py-client
# -------------------------------------------------------------------------
# qpi-client / JS SDK
# -------------------------------------------------------------------------
lint-and-test-js-client:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x', '22.x']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'qpi-client/js/package-lock.json'
- name: Audit JS Client Type-check
run: make lint-js
- name: Run JS Client Unit Tests
run: make test-js-client
# -------------------------------------------------------------------------
# E2E Cypress Dashboard Tests
# -------------------------------------------------------------------------
test-dashboard-cypress:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.x'
cache-dependency-path: 'qpi-ui/go.sum'
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: '3.12'
enable-cache: true
cache-dependency-glob: "qpi-driver/pyproject.toml"
- name: Install driver dependencies
run: uv sync --project qpi-driver --extra cli --dev
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
cache-dependency-path: 'qpi-ui/internal/dashboard/package-lock.json'
- name: Run E2E Cypress Dashboard Tests
run: make test-e2e-dashboard
# -------------------------------------------------------------------------
# E2E Systemd Installer Tests
# -------------------------------------------------------------------------
test-systemd-installer:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Systemd Installer E2E Test
run: make test-e2e-systemd
# -------------------------------------------------------------------------
# Publish qpi-driver to PyPI
# -------------------------------------------------------------------------
publish-pypi-driver:
needs: lint-and-test-server-and-driver
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_TO_PYPI == 'true'
environment:
name: driver_pypi
url: https://pypi.org/p/qpi-driver
permissions:
id-token: write
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: '3.12'
- name: Build Package
run: make package-driver
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: qpi-driver/dist/
print-hash: true
# -------------------------------------------------------------------------
# Publish qpi-client/py to PyPI
# -------------------------------------------------------------------------
publish-pypi-client:
needs: lint-and-test-py-client
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_PY_CLIENT == 'true'
permissions:
id-token: write
contents: read
environment:
name: client_pypi
url: https://pypi.org/p/qpi-client
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: '3.12'
- name: Build Package
run: make package-py
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: qpi-client/py/dist/
print-hash: true
# -------------------------------------------------------------------------
# Publish qpi-client/js to npm
# -------------------------------------------------------------------------
publish-npm-client:
needs: lint-and-test-js-client
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_JS_CLIENT == 'true'
permissions:
contents: read
id-token: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: 'qpi-client/js/package-lock.json'
- name: Install dependencies & build
run: make package-js
- name: Publish to npm
run: cd qpi-client/js && npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# -------------------------------------------------------------------------
# Publish Go server binaries to GitHub Release
# -------------------------------------------------------------------------
publish-go-release:
needs: [lint-and-test-server-and-driver, test-dashboard-cypress]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_GO_APP == 'true'
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.x'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
# Installs wixl (msitools) onto Ubuntu to compile the .msi package natively
- name: Install MSI Packing Tooling
run: sudo apt-get update && sudo apt-get install -y msitools wixl
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: latest
args: release --clean --config qpi-ui/pkg/.goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Compiles the real .msi Windows package from GoReleaser's output binary
- name: Package Windows MSI Installer
run: |
VERSION="${RAW_VERSION#v}"
sed -i "s/Version=\"[^\"]*\"/Version=\"${VERSION}\"/" qpi-ui/pkg/qpi.wxs
wixl -v qpi-ui/pkg/qpi.wxs -o dist/qpi_windows_amd64.msi
# Appends the new MSI installer asset into the active GitHub release draft
- name: Upload Windows MSI to Release
uses: softprops/action-gh-release@v3
with:
files: dist/qpi_windows_amd64.msi
draft: true
# Independent job to build the official Mac installer natively
package-macos-pkg:
needs: [publish-go-release]
runs-on: macos-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_GO_APP == 'true'
permissions:
contents: write
strategy:
matrix:
goarch: ['amd64', 'arm64']
env:
GOARCH: ${{ matrix.goarch }}
ARTEFACT: "qpi_${{ matrix.goarch }}"
OUTPUT_ARTEFACT: "qpi_macos_${{ matrix.goarch }}.pkg"
PKG_ROOT: "pkg_${{ matrix.goarch }}_root"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.x'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build Dashboard
run: make build-dashboard
- name: Build Mac ${{ matrix.goarch }} Binary
run: |
GOOS=darwin go build -C "qpi-ui" -ldflags="-s -w -X 'main.Version=v${RAW_VERSION#v}'" -o "../${ARTEFACT}" .
# Uses Apple's built-in tool suite to build the native component installer
- name: Build Native ${{ matrix.goarch }} macOS .pkg
run: |
mkdir -p "${PKG_ROOT}/usr/local/bin/"
cp "${ARTEFACT}" "${PKG_ROOT}/usr/local/bin/"
pkgbuild --identifier "com.sopherapps.qpi" --version "${RAW_VERSION#v}" --install-location "/" --root "$PKG_ROOT" "$OUTPUT_ARTEFACT"
- name: Upload macOS PKG to Release
uses: softprops/action-gh-release@v3
with:
files: ${{ env.OUTPUT_ARTEFACT }}
draft: true
publish-release:
needs: [package-macos-pkg]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_GO_APP == 'true'
permissions:
contents: write
steps:
- name: Publish Release
uses: softprops/action-gh-release@v3
with:
draft: false