Skip to content

Commit 30dd315

Browse files
Play only the modified tutorials on pull requests
On pull requests, diff against the base branch and play only the tutorials whose json changed — all of them when the test harness itself changed, none when the changes concern neither. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 1a41463 commit 30dd315

2 files changed

Lines changed: 39 additions & 8 deletions

File tree

‎.github/workflows/test-in-app-tutorials.yml‎

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
# tutorial being played is uploaded as an artifact, for passing and failing
44
# runs alike.
55
#
6-
# Runs on every push (a tutorial change should not break the tutorials) and
7-
# every 6 hours (a change in GDevelop master should not either). The schedule
8-
# only runs from the default branch (main).
6+
# Runs on every push to main (a tutorial change should not break the
7+
# tutorials) and every 6 hours (a change in GDevelop master should not
8+
# either). The schedule only runs from the default branch (main).
9+
# On pull requests, only the modified tutorials are played (all of them if the
10+
# test harness itself was modified).
911
name: Test in-app tutorials
1012

1113
on:
1214
push:
1315
branches: [main, automatic-tests]
16+
pull_request:
1417
schedule:
1518
# Every 6 hours: GDevelop pushes do not trigger this workflow, the
1619
# schedule catches editor changes that break tutorials.
@@ -31,6 +34,9 @@ jobs:
3134
steps:
3235
- name: Checkout tutorials
3336
uses: actions/checkout@v4
37+
with:
38+
# Full history, to diff against the base branch on pull requests.
39+
fetch-depth: 0
3440

3541
- name: Checkout GDevelop
3642
uses: actions/checkout@v4
@@ -65,16 +71,39 @@ jobs:
6571
- name: Install Playwright browser
6672
run: npx playwright install --with-deps chromium
6773

68-
# Starts the editor dev server (from ./GDevelop) and plays every
69-
# tutorial. Known broken tutorials are expected to fail.
70-
- name: Play all in-app tutorials
74+
# On pull requests, only play the tutorials whose json was modified —
75+
# or all of them if the test harness itself was modified, and none if
76+
# the changes concern neither.
77+
- name: Determine which tutorials to play
78+
id: scope
79+
if: github.event_name == 'pull_request'
80+
run: |
81+
changed=$(git diff --name-only "origin/$GITHUB_BASE_REF"...HEAD)
82+
echo "Changed files:"; echo "$changed"
83+
ids=$(echo "$changed" | grep -E '^tutorials/in-app/[^/]+\.json$' | xargs -rn1 basename | sed 's/\.json$//' | paste -sd, -)
84+
if [ -n "$ids" ]; then
85+
echo "ids=$ids" >> "$GITHUB_OUTPUT"
86+
echo "mode=modified-tutorials" >> "$GITHUB_OUTPUT"
87+
elif echo "$changed" | grep -qE '^(e2e/|scripts/|package(-lock)?\.json|\.github/workflows/)'; then
88+
echo "mode=all" >> "$GITHUB_OUTPUT"
89+
else
90+
echo "mode=none" >> "$GITHUB_OUTPUT"
91+
fi
92+
93+
# Starts the editor dev server (from ./GDevelop) and plays the
94+
# tutorials. Known broken tutorials are expected to fail.
95+
- name: Play in-app tutorials
96+
if: steps.scope.outputs.mode != 'none'
97+
env:
98+
TUTORIAL_IDS: ${{ steps.scope.outputs.ids }}
7199
run: npm run test-in-app-tutorials -- --project=${{ matrix.project }}
72100

73101
# Playwright records webm, which does not play natively on macOS:
74102
# convert to mp4 (H.264) so the videos open with QuickTime/Quick Look.
75103
- name: Convert videos to mp4
76104
if: always()
77105
run: |
106+
[ -d test-results ] || exit 0
78107
sudo apt-get update -qq && sudo apt-get install -y -qq ffmpeg
79108
find test-results -name "*.webm" -print0 | while IFS= read -r -d '' file; do
80109
ffmpeg -nostdin -y -loglevel error -i "$file" -c:v libx264 -preset veryfast -crf 28 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -movflags +faststart "${file%.webm}.mp4" && rm "$file"

‎e2e/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ referencing elements that no longer exist in the editor, without running it.
2929

3030
The `.github/workflows/test-in-app-tutorials.yml` workflow runs the static
3131
selector check and plays every tutorial against GDevelop `master`, on each
32-
push and every 6 hours (the schedule catches GDevelop changes that break
33-
tutorials, since GDevelop pushes do not trigger this workflow).
32+
push to `main` and every 6 hours (the schedule catches GDevelop changes that
33+
break tutorials, since GDevelop pushes do not trigger this workflow). On pull
34+
requests, only the modified tutorials are played (all of them if the test
35+
harness itself was modified).
3436
The tutorials are played on the three editor layouts in parallel jobs —
3537
desktop (1600×900), tablet (1024×768) and mobile (844×390 landscape), matching
3638
the editor's responsive thresholds. A video of each tutorial being played

0 commit comments

Comments
 (0)