Version Packages #14417
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: Vite plugin playgrounds | |
| on: | |
| merge_group: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
| cancel-in-progress: ${{ github.head_ref != 'changeset-release/main' }} | |
| env: | |
| # We run `playwright install` manually instead | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" | |
| jobs: | |
| test: | |
| # Windows jobs that miss the turbo cache already take 15-25 minutes, and the | |
| # timeouts/retries in `playground/vitest.config.e2e.ts` give slow tests more | |
| # room to finish, so leave headroom before the hard job kill. | |
| timeout-minutes: 45 | |
| name: ${{ format('Vite Plugin Playground ({0}, {1})', matrix.os, matrix.vite) }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| vite: ["vite-8"] | |
| include: | |
| - os: ubuntu-latest | |
| vite: "vite-6" | |
| - os: ubuntu-latest | |
| vite: "vite-7" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Filter changed paths | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: changes | |
| with: | |
| filters: | | |
| everything_but_markdown: | |
| - '!**/*.md' | |
| - name: Install Dependencies | |
| if: steps.changes.outputs.everything_but_markdown == 'true' | |
| uses: ./.github/actions/install-dependencies | |
| with: | |
| turbo-api: ${{ secrets.TURBO_API }} | |
| turbo-team: ${{ secrets.TURBO_TEAM }} | |
| turbo-token: ${{ secrets.TURBO_TOKEN }} | |
| turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} | |
| - name: Install playwright | |
| if: steps.changes.outputs.everything_but_markdown == 'true' | |
| run: | | |
| pnpm --filter @vite-plugin-cloudflare/playground playwright:install | |
| - name: Build plugin with initial Vite version | |
| if: steps.changes.outputs.everything_but_markdown == 'true' | |
| run: | | |
| pnpm dotenv -- pnpm turbo build --filter @cloudflare/vite-plugin | |
| env: | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| # The test steps below pass `--only`, which does not merely skip *running* | |
| # dependencies — it strips them from the cache key as well. Left alone, | |
| # the playground tests are cached on a key that ignores | |
| # `@cloudflare/vite-plugin`, `wrangler`, `miniflare` and `workerd`, so | |
| # they replay from cache and never actually run on internal PRs (#14967). | |
| # | |
| # The turbo hash for `@cloudflare/vite-plugin#build` covers that whole | |
| # dependency graph, so exporting it here and declaring it as a task `env` | |
| # in `playground/turbo.json` restores the invalidation `--only` removed. | |
| # | |
| # This must run before the Vite downgrade steps so that the hash | |
| # describes the plugin that was actually built and tested. | |
| - name: Export plugin build hash for the playground cache key | |
| if: steps.changes.outputs.everything_but_markdown == 'true' | |
| shell: bash | |
| run: | | |
| pnpm dotenv -- pnpm turbo build --filter @cloudflare/vite-plugin --dry=json | | |
| node --input-type=module -e ' | |
| import { readFileSync } from "node:fs"; | |
| const { tasks } = JSON.parse(readFileSync(0, "utf8")); | |
| const task = tasks.find((t) => t.taskId === "@cloudflare/vite-plugin#build"); | |
| if (!task) { | |
| throw new Error("No @cloudflare/vite-plugin#build task in the turbo summary"); | |
| } | |
| console.log(`VITE_PLUGIN_BUILD_HASH=${task.hash}`); | |
| ' >> "$GITHUB_ENV" | |
| # The exact Vite 8 workspace patch is intentionally unused after these | |
| # compatibility-job downgrades. | |
| - name: Downgrade to Vite 6 | |
| if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.vite == 'vite-6' | |
| run: | | |
| pnpm --config.allow-unused-patches=true update -r --no-save vite@^6.1.0 | |
| - name: Downgrade to Vite 7 | |
| if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.vite == 'vite-7' | |
| run: | | |
| pnpm --config.allow-unused-patches=true update -r --no-save vite@^7.0.0 | |
| - name: Run dev playground tests | |
| if: steps.changes.outputs.everything_but_markdown == 'true' | |
| # We use `--only` to prevent TurboRepo from rebuilding dependencies | |
| # This ensures the Vite plugin is not rebuilt using a different Vite version | |
| # `VITE_PLUGIN_BUILD_HASH` puts the stripped dependency hashes back into | |
| # the cache key — see "Export plugin build hash" above | |
| run: | | |
| pnpm dotenv -- pnpm turbo test:ci:serve --filter @vite-plugin-cloudflare/playground --only | |
| env: | |
| VITE_VERSION: ${{ matrix.vite }} | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/ | |
| TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html | |
| NODE_DEBUG: "@cloudflare:vite-plugin" | |
| CI_OS: ${{ matrix.os }} | |
| - name: Run build/preview playground tests | |
| if: steps.changes.outputs.everything_but_markdown == 'true' | |
| # We use `--only` to prevent TurboRepo from rebuilding dependencies | |
| # This ensures the Vite plugin is not rebuilt using a different Vite version | |
| # `VITE_PLUGIN_BUILD_HASH` puts the stripped dependency hashes back into | |
| # the cache key — see "Export plugin build hash" above | |
| run: | | |
| pnpm dotenv -- pnpm turbo test:ci:build --filter @vite-plugin-cloudflare/playground --only | |
| env: | |
| VITE_VERSION: ${{ matrix.vite }} | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/ | |
| TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html | |
| NODE_DEBUG: "@cloudflare:vite-plugin" | |
| CI_OS: ${{ matrix.os }} | |
| - name: Upload turbo logs | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: turbo-runs-${{ matrix.os }}-${{ matrix.vite }} | |
| path: .turbo/runs |