From eb697e560ab9ea08947363b3d4d832d0d384972c Mon Sep 17 00:00:00 2001 From: chan Date: Fri, 15 May 2026 13:36:37 +0900 Subject: [PATCH] fix(ci): use pnpm instead of npm to extract playwright version for caching --- .gitea/workflows/code_check.yml | 8 ++++---- scripts/run_adminfront_ci_tests.sh | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/code_check.yml b/.gitea/workflows/code_check.yml index 972a0e7e..0af06179 100644 --- a/.gitea/workflows/code_check.yml +++ b/.gitea/workflows/code_check.yml @@ -335,7 +335,7 @@ jobs: id: playwright-version run: | cd userfront-e2e - echo "version=$(npm list @playwright/test | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" + echo "version=$(pnpm list -C ../common @playwright/test --depth 0 | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" - name: Cache Playwright Browsers uses: actions/cache@v4 @@ -564,7 +564,7 @@ jobs: id: playwright-version run: | cd adminfront - echo "version=$(npm list @playwright/test | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" + echo "version=$(pnpm list -C ../common @playwright/test --depth 0 | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" - name: Cache Playwright Browsers uses: actions/cache@v4 @@ -657,7 +657,7 @@ jobs: id: playwright-version run: | cd devfront - echo "version=$(npm list @playwright/test | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" + echo "version=$(pnpm list -C ../common @playwright/test --depth 0 | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" - name: Cache Playwright Browsers uses: actions/cache@v4 @@ -839,7 +839,7 @@ jobs: id: playwright-version run: | cd orgfront - echo "version=$(npm list @playwright/test | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" + echo "version=$(pnpm list -C ../common @playwright/test --depth 0 | grep @playwright/test | awk -F@ '{print $NF}')" >> "$GITHUB_OUTPUT" - name: Cache Playwright Browsers uses: actions/cache@v4 diff --git a/scripts/run_adminfront_ci_tests.sh b/scripts/run_adminfront_ci_tests.sh index f0eef368..077dbf75 100755 --- a/scripts/run_adminfront_ci_tests.sh +++ b/scripts/run_adminfront_ci_tests.sh @@ -61,8 +61,8 @@ find_available_port() { ' } -playwright_install_cmd=(npx playwright install) -playwright_install_desc="npx playwright install" +playwright_install_cmd=(pnpm exec playwright install) +playwright_install_desc="pnpm exec playwright install" playwright_project_args=() has_webkit_host_dependencies() { @@ -112,21 +112,21 @@ has_webkit_host_dependencies() { } if [ "$(id -u)" -eq 0 ]; then - playwright_install_cmd=(npx playwright install --with-deps) - playwright_install_desc="npx playwright install --with-deps" + playwright_install_cmd=(pnpm exec playwright install --with-deps) + playwright_install_desc="pnpm exec playwright install --with-deps" elif command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then - playwright_install_cmd=(npx playwright install --with-deps) - playwright_install_desc="npx playwright install --with-deps" + playwright_install_cmd=(pnpm exec playwright install --with-deps) + playwright_install_desc="pnpm exec playwright install --with-deps" elif ! has_webkit_host_dependencies; then - playwright_install_cmd=(npx playwright install chromium firefox) - playwright_install_desc="npx playwright install chromium firefox" + playwright_install_cmd=(pnpm exec playwright install chromium firefox) + playwright_install_desc="pnpm exec playwright install chromium firefox" playwright_project_args=(--project=chromium --project=firefox) { echo "# Adminfront WebKit Skipped" echo echo "- Reason: WebKit host dependencies are not installed and this user cannot run passwordless sudo." echo "- Action: Running Chromium and Firefox projects only." - echo "- To enable WebKit locally: run \`cd adminfront && npx playwright install-deps webkit\` with sudo privileges." + echo "- To enable WebKit locally: run \`cd adminfront && pnpm exec playwright install-deps webkit\` with sudo privileges." } > reports/adminfront-webkit-skipped.md fi @@ -197,7 +197,7 @@ echo "==> adminfront using PORT=$port" ( cd "$tmp_dir/adminfront" PORT="$port" PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" \ - node ./node_modules/playwright/cli.js test "${playwright_project_args[@]}" + pnpm exec playwright test "${playwright_project_args[@]}" ) 2>&1 | tee reports/adminfront-test.log test_exit_code=${PIPESTATUS[0]} set -e @@ -217,7 +217,7 @@ if [ "$test_exit_code" -ne 0 ]; then echo "1. \`cd adminfront\`" echo "2. \`npm install -g pnpm && pnpm install -C ../common\`" echo "3. \`${playwright_install_desc}\`" - echo "4. \`node ./node_modules/playwright/cli.js test\`" + echo "4. \`pnpm exec playwright test\`" echo echo "## Log Tail (last 200 lines)" echo '```text'