From bdfade5d100eb5b9cd2645848e08313cdc3cfa1c Mon Sep 17 00:00:00 2001 From: Nathan Vasse Date: Wed, 8 Apr 2026 16:56:51 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(ci)=20prebuild=20drive=20fro?= =?UTF-8?q?ntend=20and=20serve=20via=20nginx=20for=20e2e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the per-shard \`yarn dev\` with a single static build job whose output is shared as an artifact and served by stock nginx using the production vhost. Cuts e2e startup cost and exercises the same bundle we ship. --- .github/workflows/drive-frontend.yml | 54 ++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/.github/workflows/drive-frontend.yml b/.github/workflows/drive-frontend.yml index 0ef26fc3..3784cd87 100644 --- a/.github/workflows/drive-frontend.yml +++ b/.github/workflows/drive-frontend.yml @@ -62,9 +62,44 @@ jobs: cd src/frontend/apps/drive yarn test + build-frontend-e2e: + runs-on: ubuntu-latest + needs: install-front + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22.x" + + - name: Restore the frontend cache + uses: actions/cache@v4 + with: + path: "src/frontend/**/node_modules" + key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} + fail-on-cache-miss: true + + - name: Build frontend (static export, .env.development) + run: | + cd src/frontend/apps/drive + set -a + . ./.env.development + set +a + yarn build + + - name: Upload frontend bundle + uses: actions/upload-artifact@v4 + with: + name: drive-frontend-out + path: src/frontend/apps/drive/out + retention-days: 1 + if-no-files-found: error + test-e2e: runs-on: ubuntu-latest - needs: [install-front, build-mails] + needs: [install-front, build-mails, build-frontend-e2e] strategy: fail-fast: false matrix: @@ -123,18 +158,31 @@ jobs: cd src/frontend/apps/e2e npx playwright install-deps ${{ matrix.browser }} + - name: Download frontend bundle + uses: actions/download-artifact@v4 + with: + name: drive-frontend-out + path: src/frontend/apps/drive/out + - name: Start Docker services run: | make bootstrap-e2e - - name: Start frontend + - name: Serve frontend (stock nginx + prod vhost) run: | - cd src/frontend && yarn dev & + docker run -d --rm --name drive-static -p 3000:3000 \ + -v "$PWD/src/frontend/apps/drive/out:/usr/share/nginx/html:ro" \ + -v "$PWD/src/frontend/apps/drive/conf/default.conf:/etc/nginx/conf.d/default.conf:ro" \ + nginx:1.25 - name: Wait for Keycloak to be ready run: | timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8083/)" != "302" ]]; do echo "Waiting for Keycloak..." && sleep 2; done' && echo "Keycloak is ready!" + - name: Wait for frontend to be ready + run: | + timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:3000/)" != "200" ]]; do echo "Waiting for frontend..." && sleep 1; done' && echo "Frontend is ready!" + - name: Run e2e tests run: | cd src/frontend/apps/e2e