Update dependency vitest to v5 #594
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: | |
| permissions: | |
| contents: read | |
| # Cancel superseded runs on the same ref (e.g. rapid pushes to a PR). | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: check + test | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Actions are pinned to a full commit SHA (org policy). | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| # setup-vp installs vp (version resolved from the pnpm catalog), the | |
| # Node.js and pnpm pinned in devEngines, and the project dependencies, | |
| # with lockfile-keyed caching. | |
| - uses: voidzero-dev/setup-vp@49c3e4e92c52e7f8392712a9267bbe71c5ab30e5 # v1.19.0 | |
| with: | |
| cache: true | |
| # Fail when the lockfile carries duplicate dependency entries that a | |
| # dedupe would collapse (Renovate PRs are deduped via the shared | |
| # preset's pnpmDedupe post-update option; this gates everyone else). | |
| - name: Dedupe check | |
| run: vp dedupe --check | |
| # vp check runs oxfmt, oxlint and the type-aware pass (tsgolint), | |
| # covering both tsconfig projects (Worker + publish action). | |
| - name: Check | |
| run: vp check | |
| # The publish action bundles the Worker's own modules; re-bundle and fail | |
| # if the committed dist drifts (or an import it pulls in broke). | |
| - name: Verify action bundle is up to date | |
| run: | | |
| vp run build:action | |
| git diff --exit-code -- .github/actions/publish-preview/dist | |
| # The steps above prove the bundle rebuilds reproducibly; these prove it | |
| # RUNS. `uses: ./` executes the committed dist exactly as a consumer | |
| # would (action.yml -> node24 -> dist/index.mjs), in the network-free | |
| # `pack` mode against a throwaway fixture in RUNNER_TEMP (outside the | |
| # checkout, so pnpm cannot mistake it for this workspace). It exercises | |
| # input parsing, ref/version derivation, glob expansion, batch | |
| # validation of a cross-package dep, `pnpm pack`, and the artifact | |
| # contract (pkg-<n>.tgz + manifest.json + the `version` output). | |
| - name: Prepare action smoke fixture | |
| run: | | |
| # The action shells out to `pnpm pack` and documents that consumers | |
| # provide pnpm (action.yml: "run pnpm/action-setup and `pnpm install` | |
| # first"). setup-vp keeps its managed pnpm internal to vp, so install | |
| # the devEngines-pinned version for the smoke run; vp's global bin | |
| # dir is already on PATH. | |
| vp install -g "pnpm@$(node -p 'require("./package.json").devEngines.packageManager.version')" | |
| mkdir -p "$RUNNER_TEMP/action-smoke/pkgs/pkg-a" "$RUNNER_TEMP/action-smoke/pkgs/pkg-b" | |
| cat > "$RUNNER_TEMP/action-smoke/pkgs/pkg-a/package.json" <<'EOF' | |
| { "name": "@bridge-smoke/pkg-a", "version": "0.0.0" } | |
| EOF | |
| cat > "$RUNNER_TEMP/action-smoke/pkgs/pkg-b/package.json" <<'EOF' | |
| { | |
| "name": "@bridge-smoke/pkg-b", | |
| "version": "0.0.0", | |
| "dependencies": { "@bridge-smoke/pkg-a": "0.0.0" } | |
| } | |
| EOF | |
| - name: Smoke-run action bundle (pack mode) | |
| id: action-smoke | |
| uses: ./ | |
| with: | |
| mode: pack | |
| sha: ${{ github.sha }} | |
| packages: ${{ runner.temp }}/action-smoke/pkgs/* | |
| workspace-packages: '@bridge-smoke/*' | |
| output-dir: ${{ runner.temp }}/action-smoke/out | |
| - name: Verify smoke output | |
| env: | |
| VERSION: ${{ steps.action-smoke.outputs.version }} | |
| run: | | |
| out="$RUNNER_TEMP/action-smoke/out" | |
| ls -l "$out" | |
| test -s "$out/pkg-0.tgz" | |
| test -s "$out/pkg-1.tgz" | |
| tar -tzf "$out/pkg-0.tgz" | grep -qx 'package/package.json' | |
| jq -e --arg v "$VERSION" \ | |
| '.version == $v and [.packages[].name] == ["@bridge-smoke/pkg-a", "@bridge-smoke/pkg-b"]' \ | |
| "$out/manifest.json" | |
| # vitest runs the Worker in workerd (Miniflare); no network or secrets. | |
| # The deploy-time check (bun e2e) needs a live deployment and runs from | |
| # `vp run deploy`, not here. | |
| - name: Test | |
| run: vp test |