Make WordPress Core


Ignore:
Timestamp:
06/30/2022 04:26:30 PM (4 years 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.

Merges [51921], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.8 branch.
See #56095.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

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

    r51889 r53597  
    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]'
     
    4038  #
    4139  # Performs the following steps:
    42   # - Set environment variables.
     40  # - Sets environment variables.
    4341  # - Sets up the environment variables needed for testing with memcached (if desired).
    44   # - Installs NodeJS 14.
     42  # - Installs NodeJS.
    4543  # - Sets up caching for NPM.
    4644  # - Installs NPM dependencies
    4745  # - Configures caching for Composer.
    48   # - Installs Composer dependencies (if desired).
    49   # - Logs Docker debug information (about both the Docker installation within the runner).
     46  # - Installs Composer dependencies.
     47  # - Logs Docker debug information (about the Docker installation within the runner).
    5048  # - Starts the WordPress Docker container.
    51   # - Starts the memcached server after the Docker network has been created (if desired).
    52   # - Logs WordPress Docker container debug information.
    53   # - Logs debug general information.
     49  # - Starts the Memcached server after the Docker network has been created (if desired).
     50  # - Logs general debug information about the runner.
    5451  # - Logs the running Docker containers.
     52  # - Logs debug information from inside the WordPress Docker container.
    5553  # - Logs debug information about what's installed within the WordPress Docker containers.
    5654  # - Install WordPress within the Docker container.
     
    6058  # - Reconnect the directory to the Git repository.
    6159  # - Submit the test results to the WordPress.org host test results.
    62   # - todo: Configure Slack notifications for failing tests.
    6360  test-php:
    6461    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
    6562    runs-on: ${{ matrix.os }}
     63    timeout-minutes: 20
    6664    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    6765    strategy:
     
    112110
    113111      - name: Checkout repository
    114         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     112        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    115113
    116114      - name: Install NodeJS
    117         uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
     115        uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
    118116        with:
    119           node-version: 14
    120 
    121       - name: Use cached Node modules
    122         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
    123         env:
    124           cache-name: cache-node-modules
    125         with:
    126           # npm cache files are stored in `~/.npm` on Linux/macOS
    127           path: ~/.npm
    128           key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
     117          node-version-file: '.nvmrc'
     118          cache: npm
    129119
    130120      - name: Install Dependencies
     
    136126
    137127      - name: Cache Composer dependencies
    138         uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
     128        uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
    139129        env:
    140130          cache-name: cache-composer-dependencies
     
    238228
    239229      - name: Checkout the WordPress Test Reporter
    240         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
    241         uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
     230        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
     231        uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    242232        with:
    243233          repository: 'WordPress/phpunit-test-runner'
     
    245235
    246236      - name: Submit test results to the WordPress.org host test results
    247         if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
     237        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    248238        env:
    249239          WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    250240        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
     241
     242  slack-notifications:
     243    name: Slack Notifications
     244    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
     245    needs: [ test-php ]
     246    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     247    with:
     248      calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
     249    secrets:
     250      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     251      SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
     252      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
     253      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
Note: See TracChangeset for help on using the changeset viewer.