Merge pull request #1 from InitPHP/2.x #3
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, 2.x, 1.x] | |
| pull_request: | |
| branches: [main, 2.x, 1.x] | |
| permissions: | |
| contents: read | |
| jobs: | |
| tests: | |
| name: PHP ${{ matrix.php }} / ${{ matrix.dependencies }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4'] | |
| dependencies: [highest] | |
| include: | |
| - php: '8.1' | |
| dependencies: lowest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: openssl, sodium | |
| coverage: none | |
| tools: composer:v2 | |
| - name: Validate composer.json | |
| run: composer validate --strict | |
| - 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@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.dependencies }}- | |
| - name: Install dependencies (highest) | |
| if: matrix.dependencies == 'highest' | |
| run: composer update --no-interaction --no-progress --prefer-dist | |
| - name: Install dependencies (lowest) | |
| if: matrix.dependencies == 'lowest' | |
| run: composer update --no-interaction --no-progress --prefer-dist --prefer-lowest | |
| - name: Run tests | |
| run: composer test | |
| static-analysis: | |
| name: Static analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: openssl, sodium | |
| coverage: none | |
| tools: composer:v2 | |
| - name: Install dependencies | |
| run: composer update --no-interaction --no-progress --prefer-dist | |
| - name: PHPStan | |
| run: composer phpstan | |
| coding-style: | |
| name: Coding style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: openssl, sodium | |
| coverage: none | |
| tools: composer:v2, php-cs-fixer | |
| - name: Install dependencies | |
| run: composer update --no-interaction --no-progress --prefer-dist | |
| - name: Check style | |
| run: composer cs-check |