File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ realtime_pid=''
3333realtime_tag=' '
3434realtime_log=' '
3535browsers_pid=' '
36+ browsers_started=0
3637local_app_url=' '
3738extra_pids=()
3839extra_tags=()
@@ -85,6 +86,7 @@ start_browser_install() {
8586 local name=$1
8687 shift
8788 browsers_log=" $report_dir /$name -playwright-install.log"
89+ browsers_started=$SECONDS
8890 setsid --wait bash " $GITHUB_WORKSPACE /.github/scripts/install-playwright.sh" " $@ " > " $browsers_log " 2>&1 &
8991 browsers_pid=$!
9092}
@@ -97,6 +99,8 @@ wait_for_browsers() {
9799 exit 1
98100 fi
99101 browsers_pid=' '
102+ echo " Browsers installed $(( SECONDS - browsers_started)) s after the install started"
103+ grep -E ' ^(Installed system dependencies|Stored [0-9]+ packages)' " $browsers_log " || true
100104}
101105
102106# start_app <name> <port> <label> [record-http-status]
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22# The dependency dry run uses the pinned driver's package list without updating apt.
3+ #
4+ # PLAYWRIGHT_APT_CACHE names a directory of .deb files kept between runs (the workflow restores it
5+ # per runner image and browser set). With it, missing system libraries install from those files
6+ # without reaching an Ubuntu mirror, whose stalls have held a suite in this step for 16 minutes.
7+ # A cold or incomplete cache falls back to `install-deps`, then stores what apt downloaded.
38set -euo pipefail
49
510browsers=()
@@ -10,7 +15,24 @@ for argument in "$@"; do
1015 esac
1116done
1217
13- if ! bunx --no-install playwright install-deps --dry-run " ${browsers[@]} " ; then
14- bunx --no-install playwright install-deps " ${browsers[@]} "
18+ deps_present () {
19+ bunx --no-install playwright install-deps --dry-run " ${browsers[@]} " > /dev/null 2>&1
20+ }
21+
22+ cache=${PLAYWRIGHT_APT_CACHE:- }
23+ if ! deps_present; then
24+ if [ -n " $cache " ] && compgen -G " $cache /*.deb" > /dev/null &&
25+ sudo apt-get install -y --no-install-recommends " $cache " /* .deb && deps_present; then
26+ echo " Installed system dependencies from $cache "
27+ else
28+ bunx --no-install playwright install-deps " ${browsers[@]} "
29+ if [ -n " $cache " ] && compgen -G ' /var/cache/apt/archives/*.deb' > /dev/null; then
30+ mkdir -p " $cache "
31+ cp /var/cache/apt/archives/* .deb " $cache " /
32+ echo " Stored $( find " $cache " -name ' *.deb' | wc -l) packages in $cache "
33+ elif [ -n " $cache " ]; then
34+ echo " ::warning::apt kept no downloaded packages; nothing to cache for the next run."
35+ fi
36+ fi
1537fi
1638exec bunx --no-install playwright install " $@ "
Original file line number Diff line number Diff line change @@ -265,6 +265,18 @@ jobs:
265265 with :
266266 provider : github
267267
268+ # Browser system libraries, as downloaded .deb files, per runner image and group (each group
269+ # installs its own browsers); install-playwright.sh reads and fills it.
270+ - name : Read the runner image
271+ id : runner-image
272+ run : echo "version=$ImageOS-$ImageVersion" >> "$GITHUB_OUTPUT"
273+
274+ - name : Restore browser system packages
275+ uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
276+ with :
277+ path : ~/.cache/playwright-apt
278+ key : playwright-apt-${{ steps.runner-image.outputs.version }}-${{ hashFiles('bun.lock') }}-${{ matrix.group }}
279+
268280 # Migrations create their own extensions, as on a fresh self-hosted install.
269281 - name : Provision the database through migrations
270282 if : matrix.group != 'project-files'
@@ -317,7 +329,7 @@ jobs:
317329 - name : Run end-to-end suites
318330 timeout-minutes : 19
319331 working-directory : apps/sim
320- run : bash ../../.github/scripts/http-e2e.sh "${{ matrix.group }}"
332+ run : PLAYWRIGHT_APT_CACHE="$HOME/.cache/playwright-apt" bash ../../.github/scripts/http-e2e.sh "${{ matrix.group }}"
321333
322334 - name : Upload acceptance timing and coverage reports
323335 if : always()
You can’t perform that action at this time.
0 commit comments