Skip to content

Commit 5a9bb3a

Browse files
committed
Initial testbed scaffold: unittest-based GUI harness, CI workflows, Docker
1 parent bc4de45 commit 5a9bb3a

13 files changed

Lines changed: 597 additions & 204 deletions

File tree

.github/workflows/gui-tests.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: GUI Interface Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
inputs:
9+
gramps_ref:
10+
description: 'gramps fork branch/tag/sha'
11+
default: 'maintenance/gramps60'
12+
addons_ref:
13+
description: 'addons-source fork branch/tag/sha'
14+
default: 'maintenance/gramps60'
15+
addon_name:
16+
description: 'Single addon to build (empty = all)'
17+
default: ''
18+
19+
jobs:
20+
gui-tests:
21+
runs-on: ubuntu-24.04
22+
timeout-minutes: 30
23+
24+
steps:
25+
- name: Checkout testbed
26+
uses: actions/checkout@v4
27+
with:
28+
path: gramps-testbed
29+
30+
- name: Checkout gramps fork
31+
uses: actions/checkout@v4
32+
with:
33+
repository: eduralph/gramps
34+
ref: ${{ github.event.inputs.gramps_ref || 'maintenance/gramps60' }}
35+
path: gramps
36+
37+
- name: Checkout addons-source fork
38+
uses: actions/checkout@v4
39+
with:
40+
repository: eduralph/addons-source
41+
ref: ${{ github.event.inputs.addons_ref || 'maintenance/gramps60' }}
42+
path: addons-source
43+
44+
- name: Checkout addons (upstream, publish target for make.py)
45+
uses: actions/checkout@v4
46+
with:
47+
repository: gramps-project/addons
48+
path: addons
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.12'
54+
55+
- name: Install system dependencies
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y --no-install-recommends \
59+
python3-gi python3-gi-cairo python3-cairo \
60+
gir1.2-gtk-3.0 gir1.2-osmgpsmap-1.0 gir1.2-goocanvas-2.0 \
61+
libgirepository1.0-dev \
62+
xvfb dbus-x11 at-spi2-core \
63+
xdotool wmctrl \
64+
gettext intltool \
65+
librsvg2-common
66+
67+
- name: Install Python dependencies
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install -r gramps-testbed/requirements-test.txt
71+
pip install -e gramps
72+
73+
- name: Build addons
74+
working-directory: addons-source
75+
run: |
76+
if [ -n "${{ github.event.inputs.addon_name }}" ]; then
77+
python make.py gramps60 build "${{ github.event.inputs.addon_name }}"
78+
else
79+
python make.py gramps60 build all
80+
fi
81+
82+
- name: Install addons into user plugin directory
83+
working-directory: addons-source
84+
run: |
85+
mkdir -p ~/.gramps/gramps60/plugins
86+
for addon in */; do
87+
[ -f "$addon/${addon%/}.gpr.py" ] && cp -r "$addon" ~/.gramps/gramps60/plugins/
88+
done
89+
90+
- name: Seed example database
91+
run: |
92+
gramps -C TestTree -i gramps/example/gramps/example.gramps
93+
94+
- name: Run interface tests
95+
working-directory: gramps-testbed
96+
env:
97+
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts
98+
run: |
99+
mkdir -p test-results "$ARTIFACTS_DIR/screenshots"
100+
xvfb-run -a --server-args="-screen 0 1920x1080x24" \
101+
dbus-run-session -- bash -c '
102+
gsettings set org.gnome.desktop.interface toolkit-accessibility true
103+
/usr/libexec/at-spi-bus-launcher --launch-immediately &
104+
sleep 2
105+
python -m xmlrunner discover \
106+
-s tests/interface \
107+
-o test-results/ \
108+
-v
109+
'
110+
111+
- name: Upload test results
112+
if: always()
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: test-results
116+
path: |
117+
gramps-testbed/test-results/
118+
artifacts/
119+
120+
- name: Publish test report
121+
if: always()
122+
uses: dorny/test-reporter@v1
123+
with:
124+
name: Interface Tests
125+
path: gramps-testbed/test-results/*.xml
126+
reporter: java-junit

.github/workflows/unit-tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Unit Tests (upstream)
2+
3+
# Runs gramps' own unittest suite exactly as upstream maintainers would.
4+
# This is your "am I breaking gramps" gate, separate from the GUI tests.
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
workflow_dispatch:
11+
12+
jobs:
13+
unit-tests:
14+
runs-on: ubuntu-24.04
15+
timeout-minutes: 15
16+
17+
steps:
18+
- name: Checkout gramps fork
19+
uses: actions/checkout@v4
20+
with:
21+
repository: eduralph/gramps
22+
ref: maintenance/gramps60
23+
path: gramps
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
30+
- name: Install system dependencies
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y --no-install-recommends \
34+
python3-gi python3-gi-cairo python3-cairo \
35+
gir1.2-gtk-3.0 \
36+
libgirepository1.0-dev \
37+
gettext intltool
38+
39+
- name: Install gramps
40+
working-directory: gramps
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install -e .
44+
pip install unittest-xml-reporting
45+
46+
- name: Run unittest suite (upstream style)
47+
working-directory: gramps
48+
run: |
49+
mkdir -p test-results
50+
python -m xmlrunner discover -o test-results/ -v
51+
52+
- name: Publish test report
53+
if: always()
54+
uses: dorny/test-reporter@v1
55+
with:
56+
name: Unit Tests
57+
path: gramps/test-results/*.xml
58+
reporter: java-junit
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Sync Forks from Upstream
2+
3+
# Rebases your forks onto upstream so they stay fast-forward-mergeable.
4+
# Runs nightly and on demand. Uses a PAT in secrets.FORK_SYNC_TOKEN with
5+
# repo write access to eduralph/gramps and eduralph/addons-source.
6+
7+
on:
8+
schedule:
9+
- cron: '0 4 * * *' # 04:00 UTC daily
10+
workflow_dispatch:
11+
12+
jobs:
13+
sync:
14+
runs-on: ubuntu-24.04
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
repo:
19+
- name: gramps
20+
owner: eduralph
21+
- name: addons-source
22+
owner: eduralph
23+
branch:
24+
- master
25+
- maintenance/gramps60
26+
27+
steps:
28+
- name: Sync ${{ matrix.repo.name }}@${{ matrix.branch }}
29+
env:
30+
GH_TOKEN: ${{ secrets.FORK_SYNC_TOKEN }}
31+
run: |
32+
gh repo sync ${{ matrix.repo.owner }}/${{ matrix.repo.name }} \
33+
--source gramps-project/${{ matrix.repo.name }} \
34+
--branch ${{ matrix.branch }}

0 commit comments

Comments
 (0)