diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 2b9bbfe891640..b813daad793e4 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -146,6 +146,7 @@ jobs: report: ${{ matrix.report || false }} gutenberg-artifact: gutenberg-build gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }} + wordpress-build-artifact: wordpress-build # # Creates a PHPUnit test job for each PHP/MariaDB combination. @@ -202,6 +203,7 @@ jobs: report: false gutenberg-artifact: gutenberg-build gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }} + wordpress-build-artifact: wordpress-build # # Creates PHPUnit test jobs to test MariaDB and MySQL innovation releases. @@ -252,6 +254,7 @@ jobs: report: false gutenberg-artifact: gutenberg-build gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }} + wordpress-build-artifact: wordpress-build # # Runs the HTML API test group. @@ -287,6 +290,7 @@ jobs: phpunit-test-groups: ${{ matrix.phpunit-test-groups }} gutenberg-artifact: gutenberg-build gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }} + wordpress-build-artifact: wordpress-build # # Runs unit tests for forks. @@ -352,6 +356,7 @@ jobs: phpunit-test-groups: ${{ matrix.phpunit-test-groups || '' }} gutenberg-artifact: gutenberg-build gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }} + wordpress-build-artifact: wordpress-build slack-notifications: name: Slack Notifications diff --git a/.github/workflows/reusable-phpunit-tests-v3.yml b/.github/workflows/reusable-phpunit-tests-v3.yml index 4ce4e65b0ba12..340adc3d8b384 100644 --- a/.github/workflows/reusable-phpunit-tests-v3.yml +++ b/.github/workflows/reusable-phpunit-tests-v3.yml @@ -82,6 +82,11 @@ on: required: false type: string default: '' + wordpress-build-artifact: + description: 'The name of a same-workflow artifact containing the pre-built WordPress assets. Optional: callers that omit it build per job.' + required: false + type: string + default: '' secrets: CODECOV_TOKEN: description: 'The Codecov token required for uploading reports.' @@ -186,7 +191,21 @@ jobs: - name: Install npm dependencies run: npm ci + - name: Download WordPress build + if: inputs.wordpress-build-artifact != '' + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ inputs.wordpress-build-artifact }} + path: /tmp/wordpress-build + digest-mismatch: error + + - name: Apply WordPress build + if: inputs.wordpress-build-artifact != '' + run: | + tar -xzf /tmp/wordpress-build/wordpress-build.tar.gz + - name: Build WordPress + if: inputs.wordpress-build-artifact == '' run: npm run build:dev env: # The producer resolved this once. Matrix jobs must not re-resolve mutable GHCR tags. diff --git a/.github/workflows/reusable-prepare-gutenberg.yml b/.github/workflows/reusable-prepare-gutenberg.yml index c5e1f904a9680..4a05e6a77a824 100644 --- a/.github/workflows/reusable-prepare-gutenberg.yml +++ b/.github/workflows/reusable-prepare-gutenberg.yml @@ -38,6 +38,7 @@ jobs: uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version-file: '.nvmrc' + cache: npm - name: Download and verify Gutenberg build id: download @@ -58,3 +59,29 @@ jobs: if-no-files-found: error include-hidden-files: true retention-days: 1 + + - name: Install npm dependencies + run: npm ci + env: + PUPPETEER_SKIP_DOWNLOAD: true + + - name: Build WordPress + run: npm run build:dev + env: + GUTENBERG_EXPECTED_SHA: ${{ steps.download.outputs.gutenberg-sha }} + + - name: Package WordPress build + run: | + { git diff --name-only HEAD; git ls-files --others --exclude="/gutenberg/*" --exclude="/vendor/*" --exclude="/node_modules/*"; } \ + > /tmp/build-manifest.txt + echo "Files included in build artifact:" + cat /tmp/build-manifest.txt + tar -czf wordpress-build.tar.gz --files-from=/tmp/build-manifest.txt + + - name: Upload WordPress build + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wordpress-build + path: wordpress-build.tar.gz + if-no-files-found: error + retention-days: 1 diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index ffc650ec370fb..d83d4ce3bf13a 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -78,6 +78,7 @@ jobs: coverage-report: ${{ matrix.coverage-report }} gutenberg-artifact: gutenberg-build gutenberg-sha: ${{ needs.prepare-gutenberg.outputs.gutenberg-sha }} + wordpress-build-artifact: wordpress-build secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}