Merge 5.11 changes into 6.x #3408
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 / Laravel' | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - 6.x | |
| pull_request: | |
| concurrency: | |
| group: laravel-ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| pint: | |
| name: 'Code Quality / Pint' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: json, dom, curl, libxml, mbstring | |
| tools: composer:v2, laravel/pint | |
| coverage: none | |
| - name: Run Pint | |
| run: pint --parallel --test --verbose | |
| rector: | |
| name: 'Code Quality / Rector' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| coverage: none | |
| env: | |
| COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COMPOSER_AUTH_JSON: | | |
| { | |
| "http-basic": { | |
| "repo.packagist.com": { | |
| "username": "${{ secrets.packagist_username }}", | |
| "password": "${{ secrets.packagist_token }}" | |
| } | |
| } | |
| } | |
| - name: Set version | |
| run: composer config version "6.x-dev" | |
| - name: Install dependencies | |
| uses: ramsey/composer-install@v3 | |
| - name: Rector Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/rector | |
| key: ${{ runner.os }}-rector-${{ github.run_id }} | |
| restore-keys: ${{ runner.os }}-rector- | |
| - run: mkdir -p /tmp/rector | |
| - name: Run Rector | |
| run: vendor/bin/rector process --dry-run --ansi | |
| phpstan: | |
| name: 'Code Quality / Phpstan' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.5' | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Set version | |
| run: composer config version "6.x-dev" | |
| - name: Install composer dependencies | |
| uses: ramsey/composer-install@v3 | |
| - name: PHPStan Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/phpstan | |
| key: ${{ runner.os }}-phpstan-${{ github.run_id }} | |
| restore-keys: ${{ runner.os }}-phpstan- | |
| - name: Run PHPStan | |
| run: ./vendor/bin/phpstan --error-format=github | |
| unit-tests: | |
| needs: [pint, phpstan, rector] | |
| name: 'Tests / Unit on ${{ matrix.os }}' | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # ComponentManifestDriftTest needs the Custom Elements Manifest, which is | |
| # gitignored (packages/craftcms-ui/dist). The cache key hashes everything | |
| # the analyzer reads, so a hit is never stale; the cache itself is shared | |
| # repo-wide, so whichever workflow generates it first serves the rest. On | |
| # a miss the pinned npx run (~seconds) needs no npm install. | |
| - name: Restore Custom Elements Manifest | |
| id: cem | |
| uses: actions/cache@v4 | |
| with: | |
| path: packages/craftcms-ui/dist/custom-elements.json | |
| key: cem-${{ hashFiles('packages/craftcms-ui/src/components/**', 'packages/craftcms-ui/custom-elements-manifest.config.mjs', 'packages/craftcms-ui/package.json', 'packages/craftcms-ui/tsconfig.json') }} | |
| - name: Generate Custom Elements Manifest | |
| if: steps.cem.outputs.cache-hit != 'true' | |
| working-directory: packages/craftcms-ui | |
| run: npx --yes @custom-elements-manifest/analyzer@0.11.0 analyze | |
| - name: Run tests | |
| uses: ./.github/actions/run-tests | |
| with: | |
| test-command: ./vendor/bin/pest --ci --compact --testsuite=Unit | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| packagist-username: ${{ secrets.packagist_username }} | |
| packagist-token: ${{ secrets.packagist_token }} | |
| arch-tests: | |
| needs: [pint, phpstan, rector] | |
| name: 'Tests / Arch' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run tests | |
| uses: ./.github/actions/run-tests | |
| with: | |
| test-command: ./vendor/bin/pest --ci --testsuite=Arch | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| packagist-username: ${{ secrets.packagist_username }} | |
| packagist-token: ${{ secrets.packagist_token }} | |
| feature-tests: | |
| needs: [pint, phpstan, rector] | |
| name: 'Tests / Feature on ${{ matrix.os }} with ${{ matrix.db }}' | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| php: [8.5] | |
| db: [mysql, pgsql, sqlite] | |
| exclude: | |
| # Service containers (mysql/pgsql) are only supported on Linux runners. | |
| - os: windows-latest | |
| db: mysql | |
| - os: windows-latest | |
| db: pgsql | |
| services: | |
| pgsql: | |
| image: ${{ (matrix.os == 'ubuntu-latest' && matrix.db == 'pgsql') && 'postgres:latest' || '' }} | |
| env: | |
| POSTGRES_USER: root | |
| POSTGRES_PASSWORD: mysecretpassword | |
| POSTGRES_DB: craft_test | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 | |
| mysql: | |
| image: ${{ (matrix.os == 'ubuntu-latest' && matrix.db == 'mysql') && 'mysql:8.0' || '' }} | |
| env: | |
| MYSQL_ROOT_PASSWORD: mysecretpassword | |
| MYSQL_DATABASE: craft_test | |
| MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password | |
| options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
| ports: | |
| - 3306:3306 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install libvips | |
| if: matrix.os == 'ubuntu-latest' && matrix.db == 'sqlite' | |
| run: sudo apt-get update && sudo apt-get install -y libvips-dev | |
| - name: Copy tests .env | |
| shell: bash | |
| run: | | |
| cp ./tests/.env.example.${{ matrix.db }} ./tests/.env | |
| sed -i 's/DB_PASSWORD=/DB_PASSWORD=mysecretpassword/' tests/.env | |
| touch database/craft_tests.sqlite | |
| - name: Run tests | |
| uses: ./.github/actions/run-tests | |
| env: | |
| CRAFT_REQUIRE_VIPS: ${{ matrix.os == 'ubuntu-latest' && matrix.db == 'sqlite' && '1' || '' }} | |
| with: | |
| test-command: ./vendor/bin/pest --ci --compact --testsuite=Feature | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| packagist-username: ${{ secrets.packagist_username }} | |
| packagist-token: ${{ secrets.packagist_token }} | |
| yii2-adapter-tests: | |
| needs: [pint, phpstan, rector] | |
| name: 'Tests / Yii2 Adapter' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run tests | |
| uses: ./.github/actions/run-tests | |
| with: | |
| test-command: yii2-adapter/vendor/bin/pest --ci --compact --configuration ./yii2-adapter/phpunit.xml.dist --test-directory ./tests-laravel | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| packagist-username: ${{ secrets.packagist_username }} | |
| packagist-token: ${{ secrets.packagist_token }} | |
| working-directory: yii2-adapter |