|
1 |
| -name: Unit Tests |
| 1 | +name: Tests |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
@@ -99,3 +99,163 @@ jobs:
|
99 | 99 |
|
100 | 100 | - name: Execute Unit Tests
|
101 | 101 | run: vendor/bin/phpunit
|
| 102 | + |
| 103 | + test-phar: |
| 104 | + runs-on: ubuntu-latest |
| 105 | + |
| 106 | + strategy: |
| 107 | + matrix: |
| 108 | + include: |
| 109 | + # Test against the high/low supported PHP-PHPUnit combinations. |
| 110 | + # |
| 111 | + # Code coverage is only run against the high/high PHP-PHPUnit combinations |
| 112 | + # and very select other combinations. |
| 113 | + # This should be sufficient to record the coverage for the PHAR specific code. |
| 114 | + |
| 115 | + # PHPUnit 4 is only supported at the latest version. |
| 116 | + - php: '5.4' |
| 117 | + phpunit: '4' |
| 118 | + - php: '5.5' |
| 119 | + phpunit: '4' |
| 120 | + - php: '5.6' |
| 121 | + phpunit: '4' |
| 122 | + coverage: true |
| 123 | + |
| 124 | + # PHPUnit 5 is only supported for PHPUnit 5.7.21-latest. |
| 125 | + - php: '5.6' |
| 126 | + phpunit: '5.7.21' |
| 127 | + - php: '5.6' |
| 128 | + phpunit: '5' |
| 129 | + - php: '7.1' |
| 130 | + phpunit: '5.7.21' |
| 131 | + - php: '7.1' |
| 132 | + phpunit: '5' |
| 133 | + coverage: true |
| 134 | + |
| 135 | + # PHPUnit 6 is fully supported for the officially supported PHP versions. |
| 136 | + - php: '7.0' |
| 137 | + phpunit: '6.0' |
| 138 | + - php: '7.0' |
| 139 | + phpunit: '6' |
| 140 | + - php: '7.2' |
| 141 | + phpunit: '6.0' |
| 142 | + - php: '7.2' |
| 143 | + phpunit: '6' |
| 144 | + coverage: true |
| 145 | + |
| 146 | + # PHPUnit 7 is fully supported for the officially supported PHP versions. |
| 147 | + # Caveats: |
| 148 | + # - PHPUnit 7.0 seems to have an issue with something related to TestListeners, so using PHPUnit 7.1 instead for "low". |
| 149 | + # - PHPUnit 7 supports PHP 7.3 as of PHPUnit 7.3.0 (for our purposes). |
| 150 | + - php: '7.1' |
| 151 | + phpunit: '7.1' |
| 152 | + - php: '7.1' |
| 153 | + phpunit: '7' |
| 154 | + - php: '7.3' |
| 155 | + phpunit: '7.3' |
| 156 | + - php: '7.3' |
| 157 | + phpunit: '7' |
| 158 | + coverage: true |
| 159 | + |
| 160 | + # PHPUnit 8 is fully supported for the officially supported PHP versions. |
| 161 | + # Caveats: |
| 162 | + # - PHPUnit 8 supports PHP 8.0 as of PHPUnit 8.5.12 (for our purposes). |
| 163 | + # - PHPUnit 8 supports PHP 8.1 as of PHPUnit 8.5.19 (for our purposes). |
| 164 | + # - PHPUnit 8 supports PHP 8.2 as of PHPUnit 8.5.19 (for our purposes). |
| 165 | + # - PHPUnit 8 supports PHP 8.3 as of PHPUnit 8.5.19 (for our purposes). |
| 166 | + # - PHPUnit 8 does not support running code coverage on PHP 8.0 or higher. |
| 167 | + - php: '7.2' |
| 168 | + phpunit: '8.0' |
| 169 | + coverage: true |
| 170 | + - php: '7.2' |
| 171 | + phpunit: '8' |
| 172 | + - php: '7.4' |
| 173 | + phpunit: '8.0' |
| 174 | + - php: '7.4' |
| 175 | + phpunit: '8' |
| 176 | + coverage: true |
| 177 | + - php: '8.0' |
| 178 | + phpunit: '8.5.12' |
| 179 | + - php: '8.0' |
| 180 | + phpunit: '8' |
| 181 | + - php: '8.3' |
| 182 | + phpunit: '8.5.19' |
| 183 | + - php: '8.3' |
| 184 | + phpunit: '8' |
| 185 | + |
| 186 | + # PHPUnit 9 is fully supported for the officially supported PHP versions. |
| 187 | + # Caveats: |
| 188 | + # - PHPUnit 9 supports PHP 8.0 as of PHPUnit 9.3.0 (for our purposes). |
| 189 | + # - PHPUnit 9 supports PHP 8.1 as of PHPUnit 9.5.8 (for our purposes). |
| 190 | + # - PHPUnit 9 supports PHP 8.2 as of PHPUnit 9.5.8 (for our purposes). |
| 191 | + # - PHPUnit 9 supports PHP 8.3 as of PHPUnit 9.5.8 (for our purposes). |
| 192 | + - php: '7.3' |
| 193 | + phpunit: '9.0' |
| 194 | + coverage: true |
| 195 | + - php: '7.3' |
| 196 | + phpunit: '9' |
| 197 | + - php: '8.0' |
| 198 | + phpunit: '9.3.0' |
| 199 | + - php: '8.0' |
| 200 | + phpunit: '9' |
| 201 | + - php: '8.1' |
| 202 | + phpunit: '9.5.8' |
| 203 | + - php: '8.1' |
| 204 | + phpunit: '9' |
| 205 | + - php: '8.2' |
| 206 | + phpunit: '9.5.8' |
| 207 | + - php: '8.2' |
| 208 | + phpunit: '9' |
| 209 | + - php: '8.3' |
| 210 | + phpunit: '9.5.8' |
| 211 | + - php: '8.3' |
| 212 | + phpunit: '9' |
| 213 | + coverage: true |
| 214 | + |
| 215 | + # Experimental builds. |
| 216 | + - php: '8.4' |
| 217 | + phpunit: '9' |
| 218 | + |
| 219 | + name: "PHAR test: PHP ${{ matrix.php }} - PHPUnit: ${{matrix.phpunit}}" |
| 220 | + |
| 221 | + continue-on-error: ${{ matrix.php == '8.4' }} |
| 222 | + |
| 223 | + steps: |
| 224 | + - name: Checkout code |
| 225 | + uses: actions/checkout@v4 |
| 226 | + |
| 227 | + - name: Install PHP |
| 228 | + uses: shivammathur/setup-php@v2 |
| 229 | + with: |
| 230 | + php-version: ${{ matrix.php }} |
| 231 | + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On |
| 232 | + tools: phpunit:${{ matrix.phpunit }} |
| 233 | + coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} |
| 234 | + env: |
| 235 | + fail-fast: true |
| 236 | + |
| 237 | + # Remove PHPUnit from the Composer install as we want to be sure the PHAR file is used. |
| 238 | + - name: 'Composer: remove PHPUnit' |
| 239 | + run: composer remove phpunit/phpunit --no-update --no-interaction |
| 240 | + |
| 241 | + # Install dependencies and handle caching in one go. |
| 242 | + # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer |
| 243 | + - name: Install Composer dependencies - normal |
| 244 | + if: matrix.php < '8.3' |
| 245 | + uses: "ramsey/composer-install@v3" |
| 246 | + with: |
| 247 | + composer-options: "--no-dev" |
| 248 | + # Bust the cache at least once a month - output format: YYYY-MM. |
| 249 | + custom-cache-suffix: $(date -u "+%Y-%m") |
| 250 | + |
| 251 | + - name: Install Composer dependencies - ignore PHP restrictions |
| 252 | + if: matrix.php >= '8.3' |
| 253 | + uses: "ramsey/composer-install@v3" |
| 254 | + with: |
| 255 | + composer-options: "--no-dev --ignore-platform-req=php+" |
| 256 | + # Bust the cache at least once a month - output format: YYYY-MM. |
| 257 | + custom-cache-suffix: $(date -u "+%Y-%m") |
| 258 | + |
| 259 | + - name: Run the unit tests |
| 260 | + if: ${{ ! matrix.coverage }} |
| 261 | + run: phpunit --no-coverage |
0 commit comments