Changeset 55482 for branches/6.0/.github/workflows/phpunit-tests.yml
- Timestamp:
- 03/07/2023 07:36:29 PM (3 years ago)
- File:
-
- 1 edited
-
branches/6.0/.github/workflows/phpunit-tests.yml (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0/.github/workflows/phpunit-tests.yml
r53595 r55482 40 40 # Performs the following steps: 41 41 # - 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. 46 45 # - Installs Composer dependencies. 46 # - Installs npm dependencies 47 # - Logs general debug information about the runner. 47 48 # - Logs Docker debug information (about the Docker installation within the runner). 48 49 # - 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.51 50 # - Logs the running Docker containers. 52 # - Logs debug information from inside the WordPress Docker container.53 51 # - Logs debug information about what's installed within the WordPress Docker containers. 54 52 # - Install WordPress within the Docker container. … … 56 54 # - Ensures version-controlled files are not modified or deleted. 57 55 # - Checks out the WordPress Test reporter repository. 58 # - Reconnect the directory to the Git repository.59 56 # - Submit the test results to the WordPress.org host test results. 60 57 test-php: … … 111 108 112 109 - name: Checkout repository 113 uses: actions/checkout@ 2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2114 115 - name: Install NodeJS116 uses: actions/setup-node@ eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0110 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 111 112 - name: Set up Node.js 113 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 117 114 with: 118 115 node-version-file: '.nvmrc' 119 116 cache: npm 120 117 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 122 139 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.html126 - name: "Get last Monday's date"127 id: get-date128 run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")"129 130 - name: Get Composer cache directory131 id: composer-cache132 run: echo "::set-output name=dir::$(composer config cache-files-dir)"133 134 - name: Cache Composer dependencies135 uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4136 env:137 cache-name: cache-composer-dependencies138 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 dependencies143 run: |144 docker-compose run --rm php composer --version145 146 # Install using `composer update` as there is no `composer.lock` file.147 if [ ${{ env.LOCAL_PHP }} == '8.1-fpm' ]; then148 docker-compose run --rm php composer update --ignore-platform-reqs149 else150 docker-compose run --rm php composer update151 fi152 153 - name: Docker debug information154 run: |155 docker -v156 docker-compose -v157 158 - name: Start Docker environment159 run: |160 npm run env:start161 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.php167 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached168 140 169 141 - name: General debug information … … 174 146 git --version 175 147 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 176 159 177 160 - name: Log running Docker containers … … 232 215 - name: Checkout the WordPress Test Reporter 233 216 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 234 uses: actions/checkout@ 2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2217 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 235 218 with: 236 219 repository: 'WordPress/phpunit-test-runner' … … 255 238 SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} 256 239 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.