|
| 1 | +name: 'CI' |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + lint: |
| 12 | + name: 'Lint' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + timeout-minutes: 5 |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: 'Checkout' |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: 'Setup PHP' |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + coverage: "none" |
| 24 | + extensions: "json" |
| 25 | + ini-values: "memory_limit=-1" |
| 26 | + php-version: "8.0" |
| 27 | + |
| 28 | + - name: 'Determine composer cache directory' |
| 29 | + id: composer-cache |
| 30 | + run: echo "::set-output name=directory::$(composer config cache-dir)" |
| 31 | + |
| 32 | + - name: 'Cache composer dependencies' |
| 33 | + uses: actions/cache@v2 |
| 34 | + with: |
| 35 | + path: ${{ steps.composer-cache.outputs.directory }} |
| 36 | + key: 7.4-composer-${{ hashFiles('**/composer.lock') }} |
| 37 | + restore-keys: 7.4-composer- |
| 38 | + |
| 39 | + - name: 'Install dependencies' |
| 40 | + id: deps |
| 41 | + run: | |
| 42 | + echo "::group::composer update" |
| 43 | + composer update --no-progress --ansi |
| 44 | + echo "::endgroup::" |
| 45 | +
|
| 46 | + echo "::group::install phpunit" |
| 47 | + # Required for PhpStan |
| 48 | + vendor/bin/simple-phpunit install |
| 49 | + echo "::endgroup::" |
| 50 | +
|
| 51 | + - name: 'Composer validate' |
| 52 | + if: always() && steps.deps.outcome == 'success' |
| 53 | + run: composer validate --strict |
| 54 | + |
| 55 | + - name: 'PHP CS Fixer' |
| 56 | + if: always() && steps.deps.outcome == 'success' |
| 57 | + run: vendor/bin/php-cs-fixer fix --dry-run --diff |
| 58 | + |
| 59 | + - name: 'PhpStan' |
| 60 | + if: always() && steps.deps.outcome == 'success' |
| 61 | + run: vendor/bin/phpstan analyse |
| 62 | + |
| 63 | + tests: |
| 64 | + name: 'Tests' |
| 65 | + runs-on: ubuntu-latest |
| 66 | + timeout-minutes: 5 |
| 67 | + |
| 68 | + strategy: |
| 69 | + fail-fast: false # don't cancel other matrix jobs on failure |
| 70 | + matrix: |
| 71 | + php: [ '7.4', '8.0' ] |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: 'Checkout' |
| 75 | + uses: actions/checkout@v2 |
| 76 | + |
| 77 | + - name: 'Setup PHP' |
| 78 | + uses: shivammathur/setup-php@v2 |
| 79 | + with: |
| 80 | + coverage: "none" |
| 81 | + extensions: "json" |
| 82 | + ini-values: "memory_limit=-1" |
| 83 | + php-version: "${{ matrix.php }}" |
| 84 | + |
| 85 | + - name: 'Determine composer cache directory' |
| 86 | + id: composer-cache |
| 87 | + run: echo "::set-output name=directory::$(composer config cache-dir)" |
| 88 | + |
| 89 | + - name: 'Cache composer dependencies' |
| 90 | + uses: actions/cache@v2 |
| 91 | + with: |
| 92 | + path: ${{ steps.composer-cache.outputs.directory }} |
| 93 | + key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} |
| 94 | + restore-keys: ${{ matrix.php }}-composer- |
| 95 | + |
| 96 | + - name: 'Fixup Composer' |
| 97 | + if: matrix.php == 8.0 |
| 98 | + run: | |
| 99 | + echo "::group::Fixup Composer platform config for third-parties deps not PHP 8 ready yet" |
| 100 | + composer config platform.php 7.4.99 |
| 101 | + echo "::endgroup::" |
| 102 | +
|
| 103 | + - name: 'Install dependencies' |
| 104 | + run: | |
| 105 | + echo "::group::composer update" |
| 106 | + composer update --no-progress --ansi |
| 107 | + echo "::endgroup::" |
| 108 | +
|
| 109 | + echo "::group::install phpunit" |
| 110 | + vendor/bin/simple-phpunit install |
| 111 | + echo "::endgroup::" |
| 112 | +
|
| 113 | + - name: 'Run tests' |
| 114 | + run: vendor/bin/simple-phpunit --testdox |
| 115 | + |
0 commit comments