Changeset 51545
- Timestamp:
- 08/04/2021 07:48:56 PM (3 years ago)
- Location:
- trunk/.github/workflows
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.github/workflows/phpunit-tests.yml
r51535 r51545 31 31 env: 32 32 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 33 COMPOSER_INSTALL: ${{ false }}34 # Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.35 PHPUNIT_SCRIPT: php36 33 LOCAL_PHP_MEMCACHED: ${{ false }} 37 34 SLOW_TESTS: 'external-http,media,restapi' … … 122 119 run: npm ci 123 120 124 - name: Get composer cache directory 121 # This date is used to ensure that the Composer cache is refreshed at least once every week. 122 # http://man7.org/linux/man-pages/man1/date.1.html 123 - name: "Get last Monday's date" 124 id: get-date 125 run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")" 126 shell: bash 127 128 - name: Get Composer cache directory 125 129 id: composer-cache 126 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}127 130 run: echo "::set-output name=dir::$(composer config cache-files-dir)" 128 131 129 132 - name: Cache Composer dependencies 130 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}131 133 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 132 134 env: … … 134 136 with: 135 137 path: ${{ steps.composer-cache.outputs.dir }} 136 key: ${{ runner.os }}-php-${{ matrix.php }}- composer-${{ hashFiles('**/composer.lock') }}138 key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }} 137 139 138 140 - name: Install Composer dependencies 139 if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}140 141 run: | 141 142 docker-compose run --rm php composer --version 142 143 143 # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, 144 # as PHPUnit 7 is no longer supported. The Composer-installed PHPUnit should be 145 # used for PHP 8 testing instead. 144 # Install using `composer update` as there is no `composer.lock` file. 146 145 if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then 147 docker-compose run --rm php composer install --ignore-platform-reqs 148 echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV 146 docker-compose run --rm php composer update --ignore-platform-reqs 149 147 else 150 docker-compose run --rm php composer install148 docker-compose run --rm php composer update 151 149 fi 152 150 … … 191 189 - name: Run slow PHPUnit tests 192 190 if: ${{ matrix.split_slow }} 193 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}191 run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 194 192 195 193 - name: Run PHPUnit tests for single site excluding slow tests 196 194 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 197 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required195 run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 198 196 199 197 - name: Run PHPUnit tests for Multisite excluding slow tests 200 198 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 201 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers199 run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 202 200 203 201 - name: Run PHPUnit tests 204 202 if: ${{ matrix.php >= '7.0' }} 205 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c ${{ env.PHPUNIT_CONFIG }}203 run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 206 204 207 205 - name: Run AJAX tests 208 206 if: ${{ ! matrix.split_slow }} 209 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax207 run: npm run test:php-composer -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 210 208 211 209 - name: Run ms-files tests as a multisite install 212 210 if: ${{ matrix.multisite && ! matrix.split_slow }} 213 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c tests/phpunit/multisite.xml --group ms-files211 run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --group ms-files 214 212 215 213 - name: Run external HTTP tests 216 214 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 217 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c phpunit.xml.dist --group external-http215 run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --group external-http 218 216 219 217 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 220 218 - name: Run (xDebug) tests 221 219 if: ${{ ! matrix.split_slow }} 222 run: LOCAL_PHP_XDEBUG=true npm run test: ${{ env.PHPUNIT_SCRIPT }}-- -v --group xdebug --exclude-group __fakegroup__220 run: LOCAL_PHP_XDEBUG=true npm run test:php-composer -- -v --group xdebug --exclude-group __fakegroup__ 223 221 224 222 - name: Ensure version-controlled files are not modified or deleted -
trunk/.github/workflows/test-coverage.yml
r51535 r51545 19 19 env: 20 20 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 21 COMPOSER_INSTALL: ${{ false }}22 # Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.23 PHPUNIT_SCRIPT: php24 21 LOCAL_PHP: '7.4-fpm' 25 22 LOCAL_PHP_XDEBUG: true … … 89 86 run: npm ci 90 87 88 # This date is used to ensure that the Composer cache is refreshed at least once every week. 89 # http://man7.org/linux/man-pages/man1/date.1.html 90 - name: "Get last Monday's date" 91 id: get-date 92 run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")" 93 shell: bash 94 95 - name: Get Composer cache directory 96 id: composer-cache 97 run: echo "::set-output name=dir::$(composer config cache-files-dir)" 98 99 - name: Cache Composer dependencies 100 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 101 env: 102 cache-name: cache-composer-dependencies 103 with: 104 path: ${{ steps.composer-cache.outputs.dir }} 105 key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }} 106 107 - name: Install Composer dependencies 108 run: | 109 docker-compose run --rm php composer --version 110 111 # Install using `composer update` as there is no `composer.lock` file. 112 docker-compose run --rm php composer update 113 91 114 - name: Docker debug information 92 115 run: | … … 122 145 - name: Run tests as a single site 123 146 if: ${{ ! matrix.multisite }} 124 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml147 run: npm run test:php-composer -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml 125 148 126 149 - name: Ensure version-controlled files are not modified during the tests … … 136 159 - name: Run tests as a multisite install 137 160 if: ${{ matrix.multisite }} 138 run: npm run test: ${{ env.PHPUNIT_SCRIPT }}-- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml161 run: npm run test:php-composer -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml 139 162 140 163 - name: Ensure version-controlled files are not modified during the tests
Note: See TracChangeset
for help on using the changeset viewer.