From ae13cba729294adb1b46be51d5f0315ae549c075 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 30 Jun 2022 16:26:30 +0000 Subject: [PATCH] Build/Test Tools: Use the Slack notifications workflow as a reusable one. This backports several changesets that are required to remove the reliance on the `workflow_run` event for posting Slack notifications. The Slack notification workflow will now be called as a reusable one, which has several benefits (see [53591]). Several other minor GitHub Actions related updates are also being backported in this commit to maintain tooling consistency across branches that still receive security updates as a courtesy when necessary. Merges [51921], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.8 branch. See #56095. git-svn-id: https://develop.svn.wordpress.org/branches/5.8@53597 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/coding-standards.yml | 46 ++++++------ .github/workflows/end-to-end-tests.yml | 43 +++++------ .github/workflows/javascript-tests.yml | 39 +++++----- .github/workflows/php-compatibility.yml | 26 +++++-- .github/workflows/phpunit-tests.yml | 55 +++++++------- .github/workflows/test-npm.yml | 72 ++++++++----------- .../workflows/welcome-new-contributors.yml | 1 + 7 files changed, 149 insertions(+), 133 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 21289ffacd..06dadb06ea 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -5,7 +5,6 @@ on: # PHPCS checking was introduced in WordPress 5.1. push: branches: - - master - trunk - '3.[89]' - '[4-9].[0-9]' @@ -14,7 +13,6 @@ on: - '[4-9].[0-9]*' pull_request: branches: - - master - trunk - '3.[89]' - '[4-9].[0-9]' @@ -60,14 +58,15 @@ jobs: phpcs: name: PHP coding standards runs-on: ubuntu-latest + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Set up PHP - uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0 + uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1 with: php-version: '7.4' coverage: none @@ -79,7 +78,7 @@ jobs: composer --version - name: Install Composer dependencies - uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0 + uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0 with: composer-options: "--no-progress --no-ansi --no-interaction" @@ -104,24 +103,24 @@ jobs: # # Performs the following steps: # - Checks out the repository. - # - Logs debug information about the runner container. - # - Installs NodeJS 14. + # - Logs debug information about the GitHub Action runner. + # - Installs NodeJS. # - Sets up caching for NPM. # - Logs updated debug information. - # _ Installs NPM dependencies using install-changed to hash the `package.json` file. + # _ Installs NPM dependencies. # - Run the WordPress JSHint checks. # - Ensures version-controlled files are not modified or deleted. - # - todo: Configure Slack notifications for failing tests. jshint: name: JavaScript coding standards runs-on: ubuntu-latest + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Log debug information run: | @@ -131,18 +130,10 @@ jobs: svn --version - name: Install NodeJS - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 with: - node-version: 14 - - - name: Cache NodeJS modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + node-version-file: '.nvmrc' + cache: npm - name: Log debug information run: | @@ -157,3 +148,16 @@ jobs: - 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 + needs: [ phpcs, jshint ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }} + 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 }} diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index e7c3b2b14c..47d8caa8c1 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -1,10 +1,9 @@ name: End-to-end Tests on: - # The end to end test suite was introduced in WordPress 5.3. + # The end-to-end test suite was introduced in WordPress 5.3. push: branches: - - master - trunk - '5.[3-9]' - '[6-9].[0-9]' @@ -13,7 +12,6 @@ on: - '[6-9].[0-9]*' pull_request: branches: - - master - trunk - '5.[3-9]' - '[6-9].[0-9]' @@ -33,12 +31,12 @@ jobs: # Runs the end-to-end test suite. # # Performs the following steps: - # - Set environment variables. + # - Sets environment variables. # - Checks out the repository. - # - Logs debug information about the runner container. - # - Installs NodeJS 14. + # - Logs debug information about the GitHub Action runner. + # - Installs NodeJS. # - Sets up caching for NPM. - # _ Installs NPM dependencies using install-changed to hash the `package.json` file. + # _ Installs NPM dependencies. # - Builds WordPress to run from the `build` directory. # - Starts the WordPress Docker container. # - Logs general debug information. @@ -47,10 +45,10 @@ jobs: # - Install WordPress within the Docker container. # - Run the E2E tests. # - Ensures version-controlled files are not modified or deleted. - # - todo: Configure Slack notifications for failing tests. e2e-tests: name: E2E Tests runs-on: ubuntu-latest + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} steps: @@ -60,7 +58,7 @@ jobs: echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Log debug information run: | @@ -74,18 +72,10 @@ jobs: locale -a - name: Install NodeJS - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 with: - node-version: 14 - - - name: Cache NodeJS modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + node-version-file: '.nvmrc' + cache: npm - name: Install Dependencies run: npm ci @@ -126,3 +116,16 @@ jobs: - 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 + needs: [ e2e-tests ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }} + 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 }} diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index fa420137ee..f13a5d42e7 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -4,7 +4,6 @@ on: # JavaScript testing was introduced in WordPress 3.8. push: branches: - - master - trunk - '3.[89]' - '[4-9].[0-9]' @@ -13,7 +12,6 @@ on: - '[4-9].[0-9]*' pull_request: branches: - - master - trunk - '3.[89]' - '[4-9].[0-9]' @@ -44,22 +42,22 @@ jobs: # # Performs the following steps: # - Checks out the repository. - # - Logs debug information about the runner container. - # - Installs NodeJS 14. + # - Logs debug information about the GitHub Action runner. + # - Installs NodeJS. # - Sets up caching for NPM. # - Logs updated debug information. - # _ Installs NPM dependencies using install-changed to hash the `package.json` file. + # _ Installs NPM dependencies. # - Run the WordPress QUnit tests. # - Ensures version-controlled files are not modified or deleted. - # - todo: Configure Slack notifications for failing tests. test-js: name: QUnit Tests runs-on: ubuntu-latest + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Log debug information run: | @@ -69,18 +67,10 @@ jobs: svn --version - name: Install NodeJS - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 with: - node-version: 14 - - - name: Cache NodeJS modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + node-version-file: '.nvmrc' + cache: npm - name: Log debug information run: | @@ -95,3 +85,16 @@ jobs: - 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 + needs: [ test-js ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }} + 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 }} diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index cb6409d954..97c211e9df 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -4,7 +4,6 @@ on: # PHP compatibility testing was introduced in WordPress 5.5. push: branches: - - master - trunk - '5.[5-9]' - '[6-9].[0-9]' @@ -13,7 +12,6 @@ on: - '[6-9].[0-9]*' pull_request: branches: - - master - trunk - '5.[5-9]' - '[6-9].[0-9]' @@ -44,24 +42,25 @@ jobs: # Performs the following steps: # - Checks out the repository. # - Sets up PHP. - # - Logs debug information about the runner container. + # - Logs debug information about the GitHub Action runner. # - Installs Composer dependencies (use cache if possible). # - Make Composer packages available globally. # - Logs PHP_CodeSniffer debug information. # - Runs the PHP compatibility tests. # - Ensures version-controlled files are not modified or deleted. # - todo: Configure Slack notifications for failing scans. - php-comatibility: + php-compatibility: name: Check PHP compatibility runs-on: ubuntu-latest + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Set up PHP - uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0 + uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1 with: php-version: '7.4' coverage: none @@ -73,7 +72,7 @@ jobs: composer --version - name: Install Composer dependencies - uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0 + uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0 with: composer-options: "--no-progress --no-ansi --no-interaction" @@ -88,3 +87,16 @@ jobs: - 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 + needs: [ php-compatibility ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ needs.php-compatibility.result == 'success' && 'success' || needs.php-compatibility.result == 'cancelled' && 'cancelled' || 'failure' }} + 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 }} diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index cd80a7fcf9..9d0e61afee 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -3,7 +3,6 @@ name: PHPUnit Tests on: push: branches: - - master - trunk - '3.[7-9]' - '[4-9].[0-9]' @@ -12,7 +11,6 @@ on: - '[4-9].[0-9]*' pull_request: branches: - - master - trunk - '3.[7-9]' - '[4-9].[0-9]' @@ -39,19 +37,19 @@ jobs: # Runs the PHPUnit tests for WordPress. # # Performs the following steps: - # - Set environment variables. + # - Sets environment variables. # - Sets up the environment variables needed for testing with memcached (if desired). - # - Installs NodeJS 14. + # - Installs NodeJS. # - Sets up caching for NPM. # - Installs NPM dependencies # - Configures caching for Composer. - # - Installs Composer dependencies (if desired). - # - Logs Docker debug information (about both the Docker installation within the runner). + # - Installs Composer dependencies. + # - Logs Docker debug information (about the Docker installation within the runner). # - Starts the WordPress Docker container. - # - Starts the memcached server after the Docker network has been created (if desired). - # - Logs WordPress Docker container debug information. - # - Logs debug general information. + # - Starts the Memcached server after the Docker network has been created (if desired). + # - Logs general debug information about the runner. # - Logs the running Docker containers. + # - Logs debug information from inside the WordPress Docker container. # - Logs debug information about what's installed within the WordPress Docker containers. # - Install WordPress within the Docker container. # - Run the PHPUnit tests. @@ -59,10 +57,10 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Reconnect the directory to the Git repository. # - Submit the test results to the WordPress.org host test results. - # - todo: Configure Slack notifications for failing tests. test-php: name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} strategy: fail-fast: false @@ -111,21 +109,13 @@ jobs: echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Install NodeJS - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 with: - node-version: 14 - - - name: Use cached Node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + node-version-file: '.nvmrc' + cache: npm - name: Install Dependencies run: npm ci @@ -135,7 +125,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer dependencies - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4 env: cache-name: cache-composer-dependencies with: @@ -237,14 +227,27 @@ jobs: run: git diff --exit-code - name: Checkout the WordPress Test Reporter - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 with: repository: 'WordPress/phpunit-test-runner' path: 'test-runner' - name: Submit test results to the WordPress.org host test results - if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.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 + + slack-notifications: + name: Slack Notifications + uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk + needs: [ test-php ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }} + 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 }} diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml index 71d5e3775b..e4ee37f2ac 100644 --- a/.github/workflows/test-npm.yml +++ b/.github/workflows/test-npm.yml @@ -3,13 +3,11 @@ name: Test NPM on: push: branches: - - master - trunk - '3.[7-9]' - '[4-9].[0-9]' pull_request: branches: - - master - trunk - '3.[7-9]' - '[4-9].[0-9]' @@ -40,10 +38,10 @@ jobs: # # Performs the following steps: # - Checks out the repository. - # - Logs debug information about the runner container. - # - Installs NodeJS 14. + # - Logs debug information about the GitHub Action runner. + # - Installs NodeJS. # - Sets up caching for NPM. - # _ Installs NPM dependencies using install-changed to hash the `package.json` file. + # _ 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. @@ -53,6 +51,7 @@ jobs: test-npm: name: Test NPM on ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} strategy: fail-fast: false @@ -61,7 +60,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Log debug information run: | @@ -72,28 +71,10 @@ jobs: svn --version - name: Install NodeJS - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 with: - node-version: 14 - - - name: Cache NodeJS modules (Ubuntu & MacOS) - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - if: ${{ matrix.os != 'windows-latest' }} - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Get NPM cache directory (Windows only) - if: ${{ matrix.os == 'windows-latest' }} - id: npm-cache - run: echo "::set-output name=dir::$(npm config get cache)" - - - name: Cache NodeJS modules (Windows only) - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - if: ${{ matrix.os == 'windows-latest' }} - with: - path: ${{ steps.npm-cache.outputs.dir }} - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + node-version-file: '.nvmrc' + cache: npm - name: Install Dependencies run: npm ci @@ -118,14 +99,15 @@ jobs: # Verifies that installing NPM dependencies and building WordPress works as expected on MacOS. # - # This is a separate job in order to that more strict conditions can be used. + # 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. # # Performs the following steps: # - Checks out the repository. - # - Logs debug information about the runner container. - # - Installs NodeJS 14. + # - Logs debug information about the GitHub Action runner. + # - Installs NodeJS. # - Sets up caching for NPM. - # _ Installs NPM dependencies using install-changed to hash the `package.json` file. + # _ 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. @@ -135,10 +117,11 @@ jobs: test-npm-macos: name: Test NPM on MacOS runs-on: macos-latest + timeout-minutes: 20 if: ${{ github.repository == 'WordPress/wordpress-develop' }} steps: - name: Checkout repository - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - name: Log debug information run: | @@ -149,16 +132,10 @@ jobs: svn --version - name: Install NodeJS - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 with: - node-version: 14 - - - name: Cache NodeJS modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - if: ${{ matrix.os != 'windows-latest' }} - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + node-version-file: '.nvmrc' + cache: npm - name: Install Dependencies run: npm ci @@ -180,3 +157,16 @@ jobs: - 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 + needs: [ test-npm, test-npm-macos ] + if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} + with: + calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }} + 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 }} diff --git a/.github/workflows/welcome-new-contributors.yml b/.github/workflows/welcome-new-contributors.yml index f475a432a0..44ddf0b02d 100644 --- a/.github/workflows/welcome-new-contributors.yml +++ b/.github/workflows/welcome-new-contributors.yml @@ -8,6 +8,7 @@ jobs: # Comments on a pull request when the author is a new contributor. post-welcome-message: runs-on: ubuntu-latest + timeout-minutes: 5 if: ${{ github.repository == 'WordPress/wordpress-develop' }} steps: