add github action #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: Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight | |
| 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 | |
| - name: Setup problem matchers | |
| run: | | |
| echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
| echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
| - 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 analyze | |
| fi |