Upgrade to Pest 5 - use Tia and sharding #1940
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: run-tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - '*.x' | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| jobs: | |
| build-assets: | |
| runs-on: ubuntu-latest | |
| name: Build Assets | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.4 | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - name: Install PHP dependencies | |
| run: | | |
| composer require "laravel/framework:13.x" "orchestra/testbench:^11.0" --no-interaction --no-update | |
| composer update --prefer-dist --no-interaction | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Build assets | |
| run: npm run build | |
| - name: Upload compiled assets | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: public/build | |
| retention-days: 1 | |
| static-analysis: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Dependency ceiling | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-stable | |
| # Dependency floor | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-lowest | |
| # PHP 8.5 (allowed failure) | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| allow-failure: true | |
| continue-on-error: ${{ matrix.allow-failure || false }} | |
| name: Static Analysis - P${{ matrix.php }} - L${{ 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, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - 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: composer-${{ matrix.php }}-${{ matrix.stability }}-${{ hashFiles('composer.json') }} | |
| restore-keys: | | |
| composer-${{ matrix.php }}-${{ matrix.stability }}- | |
| - name: Install dependencies | |
| run: | | |
| composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:^11.0" --no-interaction --no-update | |
| composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| - name: Run PHPStan | |
| run: vendor/bin/phpstan --error-format=github | |
| sqlite: | |
| runs-on: ubuntu-latest | |
| needs: build-assets | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [8.4] | |
| laravel: [13.x] | |
| stability: [prefer-lowest, prefer-stable] | |
| shard: [1/2, 2/2] | |
| include: | |
| # PHP 8.5 (allowed failure) | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 1/2 | |
| allow-failure: true | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 2/2 | |
| allow-failure: true | |
| continue-on-error: ${{ matrix.allow-failure || false }} | |
| name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - SQLite - shard ${{ matrix.shard }} | |
| 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, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - 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: composer-${{ matrix.php }}-${{ matrix.stability }}-${{ hashFiles('composer.json') }} | |
| restore-keys: | | |
| composer-${{ matrix.php }}-${{ matrix.stability }}- | |
| - name: Install dependencies | |
| run: | | |
| composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:^11.0" --no-interaction --no-update | |
| composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| - name: Download compiled assets | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: public/build | |
| - name: Build tests environment | |
| run: composer build | |
| - name: Execute tests | |
| run: composer test:shard -- --shard=${{ matrix.shard }} | |
| mysql: | |
| runs-on: ubuntu-latest | |
| needs: build-assets | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: cachet | |
| MYSQL_USER: cachet | |
| MYSQL_PASSWORD: password | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Dependency ceiling | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 1/2 | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 2/2 | |
| # Dependency floor | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-lowest | |
| shard: 1/2 | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-lowest | |
| shard: 2/2 | |
| # PHP 8.5 (allowed failure) | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 1/2 | |
| allow-failure: true | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 2/2 | |
| allow-failure: true | |
| continue-on-error: ${{ matrix.allow-failure || false }} | |
| name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - MySQL 8.0 - shard ${{ matrix.shard }} | |
| 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, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - 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: composer-${{ matrix.php }}-${{ matrix.stability }}-${{ hashFiles('composer.json') }} | |
| restore-keys: | | |
| composer-${{ matrix.php }}-${{ matrix.stability }}- | |
| - name: Install dependencies | |
| run: | | |
| composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:^11.0" --no-interaction --no-update | |
| composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| - name: Download compiled assets | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: public/build | |
| - name: Build tests environment | |
| run: composer build | |
| - name: Execute tests | |
| run: composer test:shard -- --shard=${{ matrix.shard }} | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_HOST: localhost | |
| DB_DATABASE: cachet | |
| DB_USERNAME: cachet | |
| DB_PASSWORD: password | |
| postgres: | |
| runs-on: ubuntu-latest | |
| needs: build-assets | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_DB: cachet | |
| POSTGRES_USER: cachet | |
| POSTGRES_PASSWORD: password | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Dependency ceiling | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 1/2 | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 2/2 | |
| # Dependency floor | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-lowest | |
| shard: 1/2 | |
| - php: 8.4 | |
| laravel: 13.x | |
| stability: prefer-lowest | |
| shard: 2/2 | |
| # PHP 8.5 (allowed failure) | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 1/2 | |
| allow-failure: true | |
| - php: '8.5' | |
| laravel: 13.x | |
| stability: prefer-stable | |
| shard: 2/2 | |
| allow-failure: true | |
| continue-on-error: ${{ matrix.allow-failure || false }} | |
| name: Tests - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - PostgreSQL 15 - shard ${{ matrix.shard }} | |
| 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, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| - 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: composer-${{ matrix.php }}-${{ matrix.stability }}-${{ hashFiles('composer.json') }} | |
| restore-keys: | | |
| composer-${{ matrix.php }}-${{ matrix.stability }}- | |
| - name: Install dependencies | |
| run: | | |
| composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:^11.0" --no-interaction --no-update | |
| composer update --${{ matrix.stability }} --prefer-dist --no-interaction | |
| - name: Download compiled assets | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: public/build | |
| - name: Build tests environment | |
| run: composer build | |
| - name: Execute tests | |
| run: composer test:shard -- --shard=${{ matrix.shard }} | |
| env: | |
| DB_CONNECTION: pgsql | |
| DB_HOST: localhost | |
| DB_PORT: 5432 | |
| DB_DATABASE: cachet | |
| DB_USERNAME: cachet | |
| DB_PASSWORD: password | |
| check: | |
| if: always() | |
| needs: | |
| - build-assets | |
| - static-analysis | |
| - mysql | |
| - postgres | |
| - sqlite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if all jobs are passing | |
| uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |