Make Playwright cache runner-agnostic
Replace hardcoded /opt/playwright-tools mount with a persistent Docker volume cache and install Chromium into that cache before E2E jobs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -75,12 +75,22 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_IMAGE: nohype-ci-e2e:${{ github.run_id }}
|
||||
PLAYWRIGHT_CACHE_VOLUME: nohype-playwright-browsers
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: docker build -t "$CI_IMAGE" .
|
||||
|
||||
- name: Ensure Playwright Chromium cache
|
||||
run: |
|
||||
docker volume create "$PLAYWRIGHT_CACHE_VOLUME" >/dev/null
|
||||
docker run --rm \
|
||||
-v "$PLAYWRIGHT_CACHE_VOLUME:/ms-playwright" \
|
||||
-e PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
||||
"$CI_IMAGE" \
|
||||
python -m playwright install chromium
|
||||
|
||||
- name: Start PostgreSQL
|
||||
run: |
|
||||
docker run -d --name pr-e2e-postgres \
|
||||
@@ -100,14 +110,14 @@ jobs:
|
||||
- name: Start app with seeded content
|
||||
run: |
|
||||
docker run -d --name pr-e2e-app --network container:pr-e2e-postgres \
|
||||
-v /opt/playwright-tools/browsers:/opt/playwright-tools/browsers:ro \
|
||||
-v "$PLAYWRIGHT_CACHE_VOLUME:/ms-playwright:ro" \
|
||||
-e SECRET_KEY=ci-secret-key \
|
||||
-e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype \
|
||||
-e CONSENT_POLICY_VERSION=1 \
|
||||
-e EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend \
|
||||
-e DEFAULT_FROM_EMAIL=hello@nohypeai.com \
|
||||
-e NEWSLETTER_PROVIDER=buttondown \
|
||||
-e PLAYWRIGHT_BROWSERS_PATH=/opt/playwright-tools/browsers \
|
||||
-e PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
||||
"$CI_IMAGE" \
|
||||
sh -lc "python manage.py migrate --noinput && python manage.py seed_e2e_content && python manage.py runserver 0.0.0.0:8000"
|
||||
for i in $(seq 1 40); do
|
||||
@@ -139,10 +149,19 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_IMAGE: nohype-ci-nightly:${{ github.run_id }}
|
||||
PLAYWRIGHT_CACHE_VOLUME: nohype-playwright-browsers
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: docker build -t "$CI_IMAGE" .
|
||||
- name: Ensure Playwright Chromium cache
|
||||
run: |
|
||||
docker volume create "$PLAYWRIGHT_CACHE_VOLUME" >/dev/null
|
||||
docker run --rm \
|
||||
-v "$PLAYWRIGHT_CACHE_VOLUME:/ms-playwright" \
|
||||
-e PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
||||
"$CI_IMAGE" \
|
||||
python -m playwright install chromium
|
||||
- name: Start PostgreSQL
|
||||
run: |
|
||||
docker run -d --name nightly-postgres \
|
||||
@@ -161,14 +180,14 @@ jobs:
|
||||
- name: Start dev server with seeded content
|
||||
run: |
|
||||
docker run -d --name nightly-e2e --network container:nightly-postgres \
|
||||
-v /opt/playwright-tools/browsers:/opt/playwright-tools/browsers:ro \
|
||||
-v "$PLAYWRIGHT_CACHE_VOLUME:/ms-playwright:ro" \
|
||||
-e SECRET_KEY=ci-secret-key \
|
||||
-e DATABASE_URL=postgres://nohype:nohype@127.0.0.1:5432/nohype \
|
||||
-e CONSENT_POLICY_VERSION=1 \
|
||||
-e EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend \
|
||||
-e DEFAULT_FROM_EMAIL=hello@nohypeai.com \
|
||||
-e NEWSLETTER_PROVIDER=buttondown \
|
||||
-e PLAYWRIGHT_BROWSERS_PATH=/opt/playwright-tools/browsers \
|
||||
-e PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
|
||||
"$CI_IMAGE" \
|
||||
sh -lc "python manage.py migrate --noinput && python manage.py seed_e2e_content && python manage.py runserver 0.0.0.0:8000"
|
||||
for i in $(seq 1 40); do
|
||||
|
||||
Reference in New Issue
Block a user