|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + - push |
| 5 | + - pull_request |
| 6 | + |
| 7 | +jobs: |
| 8 | + tests: |
| 9 | + name: PHP ${{ matrix.php }} Test on ${{ matrix.os }} |
| 10 | + |
| 11 | + env: |
| 12 | + extensions: iconv, mbstring, json |
| 13 | + key: cache-v1 |
| 14 | + PHPUNIT_COVERAGE: 0 |
| 15 | + PHP_INI: date.timezone='UTC', memory_limit=-1, opcache.enable=1, opcache.enable_cli=1 |
| 16 | + |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: |
| 20 | + - ubuntu-latest |
| 21 | + - macos-latest |
| 22 | + php: |
| 23 | + - '7.1' |
| 24 | + - '7.2' |
| 25 | + - '7.3' |
| 26 | + - '7.4' |
| 27 | + - '8.0' |
| 28 | + |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v1 |
| 34 | + |
| 35 | + - name: Disable JIT for PHP 8 on Mac |
| 36 | + if: matrix.os == 'macos-latest' && matrix.php == '8.0' |
| 37 | + run: echo "PHP_INI=\"${PHP_INI}, opcache.jit=0, opcache.jit_buffer_size=0\"" >> $GITHUB_ENV |
| 38 | + |
| 39 | + - name: Install PHP with extensions |
| 40 | + uses: shivammathur/setup-php@v2 |
| 41 | + with: |
| 42 | + php-version: ${{ matrix.php }} |
| 43 | + extensions: ${{ env.extensions }} |
| 44 | + coverage: pcov |
| 45 | + ini-values: ${{ env.PHP_INI }} |
| 46 | + tools: composer:v2, cs2pr |
| 47 | + |
| 48 | + - name: Determine composer cache directory |
| 49 | + run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV |
| 50 | + |
| 51 | + - name: Cache composer dependencies |
| 52 | + uses: actions/cache@v2 |
| 53 | + with: |
| 54 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 55 | + key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} |
| 56 | + restore-keys: php${{ matrix.php }}-composer- |
| 57 | + |
| 58 | + - name: Check PHP Version |
| 59 | + run: php -v |
| 60 | + |
| 61 | + - name: Check Composer Version |
| 62 | + run: composer -V |
| 63 | + |
| 64 | + - name: Check PHP Extensions |
| 65 | + run: php -m |
| 66 | + |
| 67 | + - name: Validate composer.json and composer.lock |
| 68 | + run: composer validate |
| 69 | + |
| 70 | + - name: Install dependencies with composer |
| 71 | + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi |
| 72 | + |
| 73 | + - name: Run tests with phpunit |
| 74 | + run: vendor/bin/phpunit -c phpunit.dist.xml |
0 commit comments