Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/actions/prep-apt/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Install Playwright system dependencies
description: >
Stops background apt services, waits for dpkg/apt locks to clear, then
installs Playwright system dependencies with retry logic. Intended for
self-hosted Linux runners where unattended-upgrades can cause intermittent
apt lock contention or mirror-sync failures.

runs:
using: composite
steps:
- name: Stop background apt services
shell: bash
run: |
sudo systemctl stop unattended-upgrades apt-daily.service apt-daily-upgrade.service 2>/dev/null || true
echo "Waiting for apt locks to clear..."
timeout 120 bash -c '
while sudo fuser /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend \
/var/lib/apt/lists/lock /var/cache/apt/archives/lock \
2>/dev/null; do
echo " apt lock held, retrying in 5s..."
sleep 5
done
' || {
echo "Lock wait timed out — force-killing lock holders"
sudo fuser -k /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend \
/var/lib/apt/lists/lock /var/cache/apt/archives/lock 2>/dev/null || true
sudo dpkg --configure -a 2>/dev/null || true
}

- name: Install Playwright system dependencies (with retry)
shell: bash
run: |
for attempt in 1 2 3; do
echo "Attempt $attempt: npx playwright install-deps"
npx playwright install-deps && break
if [ $attempt -lt 3 ]; then
echo "Failed, retrying in 15s..."
sleep 15
else
echo "All attempts failed"
exit 1
fi
done
8 changes: 6 additions & 2 deletions .github/workflows/run-nala-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ jobs:
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
continue-on-error: true
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/playwright.config.js') }}

- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Install Playwright system dependencies
uses: ./.github/actions/prep-apt

- name: Install Playwright browsers
run: npx playwright install

- name: Set execute permission for gh.run.sh
run: chmod +x ./nala/utils/gh.run.sh
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/run-nala-milolibs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ jobs:
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
continue-on-error: true
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/playwright.config.js') }}

- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Install Playwright system dependencies
uses: ./.github/actions/prep-apt

- name: Install Playwright browsers
run: npx playwright install

- name: Set environment variables
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-nala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/playwright.config.js') }}

- name: Install Playwright system dependencies
run: npx playwright install-deps
uses: ./.github/actions/prep-apt

- name: Install/verify Playwright browsers
run: |
Expand Down Expand Up @@ -162,6 +162,8 @@ jobs:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/playwright.config.js') }}

# Docs tests run on GitHub-hosted runners (ubuntu-latest) — no unattended-upgrades
# lock contention, so the prep-apt composite action is not needed here.
- name: Install Playwright system dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install-deps
Expand Down
Loading