|
| 1 | +# from doctrine/instantiator: |
| 2 | +# https://github.com/doctrine/instantiator/blob/97aa11bb71ad6259a8c5a1161b4de2d6cdcc5501/.github/workflows/continuous-integration.yml |
| 3 | + |
| 4 | +name: "CI" |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "*.x" |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - "*.x" |
| 13 | + |
| 14 | +env: |
| 15 | + fail-fast: true |
| 16 | + COMPOSER_ROOT_VERSION: "1.4" |
| 17 | + |
| 18 | +jobs: |
| 19 | + phpunit: |
| 20 | + name: "PHPUnit" |
| 21 | + runs-on: "ubuntu-20.04" |
| 22 | + |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + include: |
| 26 | + - php-version: 7.1 |
| 27 | + composer-flags: "--prefer-lowest --prefer-stable" |
| 28 | + - php-version: 7.2 |
| 29 | + composer-flags: "--prefer-stable" |
| 30 | + symfony-require: "3.4.*" |
| 31 | + - php-version: 7.3 |
| 32 | + composer-flags: "--prefer-stable" |
| 33 | + symfony-require: "4.3.*" |
| 34 | + - php-version: 7.4 |
| 35 | + composer-flags: "--prefer-stable" |
| 36 | + symfony-require: "4.4.*" |
| 37 | + coverage: yes |
| 38 | + - php-version: 8.0 |
| 39 | + composer-flags: "--ignore-platform-reqs" |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: "Checkout" |
| 43 | + uses: "actions/checkout@v2" |
| 44 | + with: |
| 45 | + fetch-depth: 2 |
| 46 | + |
| 47 | + - name: "Install PHP with XDebug" |
| 48 | + uses: "shivammathur/setup-php@v2" |
| 49 | + if: "${{ matrix.coverage != '' }}" |
| 50 | + with: |
| 51 | + php-version: "${{ matrix.php-version }}" |
| 52 | + coverage: "xdebug" |
| 53 | + |
| 54 | + - name: "Install PHP without coverage" |
| 55 | + uses: "shivammathur/setup-php@v2" |
| 56 | + if: "${{ matrix.coverage == '' }}" |
| 57 | + with: |
| 58 | + php-version: "${{ matrix.php-version }}" |
| 59 | + coverage: "none" |
| 60 | + |
| 61 | + - name: "Cache dependencies installed with composer" |
| 62 | + uses: "actions/cache@v2" |
| 63 | + with: |
| 64 | + path: "~/.composer/cache" |
| 65 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 66 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 67 | + |
| 68 | + - name: "Install dependencies with composer" |
| 69 | + env: |
| 70 | + SYMFONY_REQUIRE: "${{ matrix.symfony-require }}" |
| 71 | + run: "composer update --no-interaction --no-progress ${{ matrix.composer-flags }}" |
| 72 | + |
| 73 | + - name: "Run PHPUnit" |
| 74 | + if: "${{ matrix.coverage != '' }}" |
| 75 | + run: | |
| 76 | + XDEBUG_MODE=coverage ./phpunit --coverage-clover=coverage.clover |
| 77 | + wget https://scrutinizer-ci.com/ocular.phar |
| 78 | + php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
| 79 | +
|
| 80 | + - name: "Run PHPUnit" |
| 81 | + if: "${{ matrix.coverage == '' }}" |
| 82 | + run: "./phpunit" |
0 commit comments