|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: 0 2 * * 1-5 |
| 6 | + pull_request: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +jobs: |
| 12 | + tests: |
| 13 | + name: Tests PHP ${{ matrix.php }} ${{ matrix.dependency }} (Symfony ${{ matrix.symfony }}) |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + php: |
| 18 | + - '5.5' |
| 19 | + - '5.6' |
| 20 | + - '7.0' |
| 21 | + - '7.1' |
| 22 | + - '7.2' |
| 23 | + - '7.3' |
| 24 | + - '7.4' |
| 25 | + - '8.0' |
| 26 | + symfony: |
| 27 | + - '3.4.*' |
| 28 | + - '4.4.*' |
| 29 | + - '5.0.*' |
| 30 | + include: |
| 31 | + - php: '7.1' |
| 32 | + coverage: true |
| 33 | + dependency: |
| 34 | + - '' |
| 35 | + - 'lowest' |
| 36 | + fail-fast: false |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v1 |
| 40 | + |
| 41 | + - name: Setup PHP |
| 42 | + uses: shivammathur/setup-php@v2 |
| 43 | + with: |
| 44 | + php-version: ${{ matrix.php }} |
| 45 | + extensions: curl, dom, iconv, intl, json, libxml, mbstring, phar, tokenizer, xdebug, xml, xmlwriter |
| 46 | + |
| 47 | + - name: Get Composer Cache Directory |
| 48 | + id: composer-cache |
| 49 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 50 | + |
| 51 | + - name: Cache dependencies |
| 52 | + uses: actions/cache@v1 |
| 53 | + with: |
| 54 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 55 | + key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
| 56 | + restore-keys: ${{ matrix.php }}-composer- |
| 57 | + |
| 58 | + - name: Configure Symfony |
| 59 | + run: | |
| 60 | + composer global require symfony/flex |
| 61 | + composer config extra.symfony.require "${{ matrix.symfony }}" |
| 62 | +
|
| 63 | + - name: Update project dependencies |
| 64 | + if: matrix.dependency == '' |
| 65 | + run: composer update --no-progress --ansi --prefer-stable |
| 66 | + |
| 67 | + - name: Update project dependencies lowest |
| 68 | + if: matrix.dependency == 'lowest' |
| 69 | + run: composer update --no-progress --ansi --prefer-stable --prefer-lowest |
| 70 | + |
| 71 | + - name: Validate composer |
| 72 | + run: composer validate --strict --no-check-lock |
| 73 | + |
| 74 | + - name: Run tests |
| 75 | + if: !matrix.coverage |
| 76 | + run: vendor/bin/phpunit |
| 77 | + |
| 78 | + - name: Run tests with coverage |
| 79 | + if: matrix.coverage |
| 80 | + run: vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml |
| 81 | + |
| 82 | + - name: Upload coverage |
| 83 | + if: matrix.coverage |
| 84 | + run: | |
| 85 | + wget https://scrutinizer-ci.com/ocular.phar |
| 86 | + php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml |
0 commit comments