|
| 1 | +on: |
| 2 | + - pull_request |
| 3 | + - push |
| 4 | + |
| 5 | +name: build |
| 6 | + |
| 7 | +jobs: |
| 8 | + tests: |
| 9 | + name: PHP ${{ matrix.php-version }} |
| 10 | + runs-on: ubuntu-latest |
| 11 | + env: |
| 12 | + extensions: curl, mbstring, dom |
| 13 | + key: cache-v1 |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + php-version: |
| 18 | + - "7.4" |
| 19 | + - "8.0" |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Setup cache environment |
| 26 | + id: cache-env |
| 27 | + uses: shivammathur/cache-extensions@v1 |
| 28 | + with: |
| 29 | + php-version: ${{ matrix.php-version }} |
| 30 | + extensions: ${{ env.extensions }} |
| 31 | + key: ${{ env.key }} |
| 32 | + |
| 33 | + - name: Cache extensions |
| 34 | + uses: actions/cache@v2 |
| 35 | + with: |
| 36 | + path: ${{ steps.cache-env.outputs.dir }} |
| 37 | + key: ${{ steps.cache-env.outputs.key }} |
| 38 | + restore-keys: ${{ steps.cache-env.outputs.key }} |
| 39 | + |
| 40 | + - name: Setup PHP |
| 41 | + uses: shivammathur/setup-php@v2 |
| 42 | + with: |
| 43 | + php-version: ${{ matrix.php-version }} |
| 44 | + extensions: ${{ env.extensions }} |
| 45 | + ini-values: date.timezone='UTC' |
| 46 | + coverage: pcov |
| 47 | + |
| 48 | + - name: Determine composer cache directory |
| 49 | + run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" |
| 50 | + |
| 51 | + - name: Cache dependencies installed with composer |
| 52 | + uses: actions/cache@v1 |
| 53 | + with: |
| 54 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 55 | + key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} |
| 56 | + restore-keys: php-${{ matrix.php-version }}-composer- |
| 57 | + |
| 58 | + - name: Install dependencies with composer php 7.4 |
| 59 | + if: matrix.php-version == '7.4' |
| 60 | + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader |
| 61 | + |
| 62 | + - name: Install dependencies with composer php 8.0 |
| 63 | + if: matrix.php-version == '8.0' |
| 64 | + run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader |
| 65 | + |
| 66 | + - name: PHPCS check |
| 67 | + run: vendor/bin/phpcs |
| 68 | + |
| 69 | + - name: Psalm static analysis on PHP 7.4 |
| 70 | + if: matrix.php-version == '7.4' |
| 71 | + run: vendor/bin/psalm --no-progress |
| 72 | + |
| 73 | + - name: PHPUnit run |
| 74 | + run: vendor/bin/phpunit --coverage-clover=coverage.clover |
| 75 | + |
| 76 | + - name: Code coverage on PHP 7.4 |
| 77 | + if: matrix.php-version == '7.4' |
| 78 | + run: | |
| 79 | + wget https://scrutinizer-ci.com/ocular.phar |
| 80 | + php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
0 commit comments