|
14 | 14 | PHP_EXTENSIONS_CACHE_KEY: cache-php-extensions-v1
|
15 | 15 |
|
16 | 16 | jobs:
|
| 17 | + unit-test-optimized: |
| 18 | + name: Unit tests (php-${{ matrix.php }} - ${{ matrix.dependencies }}) |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + timeout-minutes: 10 |
| 21 | + continue-on-error: ${{ matrix.is-php-experimental }} |
| 22 | + strategy: |
| 23 | + max-parallel: 5 |
| 24 | + matrix: |
| 25 | + php: |
| 26 | + - '7.3' |
| 27 | + - '7.4' |
| 28 | + - '8.0' |
| 29 | + - '8.1' |
| 30 | + - '8.2' |
| 31 | + - '8.3' |
| 32 | + dependencies: |
| 33 | + - "lowest" |
| 34 | + - "highest" |
| 35 | + is-php-experimental: [false] |
| 36 | + generate-coverage-report: [false] |
| 37 | + include: |
| 38 | + - php: '7.4' |
| 39 | + is-php-experimental: false |
| 40 | + generate-coverage-report: false |
| 41 | + - php: '8.0' |
| 42 | + is-php-experimental: false |
| 43 | + generate-coverage-report: false |
| 44 | + - php: '8.1' |
| 45 | + is-php-experimental: false |
| 46 | + generate-coverage-report: false |
| 47 | + - php: '8.2' |
| 48 | + is-php-experimental: false |
| 49 | + generate-coverage-report: false |
| 50 | + - php: '8.3' |
| 51 | + is-php-experimental: false |
| 52 | + generate-coverage-report: false |
| 53 | + fail-fast: false |
| 54 | + steps: |
| 55 | + - name: Checkout on SHA-${{ inputs.triggering-sha }} |
| 56 | + uses: actions/checkout@v4 |
| 57 | + with: |
| 58 | + ref: ${{ inputs.triggering-sha }} |
| 59 | + |
| 60 | + - name: Setup php extension cache environment |
| 61 | + if: ${{ vars.USE_PHP_EXTENSION_CACHE }} |
| 62 | + id: cache-php-extensions |
| 63 | + uses: shivammathur/cache-extensions@v1 |
| 64 | + with: |
| 65 | + php-version: ${{ matrix.php }} |
| 66 | + extensions: ${{ env.PHP_EXTENSIONS }} |
| 67 | + key: ${{ env.PHP_EXTENSIONS_CACHE_KEY }}-${{ matrix.php }} |
| 68 | + |
| 69 | + - name: Cache PHP extensions |
| 70 | + if: ${{ vars.USE_PHP_EXTENSION_CACHE }} |
| 71 | + uses: actions/cache@v4 |
| 72 | + with: |
| 73 | + path: ${{ steps.cache-php-extensions.outputs.dir }} |
| 74 | + key: ${{ steps.cache-php-extensions.outputs.key }} |
| 75 | + restore-keys: ${{ steps.cache-php-extensions.outputs.key }} |
| 76 | + |
| 77 | + - name: Setup PHP |
| 78 | + uses: shivammathur/[email protected] |
| 79 | + with: |
| 80 | + php-version: ${{ matrix.php }} |
| 81 | + extensions: ${{ env.PHP_EXTENSIONS }} |
| 82 | + ini-values: memory_limit=-1 |
| 83 | + coverage: pcov |
| 84 | + |
| 85 | + - name: Install composer deps. |
| 86 | + uses: ramsey/composer-install@v3 |
| 87 | + with: |
| 88 | + dependency-versions: ${{ matrix.dependencies }} |
| 89 | + |
| 90 | +# - name: Set Composer Cache Directory |
| 91 | +# if: ${{ vars.USE_COMPOSER_CACHE }} |
| 92 | +# id: composer-cache |
| 93 | +# run: | |
| 94 | +# echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 95 | +# |
| 96 | +# - name: Cache Composer dependencies |
| 97 | +# uses: actions/cache@v4 |
| 98 | +# if: ${{ vars.USE_COMPOSER_CACHE }} |
| 99 | +# with: |
| 100 | +# path: ${{ steps.composer-cache.outputs.dir }} |
| 101 | +# key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} |
| 102 | +# restore-keys: | |
| 103 | +# ${{ runner.os }}-php-${{ matrix.php }}-composer- |
| 104 | +# |
| 105 | +# - name: Install dependencies |
| 106 | +# run: | |
| 107 | +# composer install --prefer-dist --no-progress --ansi |
| 108 | +# continue-on-error: ${{ matrix.is-php-experimental }} |
| 109 | + |
| 110 | + - name: Run unit tests |
| 111 | + run: | |
| 112 | + vendor/bin/phpunit --testsuite=unit --testdox --no-interaction --colors=always \ |
| 113 | + --coverage-clover ${{ vars.UNIT_TEST_CLOVER_FILENAME }} \ |
| 114 | + --testdox-text ${{ vars.UNIT_TEST_DOC_FILENAME }} |
| 115 | +
|
| 116 | + - name: Get Coverage artifact name |
| 117 | + if: ${{ matrix.generate-coverage-report }} |
| 118 | + id: coverage-artifact-name |
| 119 | + run: echo "name=${{ vars.ARTIFATC_NAME_FOR_UNIT_TESTS_COVERAGE }}-$GITHUB_SHA" >> $GITHUB_OUTPUT |
| 120 | + |
| 121 | + - name: Save coverage reports |
| 122 | + if: ${{ matrix.generate-coverage-report }} |
| 123 | + uses: actions/upload-artifact@v4 |
| 124 | + with: |
| 125 | + name: ${{ steps.coverage-artifact-name.outputs.name }} |
| 126 | + path: ${{ vars.UNIT_TEST_CLOVER_FILENAME }} |
| 127 | + |
| 128 | + - name: Get Test doc artifact name |
| 129 | + if: ${{ matrix.generate-coverage-report }} |
| 130 | + id: test-doc-artifact-name |
| 131 | + run: echo "name=${{ vars.ARTIFATC_NAME_FOR_UNIT_TESTS_DOCUMENTATION_REPORT }}-$GITHUB_SHA" >> $GITHUB_OUTPUT |
| 132 | + |
| 133 | + - name: Save test doc reports |
| 134 | + if: ${{ matrix.generate-coverage-report }} |
| 135 | + uses: actions/upload-artifact@v4 |
| 136 | + with: |
| 137 | + name: ${{ steps.test-doc-artifact-name.outputs.name }} |
| 138 | + path: ${{ vars.UNIT_TEST_DOC_FILENAME }} |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
17 | 144 | unit-test:
|
18 | 145 | name: Unit tests (php-${{ matrix.php }})
|
19 | 146 | runs-on: ubuntu-22.04
|
|
0 commit comments