|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - '*' |
| 8 | + |
| 9 | +jobs: |
| 10 | + testsuite: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + php-version: ['8.1', '8.2', '8.3', '8.4'] |
| 16 | + os: [ubuntu-latest, windows-latest] |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Setup PHP |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + php-version: ${{ matrix.php-version }} |
| 24 | + extensions: mbstring, intl |
| 25 | + coverage: pcov |
| 26 | + |
| 27 | + - name: Cache composer dependencies |
| 28 | + uses: actions/cache@v4 |
| 29 | + with: |
| 30 | + path: ~/.composer/cache |
| 31 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 32 | + |
| 33 | + - name: composer install |
| 34 | + run: composer install --prefer-dist --no-progress |
| 35 | + |
| 36 | + - name: Setup problem matchers for PHPUnit |
| 37 | + if: matrix.php-version == '8.2' && matrix.os == 'ubuntu-latest' |
| 38 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 39 | + |
| 40 | + - name: Run PHPUnit with coverage |
| 41 | + if: matrix.php-version == '8.2' && matrix.os == 'ubuntu-latest' |
| 42 | + run: | |
| 43 | + export CODECOVERAGE=1 |
| 44 | + vendor/bin/phpunit --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml |
| 45 | +
|
| 46 | + - name: Run PHPUnit without coverage |
| 47 | + if: matrix.php-version != '8.2' || matrix.os != 'ubuntu-latest' |
| 48 | + run: vendor/bin/phpunit |
| 49 | + |
| 50 | + - name: Submit code coverage |
| 51 | + if: matrix.php-version == '8.2' && matrix.os == 'ubuntu-latest' |
| 52 | + uses: codecov/codecov-action@v3 |
| 53 | + |
| 54 | + cs-stan: |
| 55 | + name: Coding Standard & Static Analysis |
| 56 | + runs-on: ubuntu-latest |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Setup PHP |
| 62 | + uses: shivammathur/setup-php@v2 |
| 63 | + with: |
| 64 | + php-version: '8.2' |
| 65 | + extensions: mbstring, intl |
| 66 | + coverage: none |
| 67 | + |
| 68 | + - name: Cache composer dependencies |
| 69 | + uses: actions/cache@v4 |
| 70 | + with: |
| 71 | + path: ~/.composer/cache |
| 72 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 73 | + |
| 74 | + - name: composer install |
| 75 | + run: composer install --prefer-dist --no-progress |
| 76 | + |
| 77 | + - name: Setup PHPStan |
| 78 | + run: composer stan-setup |
| 79 | + |
| 80 | + - name: Run PHP CodeSniffer |
| 81 | + run: composer cs-check |
| 82 | + |
| 83 | + - name: Run phpstan |
| 84 | + run: composer stan |
0 commit comments