Configure ci workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| branches: | |
| - '*' | |
| jobs: | |
| testsuite: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ['8.1', '8.2', '8.3', '8.4'] | |
| os: [ubuntu-latest, windows-latest] | |
| exclude: | |
| # Exclude PHP 8.4 on Windows as it might not be available yet | |
| - php-version: '8.4' | |
| os: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, intl | |
| coverage: pcov | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Get date part for cache key | |
| id: key-date | |
| run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }} | |
| - name: composer install | |
| run: composer install --prefer-dist --no-progress | |
| - name: Setup problem matchers for PHPUnit | |
| if: matrix.php-version == '8.2' && matrix.os == 'ubuntu-latest' | |
| run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
| - name: Run PHPUnit | |
| run: | | |
| if [[ ${{ matrix.php-version }} == '8.2' && ${{ matrix.os }} == 'ubuntu-latest' ]]; then | |
| export CODECOVERAGE=1 && vendor/bin/phpunit --display-deprecations --display-incomplete --display-skipped --coverage-clover=coverage.xml | |
| else | |
| vendor/bin/phpunit | |
| fi | |
| - name: Submit code coverage | |
| if: matrix.php-version == '8.2' && matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v3 | |
| cs-stan: | |
| name: Coding Standard & Static Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| extensions: mbstring, intl | |
| coverage: none | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Get date part for cache key | |
| id: key-date | |
| run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }} | |
| - name: composer install | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run PHP CodeSniffer | |
| run: composer cs-check | |
| - name: Run phpstan | |
| if: success() || failure() | |
| run: composer stan |