From 7e3baabde7b16a9a5d46f83601f663c4b9aac0d8 Mon Sep 17 00:00:00 2001 From: bfintal Date: Wed, 15 Jul 2026 09:33:20 +0800 Subject: [PATCH 1/2] ci: speed up Playwright workflow with shared build job Build the plugin once and reuse the artifact across matrix jobs. Add npm caching and use npx @wordpress/env instead of a global install. Co-authored-by: Cursor --- .github/workflows/playwright.yml | 47 ++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 3c8231586..696460040 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -5,7 +5,29 @@ on: pull_request: branches: [ master, develop ] jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + cache-dependency-path: package-lock.json + - name: Build Stackable Free Plugin + run: | + npm ci --legacy-peer-deps + npm run build:no-translate + - name: Archive plugin build + run: tar --exclude=./node_modules --exclude=./.git -czf stackable-playwright-build.tar.gz . + - uses: actions/upload-artifact@v4 + with: + name: stackable-playwright-build + path: stackable-playwright-build.tar.gz + retention-days: 1 + test: + needs: build timeout-minutes: 60 runs-on: ubuntu-latest strategy: @@ -28,6 +50,16 @@ jobs: - uses: actions/setup-node@v4 with: node-version: lts/* + cache: npm + cache-dependency-path: package-lock.json + - name: Restore plugin build + uses: actions/download-artifact@v4 + with: + name: stackable-playwright-build + - name: Extract plugin build + run: tar -xzf stackable-playwright-build.tar.gz + - name: Install dependencies + run: npm ci --legacy-peer-deps - name: Set the version suffix for the output run: echo VERSION_SUFFIX=${GITHUB_REF_NAME//\//-} >> $GITHUB_ENV - name: Set WP Version and create .wp-env.json @@ -52,10 +84,6 @@ jobs: }' > .wp-env.json cat .wp-env.json - - name: Build Stackable Free Plugin - run: | - npm ci --legacy-peer-deps - npm run build:no-translate - name: Cache Playwright Browsers uses: actions/cache@v4 with: @@ -72,22 +100,19 @@ jobs: sleep $((attempt * 30)) done exit 1 - - name: Install wp-env - run: | - npm install -g @wordpress/env - name: Start wp-env - run: wp-env start + run: npx @wordpress/env start - name: Print current WP version - run: wp-env run tests-cli wp core version + run: npx @wordpress/env run tests-cli wp core version - name: Create post with existing blocks run: | - POST_ID=$(wp-env run tests-cli wp post create wp-content/plugins/Stackable/e2e/config/post-content.txt --post_title="Existing Blocks" --post_status=publish --porcelain) + POST_ID=$(npx @wordpress/env run tests-cli wp post create wp-content/plugins/Stackable/e2e/config/post-content.txt --post_title="Existing Blocks" --post_status=publish --porcelain) echo "WP_TEST_POSTID=$POST_ID" >> $GITHUB_ENV continue-on-error: true - name: Disable guided tours run: | TOUR_STATES='["design-system", "editor", "design-library", "blocks"]' - wp-env run tests-cli wp option update stackable_guided_tour_states "$TOUR_STATES" --format=json + npx @wordpress/env run tests-cli wp option update stackable_guided_tour_states "$TOUR_STATES" --format=json - name: Run playwright tests id: run-playwright-tests env: From 06931232919508b7671e5f7eebfac36dcdf0531f Mon Sep 17 00:00:00 2001 From: bfintal Date: Wed, 15 Jul 2026 09:41:29 +0800 Subject: [PATCH 2/2] fix(ci): write Playwright build archive outside workspace Avoid tar failing with "file changed as we read it" when the archive is created inside the directory being packed. Co-authored-by: Cursor --- .github/workflows/playwright.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 696460040..1cc8390dc 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -19,11 +19,11 @@ jobs: npm ci --legacy-peer-deps npm run build:no-translate - name: Archive plugin build - run: tar --exclude=./node_modules --exclude=./.git -czf stackable-playwright-build.tar.gz . + run: tar --exclude=./node_modules --exclude=./.git -czf /tmp/stackable-playwright-build.tar.gz . - uses: actions/upload-artifact@v4 with: name: stackable-playwright-build - path: stackable-playwright-build.tar.gz + path: /tmp/stackable-playwright-build.tar.gz retention-days: 1 test: