From dc169588041c98d303fd1ab51a398ec04feb858c Mon Sep 17 00:00:00 2001 From: Lectom Date: Thu, 28 May 2026 17:04:41 +0900 Subject: [PATCH] ci(userfront-e2e): add chromium fast lane --- .gitea/workflows/code_check.yml | 34 ++++++++++++++++--- ...code_check_playwright_cache_policy_test.sh | 12 +++++++ 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/code_check.yml b/.gitea/workflows/code_check.yml index 730767d9..315a20aa 100644 --- a/.gitea/workflows/code_check.yml +++ b/.gitea/workflows/code_check.yml @@ -29,6 +29,11 @@ on: required: true type: boolean default: true + run_userfront_e2e_full: + description: "Run full userfront E2E browser matrix instead of Chromium fast lane" + required: true + type: boolean + default: false run_adminfront_tests: description: "Run adminfront Playwright tests" required: true @@ -317,6 +322,8 @@ jobs: if: ${{ always() && (github.event_name != 'workflow_dispatch' || inputs.run_userfront_e2e_tests == true) }} runs-on: ubuntu-latest timeout-minutes: 40 + env: + USERFRONT_E2E_FULL: ${{ github.event_name == 'workflow_dispatch' && inputs.run_userfront_e2e_full == true }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -420,7 +427,13 @@ jobs: run: | set +e cd userfront-e2e - npx playwright install --with-deps 2>&1 | tee ../reports/userfront-e2e-provision.log + if [ "$USERFRONT_E2E_FULL" = "true" ]; then + provision_command="npx playwright install --with-deps" + else + provision_command="npx playwright install --with-deps chromium" + fi + echo "[userfront-e2e] $provision_command" | tee ../reports/userfront-e2e-provision.log + $provision_command 2>&1 | tee -a ../reports/userfront-e2e-provision.log provision_exit_code=${PIPESTATUS[0]} cd .. set -e @@ -435,7 +448,7 @@ jobs: echo "- Exit Code: \`$provision_exit_code\`" echo echo "## Command" - echo "\`cd userfront-e2e && npx playwright install --with-deps\`" + echo "\`cd userfront-e2e && $provision_command\`" echo echo "## Provision Log Tail (last 200 lines)" echo '```text' @@ -450,7 +463,13 @@ jobs: mkdir -p reports set +e cd userfront-e2e - npm test 2>&1 | tee ../reports/userfront-e2e-test.log + if [ "$USERFRONT_E2E_FULL" = "true" ]; then + test_command="npm test" + else + test_command="npm test -- --project=chromium-desktop --project=chromium-mobile-webapp" + fi + echo "[userfront-e2e] $test_command" | tee ../reports/userfront-e2e-test.log + $test_command 2>&1 | tee -a ../reports/userfront-e2e-test.log test_exit_code=${PIPESTATUS[0]} cd .. set -e @@ -467,8 +486,13 @@ jobs: echo "1. \`cd userfront-e2e\`" echo "2. \`npm ci\`" echo "3. \`cd ../userfront && flutter build web --wasm --release\`" - echo "4. \`cd ../userfront-e2e && npx playwright install --with-deps\`" - echo "5. \`npm test\`" + if [ "$USERFRONT_E2E_FULL" = "true" ]; then + echo "4. \`cd ../userfront-e2e && npx playwright install --with-deps\`" + echo "5. \`npm test\`" + else + echo "4. \`cd ../userfront-e2e && npx playwright install --with-deps chromium\`" + echo "5. \`npm test -- --project=chromium-desktop --project=chromium-mobile-webapp\`" + fi echo echo "## Log Tail (last 200 lines)" echo '```text' diff --git a/test/code_check_playwright_cache_policy_test.sh b/test/code_check_playwright_cache_policy_test.sh index 433cacf4..a91bae61 100644 --- a/test/code_check_playwright_cache_policy_test.sh +++ b/test/code_check_playwright_cache_policy_test.sh @@ -20,4 +20,16 @@ if grep -Fq -- "pnpm list -C ../common @playwright/test" "$WORKFLOW_FILE"; then fail "Code Check workflow must not call pnpm list before pnpm install" fi +grep -Fq -- "run_userfront_e2e_full:" "$WORKFLOW_FILE" || \ + fail "Code Check workflow must expose a manual full userfront-e2e switch" + +grep -Fq -- "USERFRONT_E2E_FULL:" "$WORKFLOW_FILE" || \ + fail "Code Check workflow must map the full userfront-e2e input into the job environment" + +grep -Fq -- "npx playwright install --with-deps chromium" "$WORKFLOW_FILE" || \ + fail "Userfront E2E fast lane must provision Chromium only" + +grep -Fq -- "npm test -- --project=chromium-desktop --project=chromium-mobile-webapp" "$WORKFLOW_FILE" || \ + fail "Userfront E2E fast lane must run only Chromium desktop and mobile projects" + echo "OK: Code Check Playwright cache keys do not depend on preinstalled node_modules"