Make WordPress Core


Ignore:
Timestamp:
06/30/2022 05:03:58 PM (22 months ago)
Author:
desrosj
Message:

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.

Workflows that are not relevant to this branch that were mistakenly backported are also being deleted.

Merges [50473], [50704], [50796], [50930], [51341], [51355], [51498], [51511], [51535], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.0 branch.
See #56095.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/.github/workflows/phpunit-tests.yml

    r50624 r53608  
    44  push:
    55    branches:
    6       - master
    76      - trunk
    87      - '3.[7-9]'
     
    1312  pull_request:
    1413    branches:
    15       - master
    1614      - trunk
    1715      - '3.[7-9]'
     
    2119  schedule:
    2220    - cron: '0 0 * * 0'
     21
     22# Cancels all previous workflow runs for pull requests that have not completed.
     23concurrency:
     24    # The concurrency group contains the workflow name and the branch name for pull requests
     25    # or the commit hash for any other events.
     26  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
     27  cancel-in-progress: true
    2328
    2429env:
     
    3742  # - Cancels all previous workflow runs for pull requests that have not completed.
    3843  # - Checks out the repository.
    39   # - Logs debug information about the runner container.
    40   # - Installs NodeJS 14.
    41   # - Sets up caching for NPM.
    42   # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     44  # - Logs debug information about the GitHub Action runner.
     45  # - Installs NodeJS.
     46  # _ Installs NPM dependencies.
    4347  # - Builds WordPress to run from the `build` directory.
    4448  # - Creates a ZIP file of compiled WordPress.
     
    5054
    5155    steps:
    52       - name: Cancel previous runs of this workflow (pull requests only)
    53         if: ${{ github.event_name == 'pull_request' }}
    54         uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
    55 
    5656      - name: Checkout repository
    57         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     57        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    5858
    5959      - name: Log debug information
     
    7171
    7272      - name: Install NodeJS
    73         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
    74         with:
    75           node-version: 14
    76 
    77       - name: Cache NodeJS modules
    78         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    79         env:
    80           cache-name: cache-node-modules
    81         with:
    82           # npm cache files are stored in `~/.npm` on Linux/macOS
    83           path: ~/.npm
    84           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     73        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
     74        with:
     75          node-version-file: '.nvmrc'
     76          cache: npm
    8577
    8678      - name: Install Dependencies
     
    9183
    9284      - name: Create ZIP artifact
    93         uses: thedoctor0/zip-release@a1afcab9c664c9976ac398fa831eac67bed1eb0e # v0.4.1
     85        uses: thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 # v0.6.2
    9486        with:
    9587          filename: built-wp-${{ github.sha }}.zip
     
    9789
    9890      - name: Upload build artifact
    99         uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
     91        uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
    10092        with:
    10193          name: built-wp-${{ github.sha }}
     
    10698  #
    10799  # Performs the following steps:
    108   # - Set environment variables.
     100  # - Sets environment variables.
    109101  # - Sets up the environment variables needed for testing with memcached (if desired).
    110102  # - Downloads the built WordPress artifact from the previous job.
    111103  # - Unzips the artifact.
    112   # - Installs NodeJS 14.
    113   # - Sets up caching for NPM.
    114   # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
     104  # - Installs NodeJS.
     105  # _ Installs NPM dependencies.
    115106  # - Configures caching for Composer.
    116107  # _ Installs Composer dependencies (if desired).
    117   # - Logs Docker debug information (about both the Docker installation within the runner).
     108  # - Logs Docker debug information (about the Docker installation within the runner).
    118109  # - Starts the WordPress Docker container.
    119   # - Starts the memcached server after the Docker network has been created (if desired).
    120   # - Logs WordPress Docker container debug information.
    121   # - Logs debug general information.
     110  # - Starts the Memcached server after the Docker network has been created (if desired).
     111  # - Logs general debug information about the runner.
    122112  # - Logs the running Docker containers.
     113  # - Logs debug information from inside the WordPress Docker container.
    123114  # - Logs debug information about what's installed within the WordPress Docker containers.
    124115  # - Install WordPress within the Docker container.
     
    127118  # - Reconnect the directory to the Git repository.
    128119  # - Submit the test results to the WordPress.org host test results.
    129   # - todo: Configure Slack notifications for failing tests.
    130120  test-php:
    131     name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
     121    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    132122    needs: setup-wordpress
    133123    runs-on: ${{ matrix.os }}
     124    timeout-minutes: 20
    134125    strategy:
    135126      fail-fast: false
     
    242233
    243234      - name: Download the built WordPress artifact
    244         uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8
     235        uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0
    245236        with:
    246237          name: built-wp-${{ github.sha }}
     
    250241
    251242      - name: Install NodeJS
    252         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
    253         with:
    254           node-version: 14
    255 
    256       - name: Use cached Node modules
    257         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    258         env:
    259           cache-name: cache-node-modules
    260         with:
    261           # npm cache files are stored in `~/.npm` on Linux/macOS
    262           path: ~/.npm
    263           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     243        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
     244        with:
     245          node-version-file: '.nvmrc'
     246          cache: npm
    264247
    265248      - name: Install Dependencies
     
    268251      - name: Cache Composer dependencies
    269252        if: ${{ env.COMPOSER_INSTALL == true }}
    270         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
     253        uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
    271254        env:
    272255          cache-name: cache-composer-dependencies
     
    348331
    349332      - name: Checkout the WordPress Test Reporter
    350         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
    351         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     333        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
     334        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    352335        with:
    353336          repository: 'WordPress/phpunit-test-runner'
     
    355338
    356339      - name: Set up the Git repository
    357         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
     340        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    358341        run: |
    359342          git init
    360343          git remote add origin https://github.com/WordPress/wordpress-develop.git
    361344          git fetch
    362           git reset origin/master
     345          git reset origin/trunk
    363346
    364347      - name: Submit test results to the WordPress.org host test results
    365         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
     348        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    366349        env:
    367350          WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    368351        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
     352
     353  slack-notifications:
     354    name: Slack Notifications
     355    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     356    needs: [ setup-wordpress, test-php ]
     357    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     358    with:
     359      calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
     360    secrets:
     361      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     362      SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
     363      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
     364      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
Note: See TracChangeset for help on using the changeset viewer.