improve tests #16
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: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| php_version: | |
| description: 'PHP version to test' | |
| required: true | |
| default: '7.4' | |
| type: choice | |
| options: | |
| - '5.6' | |
| - '7.0' | |
| - '7.1' | |
| - '7.2' | |
| - '7.3' | |
| - '7.4' | |
| - '8.0' | |
| - '8.1' | |
| - '8.2' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] | |
| #if: ${{ github.event_name != 'workflow_dispatch' || contains(github.event.inputs.php_version, matrix.php) }} | |
| name: PHP ${{ matrix.php }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| tools: composer:v2 | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: | | |
| if [[ "${{ matrix.php }}" == "5.6" ]]; then | |
| composer require --dev phpunit/phpunit:^5.7 --no-update | |
| elif [[ "${{ matrix.php }}" == "7.0" ]]; then | |
| composer require --dev phpunit/phpunit:^6.5 --no-update | |
| elif [[ "${{ matrix.php }}" == "7.1" || "${{ matrix.php }}" == "7.2" ]]; then | |
| composer require --dev phpunit/phpunit:^7.5 --no-update | |
| elif [[ "${{ matrix.php }}" == "7.3" || "${{ matrix.php }}" == "7.4" ]]; then | |
| composer require --dev phpunit/phpunit:^8.5 --no-update | |
| else | |
| composer require --dev phpunit/phpunit:^9.5 --no-update | |
| fi | |
| composer install --prefer-dist --no-progress | |
| - name: Run PHPUnit | |
| run: composer test | |
| - name: Run PHPStan | |
| if: ${{ matrix.php >= '7.4' }} | |
| run: composer phpstan | |
| - name: Run CodeSniffer | |
| if: ${{ matrix.php >= '7.4' }} | |
| run: composer cs-check |