CI Examples #1026
Workflow file for this run
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 Examples | |
| on: | |
| pull_request: | |
| paths: | |
| - 'examples/**' | |
| - 'packages/superdoc/**' | |
| - 'packages/react/**' | |
| - 'packages/super-editor/**' | |
| - 'packages/collaboration-yjs/**' | |
| - 'packages/sdk/**' | |
| - 'packages/layout-engine/**' | |
| - 'shared/**' | |
| merge_group: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build superdoc | |
| run: pnpm build:superdoc | |
| - name: Build React wrapper | |
| run: pnpm --filter @superdoc-dev/react build | |
| - name: Build collaboration package | |
| run: pnpm --filter @superdoc-dev/superdoc-yjs-collaboration build | |
| - name: Install Playwright | |
| working-directory: examples/__tests__ | |
| run: npx playwright install chromium | |
| - name: Cache workspace | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| . | |
| ~/.cache/ms-playwright | |
| key: examples-workspace-${{ github.sha }} | |
| getting-started: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: [react, vue, vanilla, cdn, angular, nuxt, laravel] | |
| steps: | |
| - name: Restore workspace | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| . | |
| ~/.cache/ms-playwright | |
| key: examples-workspace-${{ github.sha }} | |
| - name: Setup PHP | |
| if: matrix.example == 'laravel' | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| - name: Install Composer dependencies | |
| if: matrix.example == 'laravel' | |
| working-directory: examples/getting-started/laravel | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Prepare Laravel environment | |
| if: matrix.example == 'laravel' | |
| working-directory: examples/getting-started/laravel | |
| run: cp .env.example .env && php artisan key:generate | |
| - name: Run smoke test | |
| working-directory: examples/__tests__ | |
| run: EXAMPLE=${{ matrix.example }} npx playwright test | |
| collaboration: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: [superdoc-yjs, hocuspocus, liveblocks] | |
| steps: | |
| - name: Restore workspace | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| . | |
| ~/.cache/ms-playwright | |
| key: examples-workspace-${{ github.sha }} | |
| - name: Create .env for cloud providers | |
| working-directory: examples/collaboration/${{ matrix.example }} | |
| run: | | |
| if [ "${{ matrix.example }}" = "liveblocks" ]; then | |
| echo "VITE_LIVEBLOCKS_PUBLIC_KEY=${{ secrets.VITE_LIVEBLOCKS_PUBLIC_KEY }}" > .env | |
| fi | |
| - name: Run smoke test | |
| working-directory: examples/__tests__ | |
| run: EXAMPLE=collaboration/${{ matrix.example }} npx playwright test | |
| features: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: [track-changes, ai-redlining, comments, custom-toolbar] | |
| steps: | |
| - name: Restore workspace | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| . | |
| ~/.cache/ms-playwright | |
| key: examples-workspace-${{ github.sha }} | |
| - name: Run smoke test | |
| working-directory: examples/__tests__ | |
| run: EXAMPLE=features/${{ matrix.example }} npx playwright test | |
| advanced-headless-toolbar: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: [react-shadcn, react-mui, vue-vuetify, svelte-shadcn, vanilla] | |
| steps: | |
| - name: Restore workspace | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| . | |
| ~/.cache/ms-playwright | |
| key: examples-workspace-${{ github.sha }} | |
| - name: Run smoke test | |
| working-directory: examples/__tests__ | |
| run: EXAMPLE=advanced/headless-toolbar/${{ matrix.example }} npx playwright test | |
| headless: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Restore workspace | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| . | |
| ~/.cache/ms-playwright | |
| key: examples-workspace-${{ github.sha }} | |
| - name: Run headless tests | |
| working-directory: examples/headless/ai-redlining | |
| run: npx tsx src/index.test.ts | |
| validate: | |
| if: always() | |
| needs: [getting-started, collaboration, features, advanced-headless-toolbar, headless] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check results | |
| run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then | |
| exit 1 | |
| fi |