Make WordPress Core


Ignore:
Timestamp:
03/07/2023 07:36:29 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Backport updates to GitHub Actions.

This backports several changesets to GitHub Actions workflows. These changesets:

  • address the deprecated notices related to save-output and set-output to ensure the workflows continue to run after these are removed.
  • adds support for automatically retrying a failed workflow once.
  • backports some Docker environment related tooling updates for the sake of consistency across branches.

Merges [53628], [53636], [53736], [53737], [53895], [53940], [53947], [54039], [54096], [54108], [54293], [54297], [54313], [54342], [54343], [54371], [54373], [54511], [54649], [54650], [54674], [54678], [54750], [54851], [54852], [54856], [54921], [55152] to the 6.0 branch.
See 55702, #52708, #55652, #55652, #55700, #55652, #56407, #56407, #56528, #55652, #55652, #55652, #54695, #55652, #55652, #55652, #55652, #56820, #56820, #56816, #55652, #55652, #56820, #56793, #56793, #53841, #57148, #57572, #56682.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0/.github/workflows/phpunit-tests.yml

    r53595 r55482  
    4040  # Performs the following steps:
    4141  # - Sets environment variables.
    42   # - Sets up the environment variables needed for testing with memcached (if desired).
    43   # - Installs NodeJS.
    44   # - Installs NPM dependencies
    45   # - Configures caching for Composer.
     42  # - Checks out the repository.
     43  # - Sets up Node.js.
     44  # - Sets up PHP.
    4645  # - Installs Composer dependencies.
     46  # - Installs npm dependencies
     47  # - Logs general debug information about the runner.
    4748  # - Logs Docker debug information (about the Docker installation within the runner).
    4849  # - Starts the WordPress Docker container.
    49   # - Starts the Memcached server after the Docker network has been created (if desired).
    50   # - Logs general debug information about the runner.
    5150  # - Logs the running Docker containers.
    52   # - Logs debug information from inside the WordPress Docker container.
    5351  # - Logs debug information about what's installed within the WordPress Docker containers.
    5452  # - Install WordPress within the Docker container.
     
    5654  # - Ensures version-controlled files are not modified or deleted.
    5755  # - Checks out the WordPress Test reporter repository.
    58   # - Reconnect the directory to the Git repository.
    5956  # - Submit the test results to the WordPress.org host test results.
    6057  test-php:
     
    111108
    112109      - name: Checkout repository
    113         uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
    114 
    115       - name: Install NodeJS
    116         uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
     110        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
     111
     112      - name: Set up Node.js
     113        uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
    117114        with:
    118115          node-version-file: '.nvmrc'
    119116          cache: npm
    120117
    121       - name: Install Dependencies
     118      ##
     119      # This allows Composer dependencies to be installed using a single step.
     120      #
     121      # Since the tests are currently run within the Docker containers where the PHP version varies,
     122      # the same PHP version needs to be configured for the action runner machine so that the correct
     123      # dependency versions are installed and cached.
     124      ##
     125      - name: Set up PHP
     126        uses: shivammathur/setup-php@8e2ac35f639d3e794c1da1f28999385ab6fdf0fc # v2.23.0
     127        with:
     128          php-version: '${{ matrix.php }}'
     129          coverage: none
     130
     131      # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
     132      # passing a custom cache suffix ensures that the cache is flushed at least once per week.
     133      - name: Install Composer dependencies
     134        uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
     135        with:
     136          custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
     137
     138      - name: Install npm dependencies
    122139        run: npm ci
    123 
    124       # This date is used to ensure that the Composer cache is refreshed at least once every week.
    125       # http://man7.org/linux/man-pages/man1/date.1.html
    126       - name: "Get last Monday's date"
    127         id: get-date
    128         run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")"
    129 
    130       - name: Get Composer cache directory
    131         id: composer-cache
    132         run: echo "::set-output name=dir::$(composer config cache-files-dir)"
    133 
    134       - name: Cache Composer dependencies
    135         uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
    136         env:
    137           cache-name: cache-composer-dependencies
    138         with:
    139           path: ${{ steps.composer-cache.outputs.dir }}
    140           key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
    141 
    142       - name: Install Composer dependencies
    143         run: |
    144           docker-compose run --rm php composer --version
    145 
    146           # Install using `composer update` as there is no `composer.lock` file.
    147           if [ ${{ env.LOCAL_PHP }} == '8.1-fpm' ]; then
    148             docker-compose run --rm php composer update --ignore-platform-reqs
    149           else
    150             docker-compose run --rm php composer update
    151           fi
    152 
    153       - name: Docker debug information
    154         run: |
    155           docker -v
    156           docker-compose -v
    157 
    158       - name: Start Docker environment
    159         run: |
    160           npm run env:start
    161 
    162       # The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
    163       - name: Start the Memcached server.
    164         if: ${{ matrix.memcached }}
    165         run: |
    166           cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    167           docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
    168140
    169141      - name: General debug information
     
    174146          git --version
    175147          svn --version
     148          composer --version
     149          locale -a
     150
     151      - name: Docker debug information
     152        run: |
     153          docker -v
     154          docker-compose -v
     155
     156      - name: Start Docker environment
     157        run: |
     158          npm run env:start
    176159
    177160      - name: Log running Docker containers
     
    232215      - name: Checkout the WordPress Test Reporter
    233216        if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
    234         uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
     217        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
    235218        with:
    236219          repository: 'WordPress/phpunit-test-runner'
     
    255238      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    256239      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     240
     241  failed-workflow:
     242    name: Failed workflow tasks
     243    runs-on: ubuntu-latest
     244    needs: [ test-php, slack-notifications ]
     245    if: |
     246      always() &&
     247      github.repository == 'WordPress/wordpress-develop' &&
     248      github.event_name != 'pull_request' &&
     249      github.run_attempt < 2 &&
     250      (
     251        needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
     252      )
     253
     254    steps:
     255      - name: Dispatch workflow run
     256        uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
     257        with:
     258          retries: 2
     259          retry-exempt-status-codes: 418
     260          script: |
     261            github.rest.actions.createWorkflowDispatch({
     262              owner: context.repo.owner,
     263              repo: context.repo.repo,
     264              workflow_id: 'failed-workflow.yml',
     265              ref: 'trunk',
     266              inputs: {
     267                run_id: '${{ github.run_id }}'
     268              }
     269            });
Note: See TracChangeset for help on using the changeset viewer.