From e2bc2a36d272ed64486d3407da23e5f57ce7538d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 11 Apr 2024 14:47:34 -0400 Subject: [PATCH 01/26] Make workflows callable. --- .github/workflows/coding-standards.yml | 116 +----------------------- .github/workflows/end-to-end-tests.yml | 99 +------------------- .github/workflows/javascript-tests.yml | 39 +------- .github/workflows/php-compatibility.yml | 67 +------------- .github/workflows/phpunit-tests.yml | 5 +- 5 files changed, 8 insertions(+), 318 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 0709194d35eab..db82eb9db3afb 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -46,132 +46,20 @@ permissions: {} jobs: # Runs PHP coding standards checks. - # - # Violations are reported inline with annotations. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up PHP. - # - Configures caching for PHPCS scans. - # - Installs Composer dependencies. - # - Make Composer packages available globally. - # - Runs PHPCS on the full codebase with warnings suppressed. - # - Generate a report for displaying issues as pull request annotations. - # - Runs PHPCS on the `tests` directory without warnings suppressed. - # - Generate a report for displaying `test` directory issues as pull request annotations. - # - Ensures version-controlled files are not modified or deleted. phpcs: name: PHP coding standards - runs-on: ubuntu-latest + uses: desrosj/wordpress-develop/.github/workflows/callable-coding-standards-php.yml@try/make-workflows-callable permissions: contents: read - timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up PHP - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2.25.4 - with: - php-version: 'latest' - coverage: none - tools: cs2pr - - # This date is used to ensure that the PHPCS cache is cleared at least once every week. - # http://man7.org/linux/man-pages/man1/date.1.html - - name: "Get last Monday's date" - id: get-date - run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT - - - name: Cache PHPCS scan cache - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: | - .cache/phpcs-src.json - .cache/phpcs-tests.json - key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 - with: - custom-cache-suffix: ${{ steps.get-date.outputs.date }} - - - name: Make Composer packages available globally - run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH - - - name: Run PHPCS on all Core files - id: phpcs-core - run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml - - - name: Show PHPCS results in PR - if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} - run: cs2pr ./.cache/phpcs-report.xml - - - name: Check test suite files for warnings - id: phpcs-tests - run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml - - - name: Show test suite scan results in PR - if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }} - run: cs2pr ./.cache/phpcs-tests-report.xml - - - name: Ensure version-controlled files are not modified during the tests - run: git diff --exit-code - # Runs the JavaScript coding standards checks. - # - # JSHint violations are not currently reported inline with annotations. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Run the WordPress JSHint checks. - # - Ensures version-controlled files are not modified or deleted. jshint: name: JavaScript coding standards - runs-on: ubuntu-latest + uses: desrosj/wordpress-develop/.github/workflows/callable-coding-standards-javascript.yml@try/make-workflows-callable permissions: contents: read - timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Run JSHint - run: npm run grunt jshint - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code slack-notifications: name: Slack Notifications diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index cd2746f307392..fa31222a3dee4 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -36,107 +36,12 @@ env: jobs: # Runs the end-to-end test suite. - # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Install Playwright browsers. - # - Builds WordPress to run from the `build` directory. - # - Starts the WordPress Docker container. - # - Logs the running Docker containers. - # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container). - # - Install WordPress within the Docker container. - # - Install Gutenberg. - # - Run the E2E tests. - # - Ensures version-controlled files are not modified or deleted. e2e-tests: - name: E2E Tests with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} - runs-on: ubuntu-latest + name: E2E Tests + uses: desrosj/wordpress-develop/.github/workflows/callable-end-to-end-tests.yml@try/make-workflows-callable permissions: contents: read - timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - strategy: - fail-fast: false - matrix: - LOCAL_SCRIPT_DEBUG: [ true, false ] - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV - echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - locale -a - - - name: Install npm Dependencies - run: npm ci - - - name: Install Playwright browsers - run: npx playwright install --with-deps - - - name: Build WordPress - run: npm run build - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: Docker debug information - run: | - docker -v - docker-compose -v - docker-compose run --rm mysql mysql --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m - docker-compose run --rm php php -i - docker-compose run --rm php locale -a - - - name: Install WordPress - env: - LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }} - run: npm run env:install - - - name: Install Gutenberg - run: npm run env:cli -- plugin install gutenberg --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Run E2E tests - run: npm run test:e2e - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: failures-artifacts - path: artifacts - if-no-files-found: ignore - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code slack-notifications: name: Slack Notifications diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 0fdda3be77811..4edc2ccb65d49 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -44,50 +44,13 @@ permissions: {} jobs: # Runs the QUnit tests for WordPress. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Run the WordPress QUnit tests. - # - Ensures version-controlled files are not modified or deleted. test-js: name: QUnit Tests - runs-on: ubuntu-latest + uses: desrosj/wordpress-develop/.github/workflows/callable-javascript-tests.yml@try/make-workflows-callable permissions: contents: read - timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Run QUnit tests - run: npm run grunt qunit:compiled - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - slack-notifications: name: Slack Notifications uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index dad158970df32..95b1958414e36 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -40,79 +40,14 @@ concurrency: permissions: {} jobs: - # Runs PHP compatibility testing. - # - # Violations are reported inline with annotations. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up PHP. - # - Logs debug information. - # - Configures caching for PHP compatibility scans. - # - Installs Composer dependencies. - # - Make Composer packages available globally. - # - Runs the PHP compatibility tests. - # - Generate a report for displaying issues as pull request annotations. - # - Ensures version-controlled files are not modified or deleted. php-compatibility: name: Check PHP compatibility - runs-on: ubuntu-latest + uses: desrosj/wordpress-develop/.github/workflows/callable-php-compatibility.yml@try/make-workflows-callable permissions: contents: read - timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up PHP - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2.25.4 - with: - php-version: '7.4' - coverage: none - tools: cs2pr - - - name: Log debug information - run: | - composer --version - - # This date is used to ensure that the PHP compatibility cache is cleared at least once every week. - # http://man7.org/linux/man-pages/man1/date.1.html - - name: "Get last Monday's date" - id: get-date - run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT - - - name: Cache PHP compatibility scan cache - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: .cache/phpcompat.json - key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }} - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 - with: - custom-cache-suffix: ${{ steps.get-date.outputs.date }} - - - name: Make Composer packages available globally - run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH - - - name: Run PHP compatibility tests - id: phpcs - run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml - - - name: Show PHPCompatibility results in PR - if: ${{ always() && steps.phpcs.outcome == 'failure' }} - run: cs2pr ./.cache/phpcs-compat-report.xml - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - slack-notifications: name: Slack Notifications uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 85f9a09f6bf53..c6f663e148d61 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -31,12 +31,11 @@ concurrency: permissions: {} jobs: - # # Creates a PHPUnit test job for each PHP/MySQL combination. # test-with-mysql: name: PHP ${{ matrix.php }} - uses: WordPress/wordpress-develop/.github/workflows/phpunit-tests-run.yml@trunk + uses: desrosj/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@try/make-workflows-callable permissions: contents: read secrets: inherit @@ -88,7 +87,7 @@ jobs: # test-with-mariadb: name: PHP ${{ matrix.php }} - uses: WordPress/wordpress-develop/.github/workflows/phpunit-tests-run.yml@trunk + uses: desrosj/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@try/make-workflows-callable permissions: contents: read secrets: inherit From 322b808f992f357c075d5e25f0a1443ceee83760 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 11 Apr 2024 15:07:37 -0400 Subject: [PATCH 02/26] Use inputs for e2e workflow. --- .github/workflows/end-to-end-tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index fa31222a3dee4..225786327c540 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -37,11 +37,17 @@ env: jobs: # Runs the end-to-end test suite. e2e-tests: - name: E2E Tests + name: Test with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} uses: desrosj/wordpress-develop/.github/workflows/callable-end-to-end-tests.yml@try/make-workflows-callable permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + strategy: + fail-fast: false + matrix: + LOCAL_SCRIPT_DEBUG: [ true, false ] + with: + LOCAL_SCRIPT_DEBUG: ${{ matrix.LOCAL_SCRIPT_DEBUG }} slack-notifications: name: Slack Notifications From e9f294dc668ff2f230810bab39fd37c17cc48063 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 24 Apr 2024 12:16:48 -0400 Subject: [PATCH 03/26] Update 6.4 to use callable performance workflow. --- .github/workflows/performance.yml | 242 +----------------------------- 1 file changed, 3 insertions(+), 239 deletions(-) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index a21d8f814af42..b1846c59b0e6c 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -29,250 +29,14 @@ concurrency: # Any needed permissions should be configured at the job level. permissions: {} -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - - # Performance testing should be performed in an environment reflecting a standard production environment. - LOCAL_WP_DEBUG: false - LOCAL_SCRIPT_DEBUG: false - LOCAL_SAVEQUERIES: false - LOCAL_WP_DEVELOPMENT_MODE: "''" - - # This workflow takes two sets of measurements — one for the current commit, - # and another against a consistent version that is used as a baseline measurement. - # This is done to isolate variance in measurements caused by the GitHub runners - # from differences caused by code changes between commits. The BASE_TAG value here - # represents the version being used for baseline measurements. It should only be - # changed if we want to normalize results against a different baseline. - BASE_TAG: '6.1.1' - LOCAL_DIR: build - TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }} - TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} - jobs: # Runs the performance test suite. - # - # Performs the following steps: - # - Configure environment variables. - # - Checkout repository. - # - Set up Node.js. - # - Log debug information. - # - Install npm dependencies. - # - Install Playwright browsers. - # - Build WordPress. - # - Start Docker environment. - # - Log running Docker containers. - # - Docker debug information. - # - Install WordPress. - # - Install WordPress Importer plugin. - # - Import mock data. - # - Update permalink structure. - # - Install MU plugin. - # - Run performance tests (current commit). - # - Print performance tests results. - # - Check out target commit (target branch or previous commit). - # - Switch Node.js versions if necessary. - # - Install npm dependencies. - # - Build WordPress. - # - Run performance tests (previous/target commit). - # - Print target performance tests results. - # - Reset to original commit. - # - Switch Node.js versions if necessary. - # - Install npm dependencies. - # - Set the environment to the baseline version. - # - Run baseline performance tests. - # - Print baseline performance tests results. - # - Compare results with base. - # - Add workflow summary. - # - Set the base sha. - # - Set commit details. - # - Publish performance results. - # - Ensure version-controlled files are not modified or deleted. - # - Dispatch workflow run. performance: name: Run performance tests - runs-on: ubuntu-latest + uses: desrosj/wordpress-develop/.github/workflows/callable-performance.yml@try/make-workflows-callable permissions: contents: read - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV - echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - locale -a - - - name: Install npm dependencies - run: npm ci - - - name: Install Playwright browsers - run: npx playwright install --with-deps - - - name: Build WordPress - run: npm run build - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: Docker debug information - run: | - docker -v - docker-compose -v - docker-compose run --rm mysql mysql --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m - docker-compose run --rm php php -i - docker-compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Install WordPress Importer plugin - run: npm run env:cli -- plugin install wordpress-importer --activate --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Import mock data - run: | - curl -O https://raw.githubusercontent.com/WordPress/theme-test-data/b9752e0533a5acbb876951a8cbb5bcc69a56474c/themeunittestdata.wordpress.xml - npm run env:cli -- import themeunittestdata.wordpress.xml --authors=create --path=/var/www/${{ env.LOCAL_DIR }} - rm themeunittestdata.wordpress.xml - - - name: Update permalink structure - run: | - npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Install MU plugin - run: | - mkdir ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins - cp ./tests/performance/wp-content/mu-plugins/server-timing.php ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins/server-timing.php - - - name: Run performance tests (current commit) - run: npm run test:performance - - - name: Print performance tests results - run: node ./tests/performance/results.js - - - name: Check out target commit (target branch or previous commit) - run: | - if [[ -z "$TARGET_REF" ]]; then - git fetch -n origin $TARGET_SHA - else - git fetch -n origin $TARGET_REF - fi - git reset --hard $TARGET_SHA - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Install npm dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Run target performance tests (base/previous commit) - env: - TEST_RESULTS_PREFIX: before - run: npm run test:performance - - - name: Print target performance tests results - env: - TEST_RESULTS_PREFIX: before - run: node ./tests/performance/results.js - - - name: Reset to original commit - run: git reset --hard $GITHUB_SHA - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Install npm dependencies - run: npm ci - - - name: Set the environment to the baseline version - run: | - npm run env:cli -- core update --version=${{ env.BASE_TAG }} --force --path=/var/www/${{ env.LOCAL_DIR }} - npm run env:cli -- core version --path=/var/www/${{ env.LOCAL_DIR }} - - - name: Run baseline performance tests - env: - TEST_RESULTS_PREFIX: base - run: npm run test:performance - - - name: Print baseline performance tests results - env: - TEST_RESULTS_PREFIX: base - run: node ./tests/performance/results.js - - - name: Compare results with base - run: node ./tests/performance/compare-results.js ${{ runner.temp }}/summary.md - - - name: Add workflow summary - run: cat ${{ runner.temp }}/summary.md >> $GITHUB_STEP_SUMMARY - - - name: Set the base sha - # Only needed when publishing results. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 - id: base-sha - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const baseRef = await github.rest.git.getRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'tags/${{ env.BASE_TAG }}' }); - return baseRef.data.object.sha; - - - name: Set commit details - # Only needed when publishing results. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 - id: commit-timestamp - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const commit_details = await github.rest.git.getCommit({ owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha }); - return parseInt((new Date( commit_details.data.author.date ).getTime() / 1000).toFixed(0)) - - - name: Publish performance results - # Only publish results on pushes to trunk. - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/trunk' }} - env: - BASE_SHA: ${{ steps.base-sha.outputs.result }} - COMMITTED_AT: ${{ steps.commit-timestamp.outputs.result }} - CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} - HOST_NAME: "www.codevitals.run" - run: node ./tests/performance/log-results.js $CODEVITALS_PROJECT_TOKEN trunk $GITHUB_SHA $BASE_SHA $COMMITTED_AT $HOST_NAME - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code + if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} slack-notifications: name: Slack Notifications @@ -308,7 +72,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 From 140e7c2bf62440357dd75e2bef5962cfbf5a8eb1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 20 Oct 2023 14:54:23 +0000 Subject: [PATCH 04/26] Build/Test Tools: Test the Gutenberg plugin build process. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A very common contributor setup is having a copy of the `gutenberg` development repository within a checkout of the `wordpress-develop` repository. On occasion, there are some strange incompatibilities that come up when using this setup. A few examples can be seen in #58671 and #59634. This changeset helps ensure that these edge cases are not introduced by testing the Gutenberg plugin’s build process within WordPress configured to run from both the `src` and `build` directories. This also renames the “Test npm” workflow to a more general “Test Build Processes”, which more accurately describes what is actually being tested within it and allows these new test jobs to be grouped in. And finally, the logic within the workflow has been split out into two callable workflows. This helps avoid code duplication within the workflow, and allows for better grouping on the workflow run screen. Props swissspidy, aferica, SergeyBiryukov, antonvlasenko, desrosj. Fixes #59632. See #58671, #59634. git-svn-id: https://develop.svn.wordpress.org/trunk@56976 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/test-build-processes.yml | 127 ++++++++++++ .github/workflows/test-npm.yml | 227 --------------------- 2 files changed, 127 insertions(+), 227 deletions(-) create mode 100644 .github/workflows/test-build-processes.yml delete mode 100644 .github/workflows/test-npm.yml diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml new file mode 100644 index 0000000000000..751e36391c7f1 --- /dev/null +++ b/.github/workflows/test-build-processes.yml @@ -0,0 +1,127 @@ +name: Test Build Processes + +on: + push: + branches: + - trunk + - '3.[7-9]' + - '[4-9].[0-9]' + tags: + - '[0-9]+.[0-9]' + - '[0-9]+.[0-9].[0-9]+' + pull_request: + branches: + - trunk + - '3.[7-9]' + - '[4-9].[0-9]' + paths: + # These files configure npm. Changes could affect the outcome. + - 'package*.json' + # JavaScript files are built using npm. + - '**.js' + # CSS and SCSS files are built using npm. + - '**.scss' + - '**.css' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/**.yml' + workflow_dispatch: + +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +# Disable permissions for all available scopes by default. +# Any needed permissions should be configured at the job level. +permissions: {} + +jobs: + # Tests the WordPress Core build process on multiple operating systems. + test-core-build-process: + name: Core running from ${{ matrix.directory }} + uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk + permissions: + contents: read + if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, windows-latest ] + directory: [ 'src', 'build' ] + with: + os: ${{ matrix.os }} + directory: ${{ matrix.directory }} + + # Tests the WordPress Core build process on MacOS. + # + # This is separate from the job above in order to use stricter conditions when determining when to run. + # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate. + # + # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is + # currently no way to determine the OS being used on a given job. + # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. + test-core-build-process-macos: + name: Core running from ${{ matrix.directory }} + uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk + permissions: + contents: read + if: ${{ github.repository == 'WordPress/wordpress-develop' }} + strategy: + fail-fast: false + matrix: + os: [ macos-latest ] + directory: [ 'src', 'build' ] + with: + os: ${{ matrix.os }} + directory: ${{ matrix.directory }} + + slack-notifications: + name: Slack Notifications + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk + permissions: + actions: read + contents: read + needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} + secrets: + SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} + SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} + SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} + SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} + + failed-workflow: + name: Failed workflow tasks + runs-on: ubuntu-latest + permissions: + actions: write + needs: [ slack-notifications ] + if: | + always() && + github.repository == 'WordPress/wordpress-develop' && + github.event_name != 'pull_request' && + github.run_attempt < 2 && + ( + contains( needs.*.result, 'cancelled' ) || + contains( needs.*.result, 'failure' ) + ) + + steps: + - name: Dispatch workflow run + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + with: + retries: 2 + retry-exempt-status-codes: 418 + script: | + github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'failed-workflow.yml', + ref: 'trunk', + inputs: { + run_id: '${{ github.run_id }}' + } + }); diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml deleted file mode 100644 index 4d42aecd2279a..0000000000000 --- a/.github/workflows/test-npm.yml +++ /dev/null @@ -1,227 +0,0 @@ -name: Test npm - -on: - push: - branches: - - trunk - - '3.[7-9]' - - '[4-9].[0-9]' - tags: - - '[0-9]+.[0-9]' - - '[0-9]+.[0-9].[0-9]+' - pull_request: - branches: - - trunk - - '3.[7-9]' - - '[4-9].[0-9]' - paths: - # These files configure npm. Changes could affect the outcome. - - 'package*.json' - # JavaScript files are built using npm. - - '**.js' - # CSS and SCSS files are built using npm. - - '**.scss' - - '**.css' - # Changes to workflow files should always verify all workflows are successful. - - '.github/workflows/**.yml' - workflow_dispatch: - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -env: - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -jobs: - # Verifies that installing npm dependencies and building WordPress works as expected. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Builds WordPress to run from the `build` directory. - # - Cleans up after building WordPress to the `build` directory. - # - Ensures version-controlled files are not modified or deleted. - # - Builds WordPress to run from the `src` directory. - # - Cleans up after building WordPress to the `src` directory. - # - Ensures version-controlled files are not modified or deleted. - test-npm: - name: Test npm on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - permissions: - contents: read - timeout-minutes: 20 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, windows-latest ] - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - check-latest: true - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Build WordPress in /src - run: npm run build:dev - - - name: Clean after building in /src - run: npm run grunt clean -- --dev - - - name: Ensure version-controlled files are not modified or deleted during building and cleaning - run: git diff --exit-code - - - name: Build WordPress - run: npm run build - - - name: Clean after building - run: npm run grunt clean - - - name: Ensure version-controlled files are not modified or deleted during building and cleaning - run: git diff --exit-code - - # Verifies that installing npm dependencies and building WordPress works as expected on MacOS. - # - # This is separate from the job above in order to use stricter conditions about when to run. - # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate. - # - # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is - # currently no way to determine the OS being used on a given job. - # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. - # - # Performs the following steps: - # - Checks out the repository. - # - Sets up Node.js. - # - Logs debug information about the GitHub Action runner. - # - Installs npm dependencies. - # - Builds WordPress to run from the `build` directory. - # - Cleans up after building WordPress to the `build` directory. - # - Ensures version-controlled files are not modified or deleted. - # - Builds WordPress to run from the `src` directory. - # - Cleans up after building WordPress to the `src` directory. - # - Ensures version-controlled files are not modified or deleted. - test-npm-macos: - name: Test npm on MacOS - runs-on: macos-latest - permissions: - contents: read - timeout-minutes: 30 - if: ${{ github.repository == 'WordPress/wordpress-develop' }} - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - check-latest: true - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Build WordPress in /src - run: npm run build:dev - - - name: Clean after building in /src - run: npm run grunt clean -- --dev - - - name: Ensure version-controlled files are not modified or deleted during building and cleaning - run: git diff --exit-code - - - name: Build WordPress - run: npm run build - - - name: Clean after building - run: npm run grunt clean - - - name: Ensure version-controlled files are not modified or deleted during building and cleaning - run: git diff --exit-code - - slack-notifications: - name: Slack Notifications - uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk - permissions: - actions: read - contents: read - needs: [ test-npm, test-npm-macos ] - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} - with: - calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} - secrets: - SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} - SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} - SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} - SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} - - failed-workflow: - name: Failed workflow tasks - runs-on: ubuntu-latest - permissions: - actions: write - needs: [ slack-notifications ] - if: | - always() && - github.repository == 'WordPress/wordpress-develop' && - github.event_name != 'pull_request' && - github.run_attempt < 2 && - ( - contains( needs.*.result, 'cancelled' ) || - contains( needs.*.result, 'failure' ) - ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: '${{ github.run_id }}' - } - }); From 186a64a15db1524f9e640658d7d60707c105dd86 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 6 May 2024 14:39:26 -0400 Subject: [PATCH 05/26] Remove non-existent `needs` jobs. --- .github/workflows/test-build-processes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 751e36391c7f1..68712d689159b 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -83,7 +83,7 @@ jobs: permissions: actions: read contents: read - needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ] + needs: [ test-core-build-process, test-core-build-process-macos ] if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} with: calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} From 892549626a6b46b0777ede55cce4b6a2d0aa05d1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 6 May 2024 14:47:10 -0400 Subject: [PATCH 06/26] Skip emoji script testing. --- .github/workflows/test-build-processes.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 68712d689159b..e928914662d8f 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -41,7 +41,7 @@ jobs: # Tests the WordPress Core build process on multiple operating systems. test-core-build-process: name: Core running from ${{ matrix.directory }} - uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk + uses: desrosj/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@try/make-workflows-callable permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -64,7 +64,7 @@ jobs: # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. test-core-build-process-macos: name: Core running from ${{ matrix.directory }} - uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk + uses: desrosj/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@try/make-workflows-callable permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} From 9b4a71a4b88f4137ccb8a07845a224128f2bd58d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 6 May 2024 14:47:28 -0400 Subject: [PATCH 07/26] Skip emoji script testing. --- .github/workflows/test-build-processes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index e928914662d8f..34d6a98caff5f 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -53,6 +53,7 @@ jobs: with: os: ${{ matrix.os }} directory: ${{ matrix.directory }} + test-emoji: false # Tests the WordPress Core build process on MacOS. # @@ -76,6 +77,7 @@ jobs: with: os: ${{ matrix.os }} directory: ${{ matrix.directory }} + test-emoji: false slack-notifications: name: Slack Notifications From 11c2805aced5df9a936b09247709323e676d295e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 15 May 2024 12:54:09 -0400 Subject: [PATCH 08/26] Remove `version` from `docker-compose.yml` --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bec05ab2a5ba6..6cd25afb638ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: ## From 3ee10ed886d4c23b05aa01dc551df64d302aa332 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 17 May 2024 14:20:55 -0400 Subject: [PATCH 09/26] Use the workflow files in `trunk`. --- .github/workflows/coding-standards.yml | 4 ++-- .github/workflows/end-to-end-tests.yml | 2 +- .github/workflows/javascript-tests.yml | 2 +- .github/workflows/performance.yml | 2 +- .github/workflows/php-compatibility.yml | 2 +- .github/workflows/phpunit-tests.yml | 4 ++-- .github/workflows/test-build-processes.yml | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index db82eb9db3afb..2c5e8a988d85d 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -48,7 +48,7 @@ jobs: # Runs PHP coding standards checks. phpcs: name: PHP coding standards - uses: desrosj/wordpress-develop/.github/workflows/callable-coding-standards-php.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-coding-standards-php.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -56,7 +56,7 @@ jobs: # Runs the JavaScript coding standards checks. jshint: name: JavaScript coding standards - uses: desrosj/wordpress-develop/.github/workflows/callable-coding-standards-javascript.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-coding-standards-javascript.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 225786327c540..da9c4face78bb 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -38,7 +38,7 @@ jobs: # Runs the end-to-end test suite. e2e-tests: name: Test with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} - uses: desrosj/wordpress-develop/.github/workflows/callable-end-to-end-tests.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-end-to-end-tests.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 4edc2ccb65d49..828245ca587bb 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -46,7 +46,7 @@ jobs: # Runs the QUnit tests for WordPress. test-js: name: QUnit Tests - uses: desrosj/wordpress-develop/.github/workflows/callable-javascript-tests.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-javascript-tests.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index b1846c59b0e6c..acc74dab9026a 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -33,7 +33,7 @@ jobs: # Runs the performance test suite. performance: name: Run performance tests - uses: desrosj/wordpress-develop/.github/workflows/callable-performance.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-performance.yml@trunk permissions: contents: read if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index 95b1958414e36..cff12a2018906 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -43,7 +43,7 @@ jobs: # Runs PHP compatibility testing. php-compatibility: name: Check PHP compatibility - uses: desrosj/wordpress-develop/.github/workflows/callable-php-compatibility.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-php-compatibility.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index c6f663e148d61..21d4dfca8166a 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -35,7 +35,7 @@ jobs: # test-with-mysql: name: PHP ${{ matrix.php }} - uses: desrosj/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@trunk permissions: contents: read secrets: inherit @@ -87,7 +87,7 @@ jobs: # test-with-mariadb: name: PHP ${{ matrix.php }} - uses: desrosj/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@trunk permissions: contents: read secrets: inherit diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 34d6a98caff5f..fc4292fbaef11 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -41,7 +41,7 @@ jobs: # Tests the WordPress Core build process on multiple operating systems. test-core-build-process: name: Core running from ${{ matrix.directory }} - uses: desrosj/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -65,7 +65,7 @@ jobs: # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. test-core-build-process-macos: name: Core running from ${{ matrix.directory }} - uses: desrosj/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@try/make-workflows-callable + uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} From c68b1b070f28555b3f7490c57c1827ac24bea84b Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 17 May 2024 14:25:01 -0400 Subject: [PATCH 10/26] Use new file prefix. --- .github/workflows/coding-standards.yml | 4 ++-- .github/workflows/end-to-end-tests.yml | 2 +- .github/workflows/javascript-tests.yml | 2 +- .github/workflows/performance.yml | 2 +- .github/workflows/php-compatibility.yml | 2 +- .github/workflows/phpunit-tests.yml | 4 ++-- .github/workflows/test-build-processes.yml | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 2c5e8a988d85d..438f405ec6856 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -48,7 +48,7 @@ jobs: # Runs PHP coding standards checks. phpcs: name: PHP coding standards - uses: WordPress/wordpress-develop/.github/workflows/callable-coding-standards-php.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -56,7 +56,7 @@ jobs: # Runs the JavaScript coding standards checks. jshint: name: JavaScript coding standards - uses: WordPress/wordpress-develop/.github/workflows/callable-coding-standards-javascript.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index da9c4face78bb..0fbbc3a6d39c3 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -38,7 +38,7 @@ jobs: # Runs the end-to-end test suite. e2e-tests: name: Test with SCRIPT_DEBUG ${{ matrix.LOCAL_SCRIPT_DEBUG && 'enabled' || 'disabled' }} - uses: WordPress/wordpress-develop/.github/workflows/callable-end-to-end-tests.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-end-to-end-tests.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 828245ca587bb..82598b6e0f653 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -46,7 +46,7 @@ jobs: # Runs the QUnit tests for WordPress. test-js: name: QUnit Tests - uses: WordPress/wordpress-develop/.github/workflows/callable-javascript-tests.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index acc74dab9026a..9244fc84cb6be 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -33,7 +33,7 @@ jobs: # Runs the performance test suite. performance: name: Run performance tests - uses: WordPress/wordpress-develop/.github/workflows/callable-performance.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-performance.yml@trunk permissions: contents: read if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index cff12a2018906..ce8f63fc9b85e 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -43,7 +43,7 @@ jobs: # Runs PHP compatibility testing. php-compatibility: name: Check PHP compatibility - uses: WordPress/wordpress-develop/.github/workflows/callable-php-compatibility.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-php-compatibility.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 21d4dfca8166a..ea168e353b57b 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -35,7 +35,7 @@ jobs: # test-with-mysql: name: PHP ${{ matrix.php }} - uses: WordPress/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@trunk permissions: contents: read secrets: inherit @@ -87,7 +87,7 @@ jobs: # test-with-mariadb: name: PHP ${{ matrix.php }} - uses: WordPress/wordpress-develop/.github/workflows/callable-phpunit-tests.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests.yml@trunk permissions: contents: read secrets: inherit diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index fc4292fbaef11..2dc0163eed89a 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -41,7 +41,7 @@ jobs: # Tests the WordPress Core build process on multiple operating systems. test-core-build-process: name: Core running from ${{ matrix.directory }} - uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} @@ -65,7 +65,7 @@ jobs: # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. test-core-build-process-macos: name: Core running from ${{ matrix.directory }} - uses: WordPress/wordpress-develop/.github/workflows/callable-test-core-build-process.yml@trunk + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' }} From a912ed1c788783b558ebb274abd7853a26b93ff2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 17 May 2024 14:39:43 -0400 Subject: [PATCH 11/26] Update `github-scripts` action. --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/end-to-end-tests.yml | 2 +- .github/workflows/failed-workflow.yml | 2 +- .github/workflows/install-testing.yml | 2 +- .github/workflows/javascript-tests.yml | 2 +- .github/workflows/php-compatibility.yml | 2 +- .github/workflows/phpunit-tests.yml | 2 +- .github/workflows/slack-notifications.yml | 4 ++-- .github/workflows/test-and-zip-default-themes.yml | 2 +- .github/workflows/test-build-processes.yml | 2 +- .github/workflows/test-coverage.yml | 2 +- .github/workflows/test-old-branches.yml | 2 +- .github/workflows/upgrade-testing.yml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 438f405ec6856..1deb51394761e 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -95,7 +95,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 0fbbc3a6d39c3..d77e439b2964c 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -82,7 +82,7 @@ jobs: ) steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/failed-workflow.yml b/.github/workflows/failed-workflow.yml index f92d4b8102e9f..afb978782036c 100644 --- a/.github/workflows/failed-workflow.yml +++ b/.github/workflows/failed-workflow.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Rerun a workflow - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 10 retry-exempt-status-codes: 418 diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index d83f56b3792a6..8811cf94eb46b 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -115,7 +115,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 82598b6e0f653..3911191134669 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -85,7 +85,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index ce8f63fc9b85e..d84a372da8f29 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -82,7 +82,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index ea168e353b57b..81a0b28585c4f 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -160,7 +160,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml index f9b0f04723495..566979a5698f8 100644 --- a/.github/workflows/slack-notifications.yml +++ b/.github/workflows/slack-notifications.yml @@ -60,7 +60,7 @@ jobs: steps: - name: Determine the status of the previous attempt id: previous-attempt-result - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 @@ -131,7 +131,7 @@ jobs: - name: Get the commit message id: current-commit-message - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} with: retries: 2 diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml index a3a354595ec91..1b5719d61e821 100644 --- a/.github/workflows/test-and-zip-default-themes.yml +++ b/.github/workflows/test-and-zip-default-themes.yml @@ -227,7 +227,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 2dc0163eed89a..88d091a2b62e6 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -113,7 +113,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 8e400167f0052..86741a8d2ea4d 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -208,7 +208,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml index 7a5b9c9f52033..0a94cc9a53ed1 100644 --- a/.github/workflows/test-old-branches.yml +++ b/.github/workflows/test-old-branches.yml @@ -87,7 +87,7 @@ jobs: # Run all branches monthly, but only the currently supported one twice per month. steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 if: ${{ github.event_name == 'push' || github.event.schedule == '0 0 15 * *' || matrix.branch == env.CURRENTLY_SUPPORTED_BRANCH }} with: retries: 2 diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index 18a45d4bd6b98..2157c0fb20b31 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -191,7 +191,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: retries: 2 retry-exempt-status-codes: 418 From 0bd8c6d420028390d68b67bacd2d06c582176789 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 17 May 2024 14:39:55 -0400 Subject: [PATCH 12/26] Remove workflow no longer required. --- .github/workflows/phpunit-tests-run.yml | 188 ------------------------ 1 file changed, 188 deletions(-) delete mode 100644 .github/workflows/phpunit-tests-run.yml diff --git a/.github/workflows/phpunit-tests-run.yml b/.github/workflows/phpunit-tests-run.yml deleted file mode 100644 index 871585d572d35..0000000000000 --- a/.github/workflows/phpunit-tests-run.yml +++ /dev/null @@ -1,188 +0,0 @@ -## -# A callable workflow that runs the PHPUnit test suite with the specified configuration. -## -name: Run PHPUnit tests - -on: - workflow_call: - inputs: - os: - description: 'Operating system to run tests on' - required: false - type: 'string' - default: 'ubuntu-latest' - php: - description: 'The version of PHP to use, in the format of X.Y' - required: true - type: 'string' - db-type: - description: 'Database type. Valid types are mysql and mariadb' - required: false - type: 'string' - default: 'mysql' - db-version: - description: 'Database version' - required: false - type: 'string' - default: '8.0' - multisite: - description: 'Whether to run tests as multisite' - required: false - type: 'boolean' - default: false - memcached: - description: 'Whether to test with memcached enabled' - required: false - type: 'boolean' - default: false - phpunit-config: - description: 'The PHPUnit configuration file to use' - required: false - type: 'string' - default: 'phpunit.xml.dist' - report: - description: 'Whether to report results to WordPress.org Hosting Tests' - required: false - type: 'boolean' - default: false -env: - LOCAL_PHP: ${{ inputs.php }}-fpm - LOCAL_DB_TYPE: ${{ inputs.db-type }} - LOCAL_DB_VERSION: ${{ inputs.db-version }} - LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} - PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} - PUPPETEER_SKIP_DOWNLOAD: ${{ true }} - -jobs: - # Runs the PHPUnit tests for WordPress. - # - # Performs the following steps: - # - Sets environment variables. - # - Checks out the repository. - # - Sets up Node.js. - # - Sets up PHP. - # - Installs Composer dependencies. - # - Installs npm dependencies - # - Logs general debug information about the runner. - # - Logs Docker debug information (about the Docker installation within the runner). - # - Starts the WordPress Docker container. - # - Logs the running Docker containers. - # - Logs debug information about what's installed within the WordPress Docker containers. - # - Install WordPress within the Docker container. - # - Run the PHPUnit tests. - # - Ensures version-controlled files are not modified or deleted. - # - Checks out the WordPress Test reporter repository. - # - Submit the test results to the WordPress.org host test results. - phpunit-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} - runs-on: ${{ inputs.os }} - timeout-minutes: 20 - - steps: - - name: Configure environment variables - run: | - echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV - echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - ## - # This allows Composer dependencies to be installed using a single step. - # - # Since the tests are currently run within the Docker containers where the PHP version varies, - # the same PHP version needs to be configured for the action runner machine so that the correct - # dependency versions are installed and cached. - ## - - name: Set up PHP - uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2.25.4 - with: - php-version: '${{ inputs.php }}' - coverage: none - - # Since Composer dependencies are installed using `composer update` and no lock file is in version control, - # passing a custom cache suffix ensures that the cache is flushed at least once per week. - - name: Install Composer dependencies - uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 - with: - custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") - - - name: Install npm dependencies - run: npm ci - - - name: General debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - composer --version - locale -a - - - name: Docker debug information - run: | - docker -v - docker-compose -v - - - name: Start Docker environment - run: | - npm run env:start - - - name: Log running Docker containers - run: docker ps -a - - - name: WordPress Docker container debug information - run: | - docker-compose run --rm mysql ${{ env.LOCAL_DB_TYPE }} --version - docker-compose run --rm php php --version - docker-compose run --rm php php -m - docker-compose run --rm php php -i - docker-compose run --rm php locale -a - - - name: Install WordPress - run: npm run env:install - - - name: Run PHPUnit tests - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} - - - name: Run AJAX tests - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax - - - name: Run ms-files tests as a multisite install - if: ${{ inputs.multisite }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ms-files - - - name: Run external HTTP tests - if: ${{ ! inputs.multisite }} - run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group external-http - - # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. - - name: Run (Xdebug) tests - if: ${{ inputs.php != '8.3' }} - run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ - - - name: Ensure version-controlled files are not modified or deleted - run: git diff --exit-code - - - name: Checkout the WordPress Test Reporter - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report }} - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - repository: 'WordPress/phpunit-test-runner' - path: 'test-runner' - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Submit test results to the WordPress.org host test results - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && inputs.report }} - env: - WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" - run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php From a1c9351f9327488cfe18e1abacbab0ffc8ef99d4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 17 May 2024 14:41:13 -0400 Subject: [PATCH 13/26] Revert accidental change. --- .github/workflows/upgrade-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index 2157c0fb20b31..18a45d4bd6b98 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -191,7 +191,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: retries: 2 retry-exempt-status-codes: 418 From 26bb610beb9bb7f12c48a45f1316162f2e607d7c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 20 May 2024 16:46:28 -0400 Subject: [PATCH 14/26] Revert unnecessary action updates. --- .github/workflows/failed-workflow.yml | 2 +- .github/workflows/install-testing.yml | 2 +- .github/workflows/slack-notifications.yml | 4 ++-- .github/workflows/test-and-zip-default-themes.yml | 2 +- .github/workflows/test-coverage.yml | 2 +- .github/workflows/test-old-branches.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/failed-workflow.yml b/.github/workflows/failed-workflow.yml index afb978782036c..f92d4b8102e9f 100644 --- a/.github/workflows/failed-workflow.yml +++ b/.github/workflows/failed-workflow.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Rerun a workflow - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: retries: 10 retry-exempt-status-codes: 418 diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index 8811cf94eb46b..d83f56b3792a6 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -115,7 +115,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml index 566979a5698f8..f9b0f04723495 100644 --- a/.github/workflows/slack-notifications.yml +++ b/.github/workflows/slack-notifications.yml @@ -60,7 +60,7 @@ jobs: steps: - name: Determine the status of the previous attempt id: previous-attempt-result - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: retries: 2 retry-exempt-status-codes: 418 @@ -131,7 +131,7 @@ jobs: - name: Get the commit message id: current-commit-message - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} with: retries: 2 diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml index 1b5719d61e821..a3a354595ec91 100644 --- a/.github/workflows/test-and-zip-default-themes.yml +++ b/.github/workflows/test-and-zip-default-themes.yml @@ -227,7 +227,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 86741a8d2ea4d..8e400167f0052 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -208,7 +208,7 @@ jobs: steps: - name: Dispatch workflow run - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: retries: 2 retry-exempt-status-codes: 418 diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml index 0a94cc9a53ed1..7a5b9c9f52033 100644 --- a/.github/workflows/test-old-branches.yml +++ b/.github/workflows/test-old-branches.yml @@ -87,7 +87,7 @@ jobs: # Run all branches monthly, but only the currently supported one twice per month. steps: - name: Dispatch workflow run - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 if: ${{ github.event_name == 'push' || github.event.schedule == '0 0 15 * *' || matrix.branch == env.CURRENTLY_SUPPORTED_BRANCH }} with: retries: 2 From d72de975487235fd429182bd0125a186379ec109 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 20 May 2024 16:51:49 -0400 Subject: [PATCH 15/26] Remove the `build.yml` file. This is now handled in the build process test workflow. --- .github/workflows/build.yml | 67 ------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index d211f1247874e..0000000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build WordPress - -on: - pull_request: - workflow_dispatch: - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -# Exposes WordPress builds as a GitHub artifact to enable -# previewing Pull Requests inside WordPress Playground. -# -# @see https://github.com/WordPress/wordpress-playground/pull/700 -# @see https://github.com/WordPress/wordpress-develop/pull/5481 -jobs: - build-wordpress: - name: Upload WordPress build as an artifact - runs-on: ubuntu-latest - permissions: - contents: read - timeout-minutes: 20 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Set up Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version-file: '.nvmrc' - cache: npm - - - name: Log debug information - run: | - npm --version - node --version - curl --version - git --version - svn --version - - - name: Install npm Dependencies - run: npm ci - - - name: Build WordPress - run: npm run build - - - name: Zip WordPress build - run: cd build && zip -r wordpress.zip . - - - name: Upload the build directory as GitHub artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: always() - with: - name: wordpress-build-${{ github.event_name == 'pull_request' && github.event.number || github.sha }} - path: build/wordpress.zip - if-no-files-found: error From 75ba79d24be9e1d04bdfbbdba312a0bf1393525e Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 20 May 2024 16:56:16 -0400 Subject: [PATCH 16/26] Try including commenting workflow. --- .github/workflows/pull-request-comments.yml | 212 ++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 .github/workflows/pull-request-comments.yml diff --git a/.github/workflows/pull-request-comments.yml b/.github/workflows/pull-request-comments.yml new file mode 100644 index 0000000000000..189eb1c1737d0 --- /dev/null +++ b/.github/workflows/pull-request-comments.yml @@ -0,0 +1,212 @@ +# Responsible for making comments on pull requests, such as commenting for first time contributors. +name: Pull Request Comments + +on: + pull_request_target: + types: [ 'opened' ] + workflow_run: + workflows: [ 'Test Build Processes' ] + types: + - completed + +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && github.event.number || github.sha }} + +# Disable permissions for all available scopes by default. +# Any needed permissions should be configured at the job level. +permissions: {} + +jobs: + # Comments on a pull request when the author is a first time contributor. + post-welcome-message: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + timeout-minutes: 5 + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }} + steps: + - name: Post a welcome comment + uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0 + with: + FIRST_PR_REACTIONS: 'hooray' + FIRST_PR_COMMENT: > + Hi @{{ author }}! 👋 + + + Thank you for your contribution to WordPress! 💖 + + + It looks like this is your first pull request to `wordpress-develop`. Here are a few things to be aware of that may help you out! + + + **No one monitors this repository for new pull requests.** Pull requests **must** be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. + + + **Pull requests are never merged on GitHub.** The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. + + + More information about how GitHub pull requests can be used to contribute to WordPress can be found in [the Core Handbook](https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/). + + + **Please include automated tests.** Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the [Automated Testing](https://make.wordpress.org/core/handbook/testing/automated-testing/) page in the handbook. + + + If you have not had a chance, please review the [Contribute with Code page](https://make.wordpress.org/core/handbook/contribute/) in the [WordPress Core Handbook](https://make.wordpress.org/core/handbook/). + + + The [Developer Hub](https://developer.wordpress.org/) also documents the various [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) that are followed: + + - [PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) + + - [CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/) + + - [HTML Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/html/) + + - [JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/) + + - [Accessibility Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/accessibility/) + + - [Inline Documentation Standards](https://developer.wordpress.org/coding-standards/inline-documentation-standards/) + + + Thank you, + + The WordPress Project + + # Leaves a comment on a pull request with a link to test the changes in a WordPress Playground instance. + playground-details: + name: Comment on a pull request with Playground details + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + if: > + github.repository == 'WordPress/wordpress-develop' && + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + steps: + - name: Download artifact + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const artifacts = await github.rest.actions.listWorkflowRunArtifacts( { + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + } ); + + const matchArtifact = artifacts.data.artifacts.filter( ( artifact ) => { + return artifact.name === 'pr-number' + } )[0]; + + if ( ! matchArtifact ) { + core.setFailed( 'No artifact found!' ); + return; + } + + const download = await github.rest.actions.downloadArtifact( { + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + } ); + + const fs = require( 'fs' ); + fs.writeFileSync( '${{github.workspace}}/pr-number.zip', Buffer.from( download.data ) ) + + - name: Unzip the artifact containing the PR number + run: unzip pr-number.zip + + - name: Leave a comment about testing with Playground + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const fs = require( 'fs' ); + const issue_number = Number( fs.readFileSync( './NR' ) ); + + // Comments are only added after the first successful build. Check for the presence of a comment and bail early. + const commentInfo = { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number, + }; + + const comments = ( await github.rest.issues.listComments( commentInfo ) ).data; + + for ( const currentComment of comments ) { + if ( currentComment.user.type === 'Bot' && currentComment.body.includes( 'Test using WordPress Playground' ) ) { + return; + } + }; + + // No comment was found. Create one. + commentInfo.body = `## Test using WordPress Playground + The changes in this pull request can previewed and tested using a [WordPress Playground](https://developer.wordpress.org/playground/) instance. + + [WordPress Playground](https://developer.wordpress.org/playground/) is an experimental project that creates a full WordPress instance entirely within the browser. + + ### Some things to be aware of + - The Plugin and Theme Directories cannot be accessed within Playground. + - All changes will be lost when closing a tab with a Playground instance. + - All changes will be lost when refreshing the page. + - A fresh instance is created each time the link below is clicked. + - Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, + it's possible that the most recent build failed, or has not completed. Check the [list of workflow runs to be sure](https://github.com/WordPress/wordpress-develop/actions/workflows/wordpress-playground.yml). + + For more details about these limitations and more, check out the [Limitations page](https://wordpress.github.io/wordpress-playground/limitations/) in the WordPress Playground documentation. + + [Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${ issue_number }). + `; + + github.rest.issues.createComment( commentInfo ); + + # Leaves a comment on a pull request when no Trac ticket is included in the pull request description. + trac-ticket-check: + name: Comment on a pull request when no Trac ticket is included + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' && ! github.event.pull_request.draft && github.event.pull_request.state == 'open' }} + steps: + - name: Check for Trac ticket and comment if missing + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const { owner, repo } = context.repo; + const { number } = context.issue; + + // Check for the presence of a comment and bail early. + const comments = ( await github.rest.issues.listComments( { owner, repo, issue_number: number } ) ).data; + + const hasMissingTicketComment = comments.some( comment => + comment.user.type === 'Bot' && comment.body.includes( 'Trac Ticket Missing' ) + ); + + if ( hasMissingTicketComment ) return; + + // No comment was found. Create one. + const pr = ( await github.rest.pulls.get( { owner, repo, pull_number: number } ) ).data; + + const prBody = pr.body ?? ''; + const prTitle = pr.title ?? ''; + + const tracTicketRegex = new RegExp( 'https?://core.trac.wordpress.org/ticket/([0-9]+)', 'g' ); + const tracTicketMatches = prBody.match( tracTicketRegex ) || prTitle.match( tracTicketRegex ); + + if ( ! tracTicketMatches ) { + github.rest.issues.createComment( { + owner, + repo, + issue_number: number, + body: `## Trac Ticket Missing + This pull request is missing a link to a [Trac ticket](https://core.trac.wordpress.org/). For a contribution to be considered, there must be a corresponding ticket in Trac. + + To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in [the Core Handbook](https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/). + `, + } ); + } From afab8f1fc495ecc371b591e8cf289b8ee0f13bd2 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 20 May 2024 17:02:26 -0400 Subject: [PATCH 17/26] Remove workflow. --- .github/workflows/pull-request-comments.yml | 212 -------------------- 1 file changed, 212 deletions(-) delete mode 100644 .github/workflows/pull-request-comments.yml diff --git a/.github/workflows/pull-request-comments.yml b/.github/workflows/pull-request-comments.yml deleted file mode 100644 index 189eb1c1737d0..0000000000000 --- a/.github/workflows/pull-request-comments.yml +++ /dev/null @@ -1,212 +0,0 @@ -# Responsible for making comments on pull requests, such as commenting for first time contributors. -name: Pull Request Comments - -on: - pull_request_target: - types: [ 'opened' ] - workflow_run: - workflows: [ 'Test Build Processes' ] - types: - - completed - -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.event_name == 'workflow_dispatch' && github.event.number || github.sha }} - -# Disable permissions for all available scopes by default. -# Any needed permissions should be configured at the job level. -permissions: {} - -jobs: - # Comments on a pull request when the author is a first time contributor. - post-welcome-message: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - timeout-minutes: 5 - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' }} - steps: - - name: Post a welcome comment - uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0 - with: - FIRST_PR_REACTIONS: 'hooray' - FIRST_PR_COMMENT: > - Hi @{{ author }}! 👋 - - - Thank you for your contribution to WordPress! 💖 - - - It looks like this is your first pull request to `wordpress-develop`. Here are a few things to be aware of that may help you out! - - - **No one monitors this repository for new pull requests.** Pull requests **must** be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. - - - **Pull requests are never merged on GitHub.** The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. - - - More information about how GitHub pull requests can be used to contribute to WordPress can be found in [the Core Handbook](https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/). - - - **Please include automated tests.** Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the [Automated Testing](https://make.wordpress.org/core/handbook/testing/automated-testing/) page in the handbook. - - - If you have not had a chance, please review the [Contribute with Code page](https://make.wordpress.org/core/handbook/contribute/) in the [WordPress Core Handbook](https://make.wordpress.org/core/handbook/). - - - The [Developer Hub](https://developer.wordpress.org/) also documents the various [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) that are followed: - - - [PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) - - - [CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/) - - - [HTML Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/html/) - - - [JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/) - - - [Accessibility Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/accessibility/) - - - [Inline Documentation Standards](https://developer.wordpress.org/coding-standards/inline-documentation-standards/) - - - Thank you, - - The WordPress Project - - # Leaves a comment on a pull request with a link to test the changes in a WordPress Playground instance. - playground-details: - name: Comment on a pull request with Playground details - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - if: > - github.repository == 'WordPress/wordpress-develop' && - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - steps: - - name: Download artifact - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - const artifacts = await github.rest.actions.listWorkflowRunArtifacts( { - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{ github.event.workflow_run.id }}, - } ); - - const matchArtifact = artifacts.data.artifacts.filter( ( artifact ) => { - return artifact.name === 'pr-number' - } )[0]; - - if ( ! matchArtifact ) { - core.setFailed( 'No artifact found!' ); - return; - } - - const download = await github.rest.actions.downloadArtifact( { - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - } ); - - const fs = require( 'fs' ); - fs.writeFileSync( '${{github.workspace}}/pr-number.zip', Buffer.from( download.data ) ) - - - name: Unzip the artifact containing the PR number - run: unzip pr-number.zip - - - name: Leave a comment about testing with Playground - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - const fs = require( 'fs' ); - const issue_number = Number( fs.readFileSync( './NR' ) ); - - // Comments are only added after the first successful build. Check for the presence of a comment and bail early. - const commentInfo = { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number, - }; - - const comments = ( await github.rest.issues.listComments( commentInfo ) ).data; - - for ( const currentComment of comments ) { - if ( currentComment.user.type === 'Bot' && currentComment.body.includes( 'Test using WordPress Playground' ) ) { - return; - } - }; - - // No comment was found. Create one. - commentInfo.body = `## Test using WordPress Playground - The changes in this pull request can previewed and tested using a [WordPress Playground](https://developer.wordpress.org/playground/) instance. - - [WordPress Playground](https://developer.wordpress.org/playground/) is an experimental project that creates a full WordPress instance entirely within the browser. - - ### Some things to be aware of - - The Plugin and Theme Directories cannot be accessed within Playground. - - All changes will be lost when closing a tab with a Playground instance. - - All changes will be lost when refreshing the page. - - A fresh instance is created each time the link below is clicked. - - Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, - it's possible that the most recent build failed, or has not completed. Check the [list of workflow runs to be sure](https://github.com/WordPress/wordpress-develop/actions/workflows/wordpress-playground.yml). - - For more details about these limitations and more, check out the [Limitations page](https://wordpress.github.io/wordpress-playground/limitations/) in the WordPress Playground documentation. - - [Test this pull request with WordPress Playground](https://playground.wordpress.net/wordpress.html?pr=${ issue_number }). - `; - - github.rest.issues.createComment( commentInfo ); - - # Leaves a comment on a pull request when no Trac ticket is included in the pull request description. - trac-ticket-check: - name: Comment on a pull request when no Trac ticket is included - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request_target' && ! github.event.pull_request.draft && github.event.pull_request.state == 'open' }} - steps: - - name: Check for Trac ticket and comment if missing - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - const { owner, repo } = context.repo; - const { number } = context.issue; - - // Check for the presence of a comment and bail early. - const comments = ( await github.rest.issues.listComments( { owner, repo, issue_number: number } ) ).data; - - const hasMissingTicketComment = comments.some( comment => - comment.user.type === 'Bot' && comment.body.includes( 'Trac Ticket Missing' ) - ); - - if ( hasMissingTicketComment ) return; - - // No comment was found. Create one. - const pr = ( await github.rest.pulls.get( { owner, repo, pull_number: number } ) ).data; - - const prBody = pr.body ?? ''; - const prTitle = pr.title ?? ''; - - const tracTicketRegex = new RegExp( 'https?://core.trac.wordpress.org/ticket/([0-9]+)', 'g' ); - const tracTicketMatches = prBody.match( tracTicketRegex ) || prTitle.match( tracTicketRegex ); - - if ( ! tracTicketMatches ) { - github.rest.issues.createComment( { - owner, - repo, - issue_number: number, - body: `## Trac Ticket Missing - This pull request is missing a link to a [Trac ticket](https://core.trac.wordpress.org/). For a contribution to be considered, there must be a corresponding ticket in Trac. - - To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in [the Core Handbook](https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/). - `, - } ); - } From e47f4ea64f9a580bcce072589880c0c95b3dd7db Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 20 May 2024 17:07:23 -0400 Subject: [PATCH 18/26] Add missing logic for Playground links. --- .github/workflows/test-build-processes.yml | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 88d091a2b62e6..60ee1dbbc9791 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -79,6 +79,29 @@ jobs: directory: ${{ matrix.directory }} test-emoji: false + # Uploads the PR number as an artifact for the Pull Request Commenting workflow to download and then + # leave a comment detailing how to test the PR within WordPress Playground. + playground-comment: + name: Leave WordPress Playground details + runs-on: ubuntu-latest + permissions: + actions: write + continue-on-error: true + needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }} + + steps: + - name: Save PR number + run: | + mkdir -p ./pr-number + echo ${{ github.event.number }} > ./pr-number/NR + + - name: Upload PR number as artifact + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: pr-number + path: pr-number/ + slack-notifications: name: Slack Notifications uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk From a6fe518eab6e82db7ef852e052c1913e66d50121 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 20 May 2024 17:08:05 -0400 Subject: [PATCH 19/26] Fix syntax error. --- .github/workflows/test-build-processes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 60ee1dbbc9791..672cff67c5735 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -87,7 +87,7 @@ jobs: permissions: actions: write continue-on-error: true - needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ] + needs: [ test-core-build-process, test-core-build-process-macos ] if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }} steps: From 5e5c1f1bbc957483567d86b9965561ec83f6e7f9 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 29 May 2024 13:00:39 -0400 Subject: [PATCH 20/26] Pass PHP version as an input. --- .github/workflows/performance.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 9244fc84cb6be..0a5acb0dc668e 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -37,6 +37,8 @@ jobs: permissions: contents: read if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} + with: + php-version: '8.2' slack-notifications: name: Slack Notifications From 9362af4facff278078d0cb962abe6862a5abd9b4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 29 May 2024 13:01:09 -0400 Subject: [PATCH 21/26] Use the test workflow. --- .github/workflows/performance.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 0a5acb0dc668e..07ca7385e03b0 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -33,7 +33,7 @@ jobs: # Runs the performance test suite. performance: name: Run performance tests - uses: WordPress/wordpress-develop/.github/workflows/reusable-performance.yml@trunk + uses: desrosj/wordpress-develop/.github/workflows/reusable-performance.yml@try/php-version-input-performance-workflow permissions: contents: read if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} From e1bd5c8202e827332f6517a71540fe76496bad82 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 29 May 2024 13:42:17 -0400 Subject: [PATCH 22/26] Use test workflow. --- .github/workflows/test-build-processes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 672cff67c5735..1262beab930b9 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -41,7 +41,7 @@ jobs: # Tests the WordPress Core build process on multiple operating systems. test-core-build-process: name: Core running from ${{ matrix.directory }} - uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk + uses: desrosj/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@try/php-version-input-performance-workflow permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} From 6f74a92979e5054edcf9ac7a94ac306924c6b3d1 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 29 May 2024 13:47:47 -0400 Subject: [PATCH 23/26] Switch back to the default workflow. --- .github/workflows/test-build-processes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 1262beab930b9..672cff67c5735 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -41,7 +41,7 @@ jobs: # Tests the WordPress Core build process on multiple operating systems. test-core-build-process: name: Core running from ${{ matrix.directory }} - uses: desrosj/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@try/php-version-input-performance-workflow + uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk permissions: contents: read if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} From b6a50495278f8200dae0896f465968414c5dc6a3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 31 May 2024 10:37:20 -0400 Subject: [PATCH 24/26] Include the rest of [57918]. --- tools/local-env/scripts/docker.js | 2 +- tools/local-env/scripts/install.js | 6 +++--- tools/local-env/scripts/start.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/local-env/scripts/docker.js b/tools/local-env/scripts/docker.js index fed70aeb59612..693de37696d87 100644 --- a/tools/local-env/scripts/docker.js +++ b/tools/local-env/scripts/docker.js @@ -5,4 +5,4 @@ const { execSync } = require( 'child_process' ); dotenvExpand.expand( dotenv.config() ); // Execute any docker-compose command passed to this script. -execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } ); +execSync( 'docker compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } ); diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index e8a448c8c9d8c..891d43cc42cab 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -46,7 +46,7 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } ) * @param {string} cmd The WP-CLI command to run. */ function wp_cli( cmd ) { - execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } ); + execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } ); } /** @@ -55,6 +55,6 @@ function wp_cli( cmd ) { function install_wp_importer() { const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer'; - execSync( `docker-compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); - execSync( `docker-compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); } diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index df27a67a6218f..b929dce0b69a8 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -19,7 +19,7 @@ try { const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) ? 'wordpress-develop memcached' : 'wordpress-develop'; -execSync( `docker-compose up -d ${containers}`, { stdio: 'inherit' } ); +execSync( `docker compose up -d ${containers}`, { stdio: 'inherit' } ); // If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM. if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) { From c6f224eb2500c38fde22324ae565b60c39116cf3 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 31 May 2024 12:10:33 -0400 Subject: [PATCH 25/26] Switch back to workflow in `trunk`. --- .github/workflows/performance.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 07ca7385e03b0..0a5acb0dc668e 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -33,7 +33,7 @@ jobs: # Runs the performance test suite. performance: name: Run performance tests - uses: desrosj/wordpress-develop/.github/workflows/reusable-performance.yml@try/php-version-input-performance-workflow + uses: WordPress/wordpress-develop/.github/workflows/reusable-performance.yml@trunk permissions: contents: read if: ${{ ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) && ! contains( github.event.before, '00000000' ) }} From c7427d941b6e80729d466dc9c1e3e4ff9e72bc38 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 31 May 2024 14:17:01 -0400 Subject: [PATCH 26/26] Rely on reusable logic for playground commenting. --- .github/workflows/test-build-processes.yml | 29 +++++----------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 672cff67c5735..7690e6b3ade20 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -50,9 +50,15 @@ jobs: matrix: os: [ ubuntu-latest, windows-latest ] directory: [ 'src', 'build' ] + include: + # Only prepare artifacts for Playground once. + - os: ubuntu-latest + directory: 'build' + prepare-playground: true with: os: ${{ matrix.os }} directory: ${{ matrix.directory }} + prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }} test-emoji: false # Tests the WordPress Core build process on MacOS. @@ -79,29 +85,6 @@ jobs: directory: ${{ matrix.directory }} test-emoji: false - # Uploads the PR number as an artifact for the Pull Request Commenting workflow to download and then - # leave a comment detailing how to test the PR within WordPress Playground. - playground-comment: - name: Leave WordPress Playground details - runs-on: ubuntu-latest - permissions: - actions: write - continue-on-error: true - needs: [ test-core-build-process, test-core-build-process-macos ] - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name == 'pull_request' }} - - steps: - - name: Save PR number - run: | - mkdir -p ./pr-number - echo ${{ github.event.number }} > ./pr-number/NR - - - name: Upload PR number as artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: pr-number - path: pr-number/ - slack-notifications: name: Slack Notifications uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk