update github action and fix code style #2
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: Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight | |
| env: | |
| COMPOSER_PROCESS_TIMEOUT: 0 | |
| COMPOSER_NO_INTERACTION: 1 | |
| COMPOSER_NO_AUDIT: 1 | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| php: [8.2, 8.3, 8.4] | |
| laravel: [11.*, 12.*] | |
| stability: [prefer-lowest, prefer-stable] | |
| exclude: | |
| # Skip incompatible PHP versions and Laravel versions | |
| - php: 8.2 | |
| laravel: 12.* | |
| - php: 8.4 | |
| stability: prefer-lowest | |
| name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, exif, iconv | |
| coverage: xdebug | |
| ini-values: error_reporting=E_ALL | |
| tools: composer:v2 | |
| - name: Setup problem matchers | |
| run: | | |
| echo "::add-matcher::/opt/hostedtoolcache/php.json" | |
| echo "::add-matcher::/opt/hostedtoolcache/phpunit.json" | |
| shell: /usr/bin/bash -e {0} | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}-${{ matrix.stability }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}- | |
| ${{ runner.os }}-composer-${{ matrix.php }}- | |
| - name: Install dependencies | |
| run: | | |
| composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update | |
| composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| - name: Run PHPUnit tests | |
| run: vendor/bin/phpunit --coverage-text | |
| - name: Run PHP Static Analysis | |
| run: | | |
| if [ -f vendor/bin/phpstan ]; then | |
| vendor/bin/phpstan analyse | |
| fi |