-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (204 loc) · 9.39 KB
/
Copy pathinterface-tests.yml
File metadata and controls
223 lines (204 loc) · 9.39 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
name: Interface Tests
on:
push:
branches: [main]
pull_request:
schedule:
# Nightly drift check at 05:30 UTC — 1.5h after upstream-sync rebases
# the forks at 04:00 UTC. The GUI smoke suite against fresh upstream
# catches Gtk/at-spi/accessibility-tree regressions before a human PR
# lands on them. Staggered 30min after unit-tests.yml to smooth load.
- cron: '30 5 * * *'
workflow_dispatch:
inputs:
gramps_repo:
description: 'gramps repo (owner/name); empty = same-owner fork'
default: ''
gramps_ref:
description: 'gramps branch/tag/sha; empty = matrix defaults'
default: ''
addons_source_repo:
description: 'addons-source repo (owner/name); empty = same-owner fork'
default: ''
addons_ref:
description: 'addons-source branch/tag/sha'
default: 'maintenance/gramps61'
addon_name:
description: 'Single addon to build (empty = all)'
default: ''
# dorny/test-reporter publishes a check run per matrix cell and annotates
# the PR. GITHUB_TOKEN defaults to restrictive here, so grant the
# specific scopes it needs — contents: read for checkout, checks: write
# for the published check run, pull-requests: write for annotations.
permissions:
contents: read
checks: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
interface-tests:
name: '[testbed] Interface Tests (${{ matrix.gramps_ref }})'
runs-on: ubuntu-24.04
timeout-minutes: 30
# Blocking gate. The interface smoke suite is the testbed's primary
# reason to exist (see CLAUDE.md: "Get tests/interface/test_smoke.py
# passing locally and in CI before adding any other tests") — any
# failure must stop a merge. No continue-on-error here, by design.
strategy:
fail-fast: false
matrix:
# Supported Gramps minors. Add new maintenance branches here when
# they exist upstream (e.g. - maintenance/gramps60) — each entry
# produces a parallel job. Kept in sync with unit-tests.yml.
gramps_ref:
- maintenance/gramps61
steps:
- name: Checkout testbed
uses: actions/checkout@v4
with:
path: gramps-testbed
# Repo resolution (in order): workflow input → repository variable
# → same-owner fork (auto-derived from this testbed's owner, so
# forking the testbed to you/gramps-testbed just works if you also
# have you/gramps and you/addons-source). Ref resolution: workflow
# input → matrix cell.
- name: Checkout gramps fork
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.gramps_repo || vars.GRAMPS_REPO || format('{0}/gramps', github.repository_owner) }}
ref: ${{ github.event.inputs.gramps_ref || matrix.gramps_ref }}
path: gramps
- name: Checkout addons-source fork
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.addons_source_repo || vars.ADDONS_SOURCE_REPO || format('{0}/addons-source', github.repository_owner) }}
ref: ${{ github.event.inputs.addons_ref || vars.ADDONS_SOURCE_REF || 'maintenance/gramps61' }}
path: addons-source
- name: Checkout addons (upstream, publish target for make.py)
uses: actions/checkout@v4
with:
repository: gramps-project/addons
path: addons
- name: Install system dependencies
# python3-venv / python3-pip are installed here so the next step
# can build a venv that inherits python3-gi and python3-pyatspi
# from the system interpreter.
run: |
sudo apt-get update
# Base stack + addon system deps derived from the single-source map
# (agent-work/scripts/lib/addon_system_deps.py); gir1.2-gtk-3.0 is gramps' base.
sudo apt-get install -y --no-install-recommends \
python3 python3-venv python3-pip \
python3-gi python3-gi-cairo python3-cairo python3-pyatspi python3-icu \
gir1.2-gtk-3.0 \
libgirepository1.0-dev \
xvfb dbus-x11 at-spi2-core \
xdotool wmctrl \
gettext intltool \
librsvg2-common \
$(python3 gramps-testbed/agent-work/scripts/lib/addon_system_deps.py --platform ubuntu)
- name: Set up Python venv (inherits python3-gi / python3-pyatspi from apt)
# Ubuntu 24.04's apt python3-gi and python3-pyatspi install into
# the system Python's dist-packages only; a fresh interpreter from
# setup-python@v5 can't see those bindings, and gramps.gen imports
# gi on module load — so every gramps-touching command dies with
# ModuleNotFoundError. dogtail (GUI driver) also requires pyatspi
# at the same interpreter. --system-site-packages keeps pip
# installs in the venv but inherits apt-provided bindings.
# Replaces actions/setup-python@v5; pip cache is restored below
# via actions/cache.
uses: ./gramps-testbed/.github/actions/setup-gramps-venv
- name: Restore pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('gramps-testbed/requirements-test.txt') }}
restore-keys: |
pip-${{ runner.os }}-
- name: Install Python dependencies
run: |
pip install -r gramps-testbed/requirements-test.txt
pip install -e 'gramps[testing]'
- name: Compile Gramps translations
# pip install -e skips setup.py build, so Gramps' build/mo dir is
# empty. The composite action compiles .po → .mo directly so launched
# Gramps finds its translations instead of falling back with a warning.
uses: ./gramps-testbed/.github/actions/compile-gramps-mo
with:
gramps-path: gramps
# Bulk addon install is intentionally skipped for the smoke suite:
# make.py mutates tracked .gpr.py files, and installing all 149 addons
# blocks Gramps GUI startup during plugin registration. Individual
# addons that have dedicated interface tests are copied straight into
# USER_PLUGINS below — no make.py invocation, no mutation of
# addons-source. Keep this list as tight as the tests require; every
# entry adds startup cost. Kept in sync with the equivalent block in
# agent-work/scripts/ubuntu/run-interface.sh.
- name: Install per-test addons
run: |
USER_PLUGINS="$(python -c 'from gramps.gen.const import USER_PLUGINS; print(USER_PLUGINS)')"
mkdir -p "$USER_PLUGINS"
for addon in QuiltView CombinedView; do
src="addons-source/$addon"
if [ -d "$src" ]; then
rm -rf "$USER_PLUGINS/$addon"
cp -a "$src" "$USER_PLUGINS/$addon"
echo "→ installed addon: $addon"
else
echo "WARN: addon source not found: $src (skipping install)"
fi
done
- name: Seed example databases
run: |
gramps -C TestTree -i gramps/example/gramps/example.gramps
gramps -C QuiltViewTree \
-i gramps-testbed/tests/interface/data/quiltview_minimal.gramps
gramps -C Bug14100Tree \
-i gramps-testbed/tests/interface/data/bug_0014100_minimal.gramps
- name: Run interface tests
working-directory: gramps-testbed
env:
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts
run: |
mkdir -p test-results "$ARTIFACTS_DIR/screenshots"
xvfb-run -a --server-args="-screen 0 1920x1080x24" \
dbus-run-session -- bash -c '
gsettings set org.gnome.desktop.interface toolkit-accessibility true
/usr/libexec/at-spi-bus-launcher --launch-immediately &
sleep 2
python -m xmlrunner discover \
-s tests -p "test_*.py" \
-o test-results/ \
-v
'
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
# Matrix-scoped artifact name so parallel cells don't collide.
name: test-results-${{ strategy.job-index }}
path: |
gramps-testbed/test-results/
artifacts/
- name: Publish test report
if: always()
uses: dorny/test-reporter@v1
with:
# working-directory is mandatory here: none of our checkouts
# land at the workflow root (all use `path:` subdirs), so
# dorny's internal `git ls-files` fails with "not a git
# repository" unless we point it at a checkout. The testbed
# itself is the natural anchor; path is resolved relative to
# it, so the glob drops its `gramps-testbed/` prefix.
working-directory: gramps-testbed
name: '[testbed] Interface Tests (${{ matrix.gramps_ref }})'
path: test-results/*.xml
reporter: java-junit
# Publish the report without failing THIS step when tests fail.
# The test outcome already shows in the job conclusion (the
# test-run step's exit code); dorny's default fail-on-error: true
# turned every upstream/addon test failure into a second,
# confusing red on the *reporting* step. Reporting is not gating.
fail-on-error: false