Changeset 56439
- Timestamp:
- 08/24/2023 01:08:40 PM (14 months ago)
- Location:
- trunk/.github/workflows
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.github/workflows/phpunit-tests.yml
r56402 r56439 36 36 37 37 jobs: 38 # Runs the PHPUnit tests for WordPress.39 38 # 40 # Performs the following steps: 41 # - Sets environment variables. 42 # - Checks out the repository. 43 # - Sets up Node.js. 44 # - Sets up PHP. 45 # - Installs Composer dependencies. 46 # - Installs npm dependencies 47 # - Logs general debug information about the runner. 48 # - Logs Docker debug information (about the Docker installation within the runner). 49 # - Starts the WordPress Docker container. 50 # - Logs the running Docker containers. 51 # - Logs debug information about what's installed within the WordPress Docker containers. 52 # - Install WordPress within the Docker container. 53 # - Run the PHPUnit tests. 54 # - Ensures version-controlled files are not modified or deleted. 55 # - Checks out the WordPress Test reporter repository. 56 # - Submit the test results to the WordPress.org host test results. 57 test-php: 58 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 59 runs-on: ${{ matrix.os }} 39 # Creates a PHPUnit test job for each PHP/MySQL combination. 40 # 41 test-with-mysql: 42 name: PHP ${{ matrix.php }} 43 uses: desrosj/wordpress-develop/.github/workflows/phpunit-tests-run.yml@expanded-db-testing-callable-workflow 60 44 permissions: 61 45 contents: read 62 timeout-minutes: 2063 46 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 64 47 strategy: 65 48 fail-fast: false 66 49 matrix: 50 os: [ ubuntu-latest ] 67 51 php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] 68 os: [ ubuntu-latest ] 52 db-type: [ 'mysql' ] 53 db-version: [ '5.7', '8.0' ] 54 multisite: [ false, true ] 69 55 memcached: [ false ] 70 multisite: [ false, true ] 56 71 57 include: 72 58 # Include jobs for PHP 7.4 with memcached. 73 - php: '7.4' 74 os: ubuntu-latest 59 - os: ubuntu-latest 60 php: '7.4' 61 db-type: 'mysql' 62 db-version: '5.7' 63 multisite: false 75 64 memcached: true 65 - os: ubuntu-latest 66 php: '7.4' 67 db-type: 'mysql' 68 db-version: '5.7' 69 multisite: true 70 memcached: true 71 # Report the results of the PHP 7.4 without memcached job. 72 - os: ubuntu-latest 73 php: '7.4' 74 db-type: 'mysql' 75 db-version: '5.7' 76 76 multisite: false 77 - php: '7.4'78 os: ubuntu-latest79 memcached: true80 multisite: true81 # Report the results of the PHP 7.4 without memcached job.82 - php: '7.4'83 os: ubuntu-latest84 77 memcached: false 85 multisite: false86 78 report: true 79 with: 80 os: ${{ matrix.os }} 81 php: ${{ matrix.php }} 82 db-type: ${{ matrix.db-type }} 83 db-version: ${{ matrix.db-version }} 84 multisite: ${{ matrix.multisite }} 85 memcached: ${{ matrix.memcached }} 86 phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 87 report: ${{ matrix.report || false }} 87 88 88 env: 89 LOCAL_PHP: ${{ matrix.php }}-fpm 90 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 91 PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 89 # 90 # Creates a PHPUnit test job for each PHP/MariaDB combination. 91 # 92 test-with-mariadb: 93 name: PHP ${{ matrix.php }} 94 uses: desrosj/wordpress-develop/.github/workflows/phpunit-tests-run.yml@expanded-db-testing-callable-workflow 95 permissions: 96 contents: read 97 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} 98 strategy: 99 fail-fast: false 100 matrix: 101 os: [ ubuntu-latest ] 102 php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] 103 db-type: [ 'mariadb' ] 104 db-version: [ '10.4', '10.6', '10.11', '11.0' ] 105 multisite: [ false, true ] 106 memcached: [ false ] 107 report: [ false ] 92 108 93 steps: 94 - name: Configure environment variables 95 run: | 96 echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV 97 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 98 99 - name: Checkout repository 100 uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 101 102 - name: Set up Node.js 103 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 104 with: 105 node-version-file: '.nvmrc' 106 cache: npm 107 108 ## 109 # This allows Composer dependencies to be installed using a single step. 110 # 111 # Since the tests are currently run within the Docker containers where the PHP version varies, 112 # the same PHP version needs to be configured for the action runner machine so that the correct 113 # dependency versions are installed and cached. 114 ## 115 - name: Set up PHP 116 uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0 117 with: 118 php-version: '${{ matrix.php }}' 119 coverage: none 120 121 # Since Composer dependencies are installed using `composer update` and no lock file is in version control, 122 # passing a custom cache suffix ensures that the cache is flushed at least once per week. 123 - name: Install Composer dependencies 124 uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0 125 with: 126 custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") 127 128 - name: Install npm dependencies 129 run: npm ci 130 131 - name: General debug information 132 run: | 133 npm --version 134 node --version 135 curl --version 136 git --version 137 svn --version 138 composer --version 139 locale -a 140 141 - name: Docker debug information 142 run: | 143 docker -v 144 docker-compose -v 145 146 - name: Start Docker environment 147 run: | 148 npm run env:start 149 150 - name: Log running Docker containers 151 run: docker ps -a 152 153 - name: WordPress Docker container debug information 154 run: | 155 docker-compose run --rm mysql mysql --version 156 docker-compose run --rm php php --version 157 docker-compose run --rm php php -m 158 docker-compose run --rm php php -i 159 docker-compose run --rm php locale -a 160 161 - name: Install WordPress 162 run: npm run env:install 163 164 - name: Run PHPUnit tests 165 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} 166 167 - name: Run AJAX tests 168 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 169 170 - name: Run ms-files tests as a multisite install 171 if: ${{ matrix.multisite }} 172 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files 173 174 - name: Run external HTTP tests 175 if: ${{ ! matrix.multisite }} 176 run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http 177 178 # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist. 179 - name: Run (Xdebug) tests 180 run: LOCAL_PHP_XDEBUG=true node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit -v --group xdebug --exclude-group __fakegroup__ 181 182 - name: Ensure version-controlled files are not modified or deleted 183 run: git diff --exit-code 184 185 - name: Checkout the WordPress Test Reporter 186 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 187 uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 188 with: 189 repository: 'WordPress/phpunit-test-runner' 190 path: 'test-runner' 191 192 - name: Submit test results to the WordPress.org host test results 193 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }} 194 env: 195 WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}" 196 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 109 include: 110 # Include jobs for PHP 7.4 with memcached. 111 - os: ubuntu-latest 112 php: '7.4' 113 db-type: 'mariadb' 114 db-version: '11.0' 115 multisite: false 116 memcached: true 117 report: false 118 - os: ubuntu-latest 119 php: '7.4' 120 db-type: 'mariadb' 121 db-version: '11.0' 122 multisite: true 123 memcached: true 124 report: false 125 with: 126 os: ${{ matrix.os }} 127 php: ${{ matrix.php }} 128 db-type: ${{ matrix.db-type }} 129 db-version: ${{ matrix.db-version }} 130 multisite: ${{ matrix.multisite }} 131 memcached: ${{ matrix.memcached }} 132 phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 133 report: ${{ matrix.report }} 197 134 198 135 slack-notifications: … … 202 139 actions: read 203 140 contents: read 204 needs: [ test- php]141 needs: [ test-with-mysql, test-with-mariadb ] 205 142 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} 206 143 with: 207 calling_status: ${{ needs.test- php.result == 'success' && 'success' || needs.test-php.result == 'cancelled'&& 'cancelled' || 'failure' }}144 calling_status: ${{ needs.test-with-mysql.result == 'success' && needs.test-with-mariadb.result == 'success' && 'success' || ( needs.test-with-mysql.result == 'cancelled' || needs.test-with-mariadb.result == 'cancelled' ) && 'cancelled' || 'failure' }} 208 145 secrets: 209 146 SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
Note: See TracChangeset
for help on using the changeset viewer.