Task 64 readiness + smoke harness #600
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Cancel in-progress runs for the same branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Environment variables for caching | |
| env: | |
| NODE_VERSION: '22.20.0' | |
| PNPM_VERSION: '10.19.0' | |
| jobs: | |
| # Setup: Install dependencies once and cache for all jobs | |
| setup: | |
| name: Setup & Install Dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Cache node_modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| examples/*/node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| node-modules-${{ runner.os }}- | |
| - name: Install dependencies | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: pnpm install --frozen-lockfile | |
| # Lint: Check code quality | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| needs: [setup, build] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| examples/*/node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| fail-on-cache-miss: true | |
| - name: Restore build outputs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| packages/*/dist | |
| packages/*/*.tsbuildinfo | |
| examples/*/build | |
| examples/*/dist | |
| packages/php-json-ast/vendor | |
| key: build-${{ runner.os }}-${{ hashFiles('packages/*/src/**','examples/*/src/**','tsconfig*.json','pnpm-lock.yaml','packages/php-json-ast/composer.lock','packages/php-json-ast/composer.json') }} | |
| fail-on-cache-miss: true | |
| - name: Run ESLint | |
| run: pnpm lint | |
| - name: Check Prettier formatting | |
| run: pnpm format:check | |
| - name: TypeScript type check | |
| run: pnpm typecheck | |
| # Build: Ensure all packages build successfully | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| # Moved PHP setup here so build artefacts reflect the PHP toolchain | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| tools: composer | |
| coverage: none | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| examples/*/node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| fail-on-cache-miss: true | |
| - name: Cache build outputs | |
| id: cache-build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| packages/*/dist | |
| packages/*/*.tsbuildinfo | |
| examples/*/build | |
| examples/*/dist | |
| packages/php-json-ast/vendor | |
| key: build-${{ runner.os }}-${{ hashFiles('packages/*/src/**','examples/*/src/**','tsconfig*.json','pnpm-lock.yaml','packages/php-json-ast/composer.lock','packages/php-json-ast/composer.json') }} | |
| restore-keys: | | |
| build-${{ runner.os }}- | |
| - name: Build packages | |
| if: steps.cache-build.outputs.cache-hit != 'true' | |
| run: pnpm build | |
| - name: Upload build artifacts (fallback) | |
| if: steps.cache-build.outputs.cache-hit != 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: | | |
| packages/*/dist | |
| examples/*/build | |
| retention-days: 1 | |
| # Unit Tests: Run Jest tests | |
| unit-test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: [setup, build] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| tools: composer | |
| coverage: none | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| examples/*/node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| fail-on-cache-miss: true | |
| - name: Restore build outputs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| packages/*/dist | |
| packages/*/*.tsbuildinfo | |
| examples/*/build | |
| examples/*/dist | |
| packages/php-json-ast/vendor | |
| key: build-${{ runner.os }}-${{ hashFiles('packages/*/src/**','examples/*/src/**','tsconfig*.json','pnpm-lock.yaml','packages/php-json-ast/composer.lock','packages/php-json-ast/composer.json') }} | |
| fail-on-cache-miss: true | |
| - name: Run unit tests with coverage | |
| run: pnpm test:coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| name: unit-tests | |
| fail_ci_if_error: false | |
| release-pack: | |
| name: Release Pack Readiness | |
| runs-on: ubuntu-latest | |
| needs: [setup, build] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| examples/*/node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| fail-on-cache-miss: true | |
| - name: Restore build outputs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| packages/*/dist | |
| packages/*/*.tsbuildinfo | |
| examples/*/build | |
| examples/*/dist | |
| packages/php-json-ast/vendor | |
| key: build-${{ runner.os }}-${{ hashFiles('packages/*/src/**','examples/*/src/**','tsconfig*.json','pnpm-lock.yaml','packages/php-json-ast/composer.lock','packages/php-json-ast/composer.json') }} | |
| fail-on-cache-miss: true | |
| - name: Verify release pack readiness idempotency | |
| run: pnpm --filter @wpkernel/cli exec tsx scripts/check-release-pack-ci.ts | |
| bootstrapper: | |
| name: Bootstrapper Resolution | |
| runs-on: ubuntu-latest | |
| needs: [setup, build] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Restore node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| examples/*/node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| fail-on-cache-miss: true | |
| - name: Restore build outputs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| packages/*/dist | |
| packages/*/*.tsbuildinfo | |
| examples/*/build | |
| examples/*/dist | |
| packages/php-json-ast/vendor | |
| key: build-${{ runner.os }}-${{ hashFiles('packages/*/src/**','examples/*/src/**','tsconfig*.json','pnpm-lock.yaml','packages/php-json-ast/composer.lock','packages/php-json-ast/composer.json') }} | |
| fail-on-cache-miss: true | |
| - name: Verify bootstrapper resolution | |
| run: pnpm --filter @wpkernel/cli exec tsx scripts/check-bootstrapper-resolution-ci.ts | |
| # E2E Tests (disabled) | |
| # e2e-test: | |
| # name: E2E Tests | |
| # runs-on: ubuntu-latest | |
| # needs: [setup, build] | |
| # steps: | |
| # - name: Checkout | |
| # uses: actions/checkout@v4 | |
| # - name: Setup pnpm | |
| # uses: pnpm/action-setup@v4 | |
| # with: | |
| # version: ${{ env.PNPM_VERSION }} | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: ${{ env.NODE_VERSION }} | |
| # - name: Restore node_modules | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # node_modules | |
| # packages/*/node_modules | |
| # examples/*/node_modules | |
| # key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| # fail-on-cache-miss: true | |
| # - name: Restore build outputs | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # packages/*/dist | |
| # packages/*/*.tsbuildinfo | |
| # examples/*/build | |
| # examples/*/dist | |
| # key: build-${{ runner.os }}-${{ hashFiles('packages/*/src/**', 'examples/*/src/**', 'tsconfig*.json', 'pnpm-lock.yaml') }} | |
| # fail-on-cache-miss: true | |
| # - name: Start WordPress (wp-env) | |
| # run: pnpm wp:start | |
| # - name: Seed test data | |
| # run: pnpm wp:seed | |
| # - name: Run E2E tests | |
| # run: pnpm e2e --project=chromium --workers=1 | |
| # - name: Upload Playwright report | |
| # if: failure() | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: playwright-report | |
| # path: playwright-report/ | |
| # retention-days: 7 | |
| # - name: Upload test results | |
| # if: failure() | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: test-results | |
| # path: test-results/ | |
| # retention-days: 7 | |
| # if-no-files-found: ignore | |
| # All checks passed | |
| all-checks: | |
| name: All Checks Passed | |
| runs-on: ubuntu-latest | |
| needs: [lint, build, unit-test, release-pack, bootstrapper] | |
| if: always() | |
| steps: | |
| - name: Check status | |
| run: | | |
| if [[ "${{ needs.lint.result }}" != "success" ]] || \ | |
| [[ "${{ needs.build.result }}" != "success" ]] || \ | |
| [[ "${{ needs.unit-test.result }}" != "success" ]] || \ | |
| [[ "${{ needs.release-pack.result }}" != "success" ]]; then | |
| echo "❌ One or more checks failed" | |
| exit 1 | |
| fi | |
| echo "✅ All checks passed!" |