|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + testsuite: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + php-version: ['7.4', '8.2'] |
| 17 | + db-type: [sqlite, mysql, pgsql] |
| 18 | + prefer-lowest: [''] |
| 19 | + include: |
| 20 | + - php-version: '7.4' |
| 21 | + db-type: 'sqlite' |
| 22 | + prefer-lowest: 'prefer-lowest' |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + |
| 27 | + - name: Setup PHP |
| 28 | + uses: shivammathur/setup-php@v2 |
| 29 | + with: |
| 30 | + php-version: ${{ matrix.php-version }} |
| 31 | + extensions: mbstring |
| 32 | + coverage: pcov |
| 33 | + |
| 34 | + - name: Get composer cache directory |
| 35 | + id: composercache |
| 36 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 37 | + |
| 38 | + - name: Cache dependencies |
| 39 | + uses: actions/cache@v3 |
| 40 | + with: |
| 41 | + path: ${{ steps.composercache.outputs.dir }} |
| 42 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 43 | + restore-keys: ${{ runner.os }}-composer- |
| 44 | + |
| 45 | + - name: Composer install |
| 46 | + run: | |
| 47 | + composer --version |
| 48 | + if ${{ matrix.prefer-lowest == 'prefer-lowest' }} |
| 49 | + then |
| 50 | + composer update --prefer-lowest --prefer-stable |
| 51 | + else |
| 52 | + composer install --no-progress --prefer-dist --optimize-autoloader |
| 53 | + fi |
| 54 | + if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then composer lowest-setup; fi |
| 55 | +
|
| 56 | + - name: Run PHPUnit |
| 57 | + run: | |
| 58 | + if [[ ${{ matrix.php-version }} == '7.4' && ${{ matrix.db-type }} == 'sqlite' ]]; then |
| 59 | + vendor/bin/phpunit --coverage-clover=coverage.xml |
| 60 | + else |
| 61 | + vendor/bin/phpunit |
| 62 | + fi |
| 63 | +
|
| 64 | + - name: Validate prefer-lowest |
| 65 | + run: if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then vendor/bin/validate-prefer-lowest -m; fi |
| 66 | + |
| 67 | + - name: Code Coverage Report |
| 68 | + if: success() && matrix.php-version == '7.4' && matrix.db-type == 'sqlite' |
| 69 | + uses: codecov/codecov-action@v3 |
| 70 | + |
| 71 | + validation: |
| 72 | + name: Coding Standard & Static Analysis |
| 73 | + runs-on: ubuntu-22.04 |
| 74 | + |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v3 |
| 77 | + |
| 78 | + - name: Setup PHP |
| 79 | + uses: shivammathur/setup-php@v2 |
| 80 | + with: |
| 81 | + php-version: '7.4' |
| 82 | + extensions: mbstring |
| 83 | + coverage: none |
| 84 | + |
| 85 | + - name: Get composer cache directory |
| 86 | + id: composercache |
| 87 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 88 | + |
| 89 | + - name: Cache dependencies |
| 90 | + uses: actions/cache@v3 |
| 91 | + with: |
| 92 | + path: ${{ steps.composercache.outputs.dir }} |
| 93 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 94 | + restore-keys: ${{ runner.os }}-composer- |
| 95 | + |
| 96 | + - name: Composer Setup |
| 97 | + run: composer stan-setup |
| 98 | + |
| 99 | + - name: Run phpstan |
| 100 | + run: vendor/bin/phpstan analyse --error-format=github |
| 101 | + |
| 102 | + - name: Run phpcs |
| 103 | + run: composer cs-check |
0 commit comments