|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: ~ |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + continuous-integration: |
| 12 | + name: Continuous Integration |
| 13 | + |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + install-args: ['', '--prefer-lowest'] |
| 19 | + php-version: ['7.2', '7.3', '7.4', '8.0'] |
| 20 | + fail-fast: false |
| 21 | + |
| 22 | + steps: |
| 23 | + # Cancel previous runs of the same branch |
| 24 | + - name: cancel |
| 25 | + |
| 26 | + with: |
| 27 | + access_token: ${{ github.token }} |
| 28 | + |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: Install PHP |
| 33 | + uses: shivammathur/setup-php@v2 |
| 34 | + with: |
| 35 | + php-version: "${{ matrix.php-version }}" |
| 36 | + tools: composer:v2 |
| 37 | + |
| 38 | + - name: composer-cache-dir |
| 39 | + id: composercache |
| 40 | + run: | |
| 41 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 42 | +
|
| 43 | + - name: composer-cache |
| 44 | + |
| 45 | + with: |
| 46 | + path: ${{ steps.composercache.outputs.dir }} |
| 47 | + key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }} |
| 48 | + restore-keys: | |
| 49 | + composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }} |
| 50 | + composer-${{ hashFiles('**/composer.json') }}- |
| 51 | + composer- |
| 52 | +
|
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist |
| 56 | + if: ${{ matrix.php-version != '8.0' }} |
| 57 | + |
| 58 | + - name: Run tests with phpunit/phpunit |
| 59 | + run: vendor/bin/phpunit |
| 60 | + |
| 61 | + - name: phpstan-cache |
| 62 | + |
| 63 | + with: |
| 64 | + key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }} |
| 65 | + path: .phpstan-cache |
| 66 | + restore-keys: | |
| 67 | + phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}- |
| 68 | + phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}- |
| 69 | + phpstan-${{ matrix.php-version }}- |
| 70 | + phpstan- |
| 71 | +
|
| 72 | + - name: Run phpstan |
| 73 | + run: composer phpstan |
| 74 | + |
| 75 | + - name: Run php_codesniffer |
| 76 | + run: composer cs-check |
| 77 | + if: ${{ matrix.php-version == '7.2' }} # Do not suggest using features after 7.2 |
0 commit comments