[6.x] Blade parity #380
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 / Front End' | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - 6.x | |
| pull_request: | |
| concurrency: | |
| group: js-ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| NODE_VERSION: '22' | |
| PHP_VERSION: '8.5' | |
| jobs: | |
| setup: | |
| name: 'Setup / Install + Build + Generate' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| outputs: | |
| cache-key: ${{ steps.cache-key.outputs.value }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Compute cache key | |
| id: cache-key | |
| # Hash everything that can affect installed deps, the cp build, or the | |
| # generated TS/wayfinder files. PHP source is included because both | |
| # `testbench typescript:transform` and `testbench wayfinder:generate` | |
| # derive their output from controllers, DTOs, and routes in src/. | |
| run: | | |
| echo "value=js-ci-v2-${{ runner.os }}-${{ hashFiles('package-lock.json', 'composer.lock', 'package.json', 'packages/*/package.json', 'packages/craftcms-cp/src/**', 'packages/craftcms-cp/tsconfig*.json', 'packages/craftcms-cp/vite.config.*', 'packages/craftcms-cp/tsdown.config.*', 'src/**/*.php') }}" >> "$GITHUB_OUTPUT" | |
| - name: Restore install + build + generated cache | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| packages/craftcms-cp/dist | |
| vendor | |
| resources/js/actions | |
| resources/js/routes | |
| resources/js/wayfinder | |
| resources/js/generated | |
| key: ${{ steps.cache-key.outputs.value }} | |
| - name: Install Composer dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: composer install --no-interaction --no-progress | |
| - name: Install npm dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Build @craftcms/cp | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm run build:cp | |
| - name: Generate TypeScript types | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm run generate:types | |
| - name: Generate Wayfinder routes | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm run generate:wayfinder | |
| eslint: | |
| name: 'Code Quality / ESLint' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| needs: setup | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Restore install + build + generated cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| packages/craftcms-cp/dist | |
| vendor | |
| resources/js/actions | |
| resources/js/routes | |
| resources/js/wayfinder | |
| resources/js/generated | |
| key: ${{ needs.setup.outputs.cache-key }} | |
| - name: Run ESLint | |
| run: npm run lint:js | |
| typecheck: | |
| name: 'Code Quality / TypeScript' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| needs: setup | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Restore install + build + generated cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| packages/craftcms-cp/dist | |
| vendor | |
| resources/js/actions | |
| resources/js/routes | |
| resources/js/wayfinder | |
| resources/js/generated | |
| key: ${{ needs.setup.outputs.cache-key }} | |
| # Skip the `pretypecheck` hook (it would re-run generate:types + | |
| # generate:wayfinder, which need PHP/Composer that this job doesn't set | |
| # up — the setup job already produced and cached the output). | |
| - name: Run TypeScript type check | |
| run: npm run typecheck |