-
Notifications
You must be signed in to change notification settings - Fork 1
585 lines (503 loc) · 20 KB
/
ci.yml
File metadata and controls
585 lines (503 loc) · 20 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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
flatpak_runtime_smoke:
description: Run the experimental Flatpak PipeWire routing smoke test
type: boolean
default: false
headless_pipewire_runtime_smoke:
description: Run the headless PipeWire/WirePlumber controller smoke test
type: boolean
default: false
live_ui_runtime_smoke:
description: Run the live GTK/AT-SPI/PipeWire smoke test
type: boolean
default: false
smoke_only:
description: Skip ordinary CI work and run only the requested experimental smoke job
type: boolean
default: false
flatpak_runtime_build:
description: Build and reinstall the local Flatpak before the runtime smoke test
type: boolean
default: true
flatpak_runtime_install_remote:
description: Install the smoke target from Flathub instead of using a local build
type: boolean
default: false
flatpak_runtime_app_ref:
description: Optional Flatpak app ref to run; blank infers the build or install ref
type: string
default: ""
flatpak_runtime_install_ref:
description: Flathub ref to install when flatpak_runtime_install_remote is enabled
type: string
default: io.github.bhack.mini-eq
flatpak_runtime_expected_version:
description: Optional installed Flatpak version expected by the runtime smoke test
type: string
default: ""
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PWG_VERSION: "0.3.7"
PWG_REQUIREMENT: "pipewire-gobject>=0.3.7,<0.4"
jobs:
changes:
runs-on: ubuntu-24.04
outputs:
flatpak: ${{ steps.filter.outputs.flatpak }}
release_metadata: ${{ steps.filter.outputs.release_metadata }}
test: ${{ steps.filter.outputs.test }}
tooling: ${{ steps.filter.outputs.tooling }}
pwg: ${{ steps.filter.outputs.pwg }}
steps:
- name: Detect changed files
id: filter
env:
BEFORE: ${{ github.event.before }}
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
SMOKE_ONLY: ${{ inputs.smoke_only }}
run: |
set -euo pipefail
files="$(mktemp)"
set_all() {
{
echo "test=true"
echo "tooling=true"
echo "pwg=true"
echo "flatpak=true"
echo "release_metadata=true"
} >> "$GITHUB_OUTPUT"
}
case "$GITHUB_EVENT_NAME" in
workflow_dispatch)
if [[ "${SMOKE_ONLY:-false}" == "true" ]]; then
{
echo "test=false"
echo "tooling=false"
echo "pwg=false"
echo "flatpak=false"
echo "release_metadata=false"
} >> "$GITHUB_OUTPUT"
exit 0
fi
set_all
exit 0
;;
pull_request)
gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' > "$files"
;;
push)
if [[ -z "${BEFORE:-}" || "$BEFORE" =~ ^0+$ ]]; then
set_all
exit 0
fi
gh api "repos/$GITHUB_REPOSITORY/compare/$BEFORE...$GITHUB_SHA" --jq '.files[].filename' > "$files"
;;
*)
set_all
exit 0
;;
esac
test=false
tooling=false
pwg=false
flatpak=false
release_metadata=false
while IFS= read -r path; do
case "$path" in
.github/workflows/*.yml)
test=true
tooling=true
pwg=true
flatpak=true
release_metadata=true
;;
README.md|pyproject.toml|MANIFEST.in|src/*|tests/*|data/*|extensions/*)
test=true
;;
tools/check_autoeq_live.py|tools/check_gnome_shell_extension.py|tools/check_headless_pipewire_runtime.py|tools/pack_gnome_shell_extension.sh|tools/prepare_release.py|tools/release_gates.py|tools/release_preflight.py|tools/release_runtime_gate.py|tools/release_status.py|tools/run_headless_pipewire_runtime_smoke_ci.sh|tools/run_live_ui_runtime_smoke_ci.sh)
test=true
;;
esac
case "$path" in
tools/*)
tooling=true
;;
esac
case "$path" in
CHANGELOG.md|README.md|MANIFEST.in|pyproject.toml|data/io.github.bhack.mini-eq.metainfo.xml|docs/development.md|docs/flathub.md|docs/release.md|docs/screenshots/README.md|tools/prepare_release.py|tools/release_status.py|tests/test_prepare_release.py|tests/test_release_status.py)
release_metadata=true
;;
esac
case "$path" in
.github/workflows/*.yml|tools/check_headless_pipewire_runtime.py|tools/check_pipewire_gobject.py|tools/release_gates.py|tools/release_runtime_gate.py|tools/run_headless_pipewire_runtime_smoke_ci.sh|src/mini_eq/pipewire_backend.py|src/mini_eq/analyzer.py)
pwg=true
;;
esac
case "$path" in
.github/workflows/*.yml|io.github.bhack.mini-eq.yaml|python3-dependencies.yaml|flatpak/*|src/*|data/*|pyproject.toml|MANIFEST.in|tools/check_pipewire_gobject.py|tools/release_gates.py|tools/release_runtime_gate.py)
flatpak=true
;;
esac
done < "$files"
{
echo "test=$test"
echo "tooling=$tooling"
echo "pwg=$pwg"
echo "flatpak=$flatpak"
echo "release_metadata=$release_metadata"
} >> "$GITHUB_OUTPUT"
{
echo "### CI scope"
echo
echo "- test: \`$test\`"
echo "- tooling: \`$tooling\`"
echo "- pipewire-gobject: \`$pwg\`"
echo "- flatpak: \`$flatpak\`"
echo "- release metadata: \`$release_metadata\`"
} >> "$GITHUB_STEP_SUMMARY"
release-metadata:
needs: changes
if: ${{ always() && !(github.event_name == 'workflow_dispatch' && inputs.smoke_only) }}
runs-on: ubuntu-24.04
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Skip unchanged scope
if: ${{ needs.changes.outputs.release_metadata != 'true' }}
run: echo "No release metadata changes detected; skipping release metadata status check."
- name: Check out repository
if: ${{ needs.changes.outputs.release_metadata == 'true' }}
uses: actions/checkout@v6
- name: Check local release metadata status
if: ${{ needs.changes.outputs.release_metadata == 'true' }}
run: python3 tools/release_status.py --no-network
tooling:
needs: changes
if: ${{ always() && !(github.event_name == 'workflow_dispatch' && inputs.smoke_only) }}
runs-on: ubuntu-24.04
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Skip unchanged scope
if: ${{ needs.changes.outputs.tooling != 'true' }}
run: echo "No maintainer-tooling changes detected; skipping tooling job work."
- name: Check out repository
if: ${{ needs.changes.outputs.tooling == 'true' }}
uses: actions/checkout@v6
- name: Cache pip downloads
if: ${{ needs.changes.outputs.tooling == 'true' }}
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: tooling-pip-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
restore-keys: tooling-pip-${{ runner.os }}-
- name: Install Python tooling
if: ${{ needs.changes.outputs.tooling == 'true' }}
run: |
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install ruff
- name: Lint
if: ${{ needs.changes.outputs.tooling == 'true' }}
run: .venv/bin/python -m ruff check .
- name: Check formatting
if: ${{ needs.changes.outputs.tooling == 'true' }}
run: .venv/bin/python -m ruff format --check .
test:
needs: changes
if: ${{ always() && !(github.event_name == 'workflow_dispatch' && inputs.smoke_only) }}
runs-on: ubuntu-24.04
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Skip unchanged scope
if: ${{ needs.changes.outputs.test != 'true' }}
run: echo "No Python/package changes detected; skipping test job work."
- name: Check out repository
if: ${{ needs.changes.outputs.test == 'true' }}
uses: actions/checkout@v6
- name: Cache pip downloads and wheels
if: ${{ needs.changes.outputs.test == 'true' }}
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: test-pip-${{ runner.os }}-py3-${{ hashFiles('pyproject.toml') }}
restore-keys: test-pip-${{ runner.os }}-py3-
- name: Install system dependencies
if: ${{ needs.changes.outputs.test == 'true' }}
run: |
sudo apt-get update
sudo apt-get install -y \
gir1.2-adw-1 \
gir1.2-gtk-4.0 \
gobject-introspection \
libgirepository1.0-dev \
libglib2.0-dev \
libpipewire-0.3-dev \
meson \
ninja-build \
pipewire \
python3-cairo \
python3-dev \
python3-gi \
python3-pip \
python3-setuptools \
python3-venv \
wireplumber
- name: Install Python dependencies
if: ${{ needs.changes.outputs.test == 'true' }}
run: |
python3 -m venv /tmp/mini-eq-pwg-build
/tmp/mini-eq-pwg-build/bin/python -m pip install --upgrade pip
/tmp/mini-eq-pwg-build/bin/python -m pip wheel "$PWG_REQUIREMENT" -w /tmp/mini-eq-wheelhouse
python3 -m venv --system-site-packages .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install --no-index --find-links /tmp/mini-eq-wheelhouse "$PWG_REQUIREMENT"
.venv/bin/python -m pip install -e '.[dev]'
- name: Lint
if: ${{ needs.changes.outputs.test == 'true' }}
run: .venv/bin/python -m ruff check .
- name: Check formatting
if: ${{ needs.changes.outputs.test == 'true' }}
run: .venv/bin/python -m ruff format --check .
- name: Test
if: ${{ needs.changes.outputs.test == 'true' }}
run: .venv/bin/python -m pytest -q
- name: Build package
if: ${{ needs.changes.outputs.test == 'true' }}
run: .venv/bin/python -m build
- name: Check package metadata
if: ${{ needs.changes.outputs.test == 'true' }}
run: .venv/bin/python -m twine check dist/*
- name: Smoke-test wheel CLI
if: ${{ needs.changes.outputs.test == 'true' }}
run: |
python3 -m venv --system-site-packages /tmp/mini-eq-wheel-test
/tmp/mini-eq-wheel-test/bin/python -m pip install --upgrade pip
/tmp/mini-eq-wheel-test/bin/python -m pip install --no-index --find-links /tmp/mini-eq-wheelhouse "$PWG_REQUIREMENT"
/tmp/mini-eq-wheel-test/bin/python -m pip install dist/mini_eq-*.whl
/tmp/mini-eq-wheel-test/bin/mini-eq --help
- name: Upload package artifacts
if: ${{ needs.changes.outputs.test == 'true' }}
uses: actions/upload-artifact@v7
with:
name: mini-eq-dist
path: dist/*
if-no-files-found: error
flatpak-build:
needs: changes
if: ${{ always() && !(github.event_name == 'workflow_dispatch' && inputs.smoke_only) && needs.changes.result == 'success' && needs.changes.outputs.flatpak == 'true' }}
runs-on: ubuntu-24.04
timeout-minutes: 60
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50@sha256:9d3a99bef793cf99f55b0106130e68a781fd0815c8d2954f26e1ac9253b19e57
options: --privileged
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Configure Flathub remote
run: |
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Build Flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@401fe28a8384095fc1531b9d320b292f0ee45adb
with:
bundle: mini-eq.flatpak
manifest-path: io.github.bhack.mini-eq.yaml
upload-artifact: false
- name: Install built Flatpak
run: flatpak --user install -y ./mini-eq.flatpak
- name: Smoke-test Flatpak CLI
run: flatpak run io.github.bhack.mini-eq --help
- name: Check pipewire-gobject GI compatibility
run: |
flatpak run --filesystem="$PWD":ro --command=python3 io.github.bhack.mini-eq \
"$PWD/tools/check_pipewire_gobject.py" --expect-version "$PWG_VERSION"
- name: Smoke-test Flatpak runtime modules
run: |
flatpak run --command=python3 io.github.bhack.mini-eq - <<'PY'
from pathlib import Path
required_files = [
"/app/lib/pipewire-0.3/libpipewire-module-filter-chain.so",
"/app/lib/spa-0.2/filter-graph/libspa-filter-graph.so",
"/app/lib/spa-0.2/filter-graph/libspa-filter-graph-plugin-builtin.so",
]
missing = [path for path in required_files if not Path(path).exists()]
if missing:
raise SystemExit(f"missing Flatpak runtime file(s): {', '.join(missing)}")
PY
flatpak run --command=python3 io.github.bhack.mini-eq - <<'PY'
from pathlib import Path
required_license_files = [
"/app/share/licenses/io.github.bhack.mini-eq/mini-eq/LICENSE",
"/app/share/licenses/io.github.bhack.mini-eq/pipewire-filter-chain-module/COPYING",
"/app/share/licenses/io.github.bhack.mini-eq/pipewire-filter-chain-module/LICENSE",
"/app/share/licenses/io.github.bhack.mini-eq/pipewire-gobject/LICENSE",
]
missing = [path for path in required_license_files if not Path(path).exists()]
if missing:
raise SystemExit(f"missing Flatpak license file(s): {', '.join(missing)}")
PY
flatpak run --command=python3 io.github.bhack.mini-eq - <<'PY'
import importlib
required_modules = ["numpy", "pipewire_gobject"]
missing = []
for name in required_modules:
try:
importlib.import_module(name)
except Exception as exc:
missing.append(f"{name}: {exc}")
if missing:
raise SystemExit(f"missing Python analyzer module(s): {', '.join(missing)}")
PY
flatpak:
needs:
- changes
- flatpak-build
if: ${{ always() && !(github.event_name == 'workflow_dispatch' && inputs.smoke_only) }}
runs-on: ubuntu-24.04
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Skip unchanged scope
if: ${{ needs.changes.outputs.flatpak != 'true' }}
run: echo "No Flatpak-relevant changes detected; skipping Flatpak build."
- name: Require Flatpak build
if: ${{ needs.changes.outputs.flatpak == 'true' && needs['flatpak-build'].result != 'success' }}
run: exit 1
- name: Confirm Flatpak build
if: ${{ needs.changes.outputs.flatpak == 'true' && needs['flatpak-build'].result == 'success' }}
run: echo "Flatpak build passed."
flatpak-runtime-smoke:
needs: changes
if: ${{ github.event_name == 'workflow_dispatch' && inputs.flatpak_runtime_smoke }}
runs-on: ubuntu-24.04
timeout-minutes: 90
continue-on-error: true
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Check out repository
uses: actions/checkout@v6
- name: Install Flatpak and PipeWire test dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
dbus-user-session \
flatpak \
jq \
pipewire \
pipewire-bin \
wireplumber
- name: Build and run experimental Flatpak runtime smoke
env:
MINI_EQ_FLATPAK_BUILD: ${{ inputs.flatpak_runtime_build && '1' || '0' }}
MINI_EQ_FLATPAK_INSTALL_REMOTE: ${{ inputs.flatpak_runtime_install_remote && '1' || '0' }}
MINI_EQ_FLATPAK_APP_REF: ${{ inputs.flatpak_runtime_app_ref }}
MINI_EQ_FLATPAK_INSTALL_REF: ${{ inputs.flatpak_runtime_install_ref }}
MINI_EQ_FLATPAK_EXPECT_VERSION: ${{ inputs.flatpak_runtime_expected_version }}
run: tools/run_flatpak_runtime_smoke_ci.sh
headless-pipewire-runtime-smoke:
needs: changes
if: ${{ github.event_name == 'workflow_dispatch' && inputs.headless_pipewire_runtime_smoke }}
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Check out repository
uses: actions/checkout@v6
- name: Install headless PipeWire runtime dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
dbus-user-session \
gobject-introspection \
libebur128-1 \
libgirepository1.0-dev \
libglib2.0-dev \
libpipewire-0.3-dev \
libspa-0.2-modules \
meson \
ninja-build \
pipewire \
pipewire-bin \
pkg-config \
python3 \
python3-dev \
python3-gi \
python3-numpy \
python3-pip \
python3-setuptools \
python3-venv \
wireplumber
- name: Build source environment and run headless PipeWire smoke
run: tools/run_headless_pipewire_runtime_smoke_ci.sh
live-ui-runtime-smoke:
needs: changes
if: ${{ github.event_name == 'workflow_dispatch' && inputs.live_ui_runtime_smoke }}
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- name: Require change detection
if: ${{ needs.changes.result != 'success' }}
run: exit 1
- name: Check out repository
uses: actions/checkout@v6
- name: Install live UI runtime dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
appstream \
at-spi2-core \
build-essential \
dbus-user-session \
desktop-file-utils \
gir1.2-adw-1 \
gir1.2-gtk-4.0 \
git \
gnome-shell \
gobject-introspection \
libebur128-1 \
libgirepository1.0-dev \
libglib2.0-dev \
libpipewire-0.3-dev \
libspa-0.2-modules \
meson \
ninja-build \
pipewire \
pipewire-bin \
pkg-config \
python3 \
python3-cairo \
python3-dev \
python3-gi \
python3-numpy \
python3-pip \
python3-pyatspi \
python3-setuptools \
python3-venv \
patchelf \
wireplumber
- name: Build source environment and run live UI smoke
run: tools/run_live_ui_runtime_smoke_ci.sh