|
| 1 | +name: "Continuous integration" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + continuous-integration: |
| 15 | + name: "Check with PHP ${{ matrix.php-version }}" |
| 16 | + runs-on: "ubuntu-latest" |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - { php-version: "7.4" } |
| 22 | + - { php-version: "8.4" } |
| 23 | + steps: |
| 24 | + - name: "Checkout" |
| 25 | + uses: "actions/checkout@v4" |
| 26 | + |
| 27 | + - name: "Setup PHP" |
| 28 | + uses: "shivammathur/setup-php@v2" |
| 29 | + with: |
| 30 | + php-version: "${{ matrix.php-version }}" |
| 31 | + tools: "composer, cs2pr" |
| 32 | + |
| 33 | + # Install dependencies |
| 34 | + - name: "Get cache variables" |
| 35 | + id: "cache-variables" |
| 36 | + run: | |
| 37 | + echo "composer=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 38 | + - name: "Cache dependencies" |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: "${{ steps.cache-variables.outputs.composer }}" |
| 42 | + key: "dependencies-${{ matrix.php-version }}-${{ hashFiles('composer.lock') }}" |
| 43 | + restore-keys: | |
| 44 | + dependencies-${{ matrix.php-version }}- |
| 45 | + dependencies- |
| 46 | + - name: "Force used PHP version" |
| 47 | + run: | |
| 48 | + composer config --unset platform.php --ansi |
| 49 | + composer require "php:>=${{ matrix.php-version }}" --ansi --ignore-platform-req=php+ --no-install --no-scripts |
| 50 | + - name: "Install and build dependencies" |
| 51 | + run: | |
| 52 | + composer install --ansi --ignore-platform-req=php+ --no-interaction --no-progress |
| 53 | +
|
| 54 | + # Lint |
| 55 | + - name: "Validate composer config" |
| 56 | + if: ${{ !cancelled() }} |
| 57 | + run: | |
| 58 | + composer validate --strict |
| 59 | + - name: "PHP Parallel Lint" |
| 60 | + if: ${{ !cancelled() }} |
| 61 | + run: | |
| 62 | + vendor/bin/parallel-lint --exclude ./.git/ --exclude ./vendor/ --checkstyle . | cs2pr |
| 63 | + - name: "PHP CS Fixer" |
| 64 | + if: ${{ !cancelled() }} |
| 65 | + run: | |
| 66 | + PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr |
| 67 | + - name: "PHPStan" |
| 68 | + if: ${{ !cancelled() }} |
| 69 | + run: | |
| 70 | + vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr |
| 71 | +
|
| 72 | + # Test |
| 73 | + - name: "PHPUnit" |
| 74 | + if: ${{ !cancelled() }} |
| 75 | + run: | |
| 76 | + vendor/bin/phpunit |
0 commit comments