diff --git a/.cloudflare/ci/src/github.ts b/.cloudflare/ci/src/github.ts new file mode 100644 index 0000000..6f6aeec --- /dev/null +++ b/.cloudflare/ci/src/github.ts @@ -0,0 +1,35 @@ +// Based on the helpers in the Cloudflare CI "Get started" guide. +// Changes from the docs: the user-agent, and no source server, because runners +// check out the public repository with git. +const GITHUB_HEADERS = { "user-agent": "setup-vp-ci" }; + +// Get a new checkout in every step. Checkouts cannot be returned from a step. +export async function writeCheck(env: Env, sha: string, name: string, update: ScmCheckUpdate) { + const commit = await env.REPO.checkout({ sha }); + try { + return await commit.checks.write(name, update); + } finally { + commit[Symbol.dispose](); + } +} + +export async function commentOnPullRequest(env: Env, mr: number, body: string) { + const pullRequest = await env.REPO.checkout({ mr }); + try { + return await pullRequest.comments.write(body); + } finally { + pullRequest[Symbol.dispose](); + } +} + +// A pull request checkout does not include its commit SHA, so read it from GitHub. +export async function pullRequestHead(env: Env, mr: number) { + const outbound = await env.REPO.outbound(); + const response = await outbound.fetch( + `https://api.github.com/repos/${env.GITHUB_REPO}/commits/refs/pull/${mr}/head`, + { headers: GITHUB_HEADERS }, + ); + if (!response.ok) throw new Error(`GitHub returned ${response.status}`); + const { sha } = await response.json<{ sha: string }>(); + return sha; +} diff --git a/.cloudflare/ci/src/index.ts b/.cloudflare/ci/src/index.ts new file mode 100644 index 0000000..a33b08e --- /dev/null +++ b/.cloudflare/ci/src/index.ts @@ -0,0 +1,280 @@ +import { + WorkflowEntrypoint, + type RunnerOutput, + type WorkflowEvent, + type WorkflowStep, +} from "cloudflare:workers"; +import { commentOnPullRequest, pullRequestHead, writeCheck } from "./github"; + +type Params = { sha?: string; mr?: number }; + +type Job = { name: string; command: string }; + +type RunContext = { env: Env; step: WorkflowStep; sha: string; runUrl: string }; + +type RunResult = { + passed: boolean; + exitCode: number | null; + /** Why the job failed, when the exit code does not say it. */ + reason?: string; + log?: string; + truncated?: boolean; + error?: string; +}; + +type JobResult = { check: string; passed: boolean; reason?: string; checkRunId: number }; + +type Workspace = { inputs: RunnerOutput[]; installCached: boolean }; + +// The managed image has Node.js 24, Corepack (pnpm and yarn), git, jq, curl, and build-essential. +const IMAGE = "workflows/node"; + +// The repository is public, so a runner can fetch any commit by SHA without a +// token, also the head of a fork PR. deps/ gets only the files that the install +// reads, so the install cache stays valid while they do not change. +const CHECKOUT = [ + "git init -q repo && cd repo", + 'git fetch -q --depth 1 "$REMOTE" "$COMMIT"', + "git checkout -q FETCH_HEAD && git log --oneline -1", + "mkdir -p ../deps && cp package.json pnpm-lock.yaml pnpm-workspace.yaml ../deps/", +].join(" && "); + +// Corepack installs the pnpm version from package.json "packageManager". +// --ignore-scripts skips the root `prepare` script (`vp config`), which sets up +// Git hooks. The install step has only the manifest files, so there is nothing +// to set up. The repository allows no dependency build scripts. +const INSTALL = "cd repo && corepack enable && pnpm install --frozen-lockfile --ignore-scripts"; + +// Each job runs in repo/ with node_modules restored. +const JOBS: Job[] = [ + { + // The "build" job in .github/workflows/test.yml. + name: "build", + command: [ + "pnpm run typecheck", + "pnpm run check", + "pnpm run build", + `{ git diff --exit-code dist/ || { echo "dist/ is out of date. Run 'vp run build' and commit."; exit 1; }; }`, + ].join(" && "), + }, + { + // The "Unit tests (ubuntu-latest)" job. Some tests read dist/, so build first. + name: "unit-tests", + command: ["pnpm run build", "pnpm run test"].join(" && "), + }, +]; + +// Checkout and install can fail on the network, so retry them. +const SETUP_CONFIG = { + retries: { limit: 2, delay: "10 seconds", backoff: "exponential" }, + timeout: "10 minutes", +} as const; + +// Jobs run once. A step timeout fails the step even with allowFailure, and the +// step loses its logs. +const JOB_CONFIG = { retries: { limit: 0, delay: "1 second" }, timeout: "15 minutes" } as const; + +// Stop each job before the step timeout, so that its logs are kept. +// `timeout` exits with 124 when it stops the command. +const COMMAND_TIMEOUT_MINUTES = 14; +const TIMEOUT_EXIT_CODE = 124; + +const RUNNER_ENV = { + CI: "true", + COREPACK_ENABLE_DOWNLOAD_PROMPT: "0", + NPM_CONFIG_UPDATE_NOTIFIER: "false", + // Keep ANSI color codes out of the log in the check summary. + NO_COLOR: "1", + FORCE_COLOR: "0", +}; + +// Bumped on each change, because `instances list` does not show which code ran. +const PIPELINE_VERSION = "2026-11-20.1"; + +export class CI extends WorkflowEntrypoint { + async run(event: WorkflowEvent, step: WorkflowStep) { + const { env } = this; + const { mr } = event.payload; + // The checks and the PR comment link to this run in the Cloudflare dashboard. + const runUrl = env.RUN_URL_BASE + event.instanceId; + + const sha = await step.do("resolve commit", async () => { + if (event.payload.sha) return event.payload.sha; + if (!mr) throw new Error("Pass a sha or an mr"); + return pullRequestHead(env, mr); + }); + + const context: RunContext = { env, step, sha, runUrl }; + await Promise.all(JOBS.map(({ name }) => startCheck(context, name))); + + const { results, installCached } = await runJobs(context); + const passed = results.every((result) => result.passed); + + // Comment only when a check fails. Cloudflare CI cannot update a comment + // yet, so each comment is a new one. + if (mr && !passed) { + await step.do("comment on pull request", () => + commentOnPullRequest(env, mr, formatComment(context, mr, results)), + ); + } + + return { + conclusion: passed ? "passed" : "failed", + sha, + version: PIPELINE_VERSION, + installCached, + results, + }; + } +} + +// Checks out the commit, installs the dependencies, and runs the jobs in +// parallel. If the checkout or the install fails, every check fails. +async function runJobs(context: RunContext) { + let workspace: Workspace; + try { + workspace = await prepareWorkspace(context); + } catch (error) { + const failure: RunResult = { + passed: false, + exitCode: null, + reason: "checkout or install failed", + error: errorMessage(error), + }; + const results = await Promise.all( + JOBS.map(({ name }) => completeCheck(context, name, failure)), + ); + return { results, installCached: false }; + } + + const results = await Promise.all( + JOBS.map(async (job) => + completeCheck(context, job.name, await runJob(context.step, job, workspace.inputs)), + ), + ); + return { results, installCached: workspace.installCached }; +} + +async function prepareWorkspace({ env, step, sha }: RunContext): Promise { + const checkout = await step.runner("checkout", SETUP_CONFIG, { + image: IMAGE, + command: CHECKOUT, + env: { ...RUNNER_ENV, REMOTE: `https://github.com/${env.GITHUB_REPO}.git`, COMMIT: sha }, + outputs: { repo: "repo", deps: "deps" }, + }); + const { repo, deps } = checkout.outputs; + if (!repo || !deps) throw new Error("The checkout saved no files."); + + // Restore the manifest files in repo/, so that node_modules has the same path + // here and in the jobs. cache: true skips the install, and starts no + // container, while the manifest files do not change. + const install = await step.runner("install", SETUP_CONFIG, { + image: IMAGE, + command: INSTALL, + env: RUNNER_ENV, + inputs: [{ ...deps, path: "repo" }], + outputs: { modules: "repo/node_modules" }, + cache: true, + }); + const { modules } = install.outputs; + if (!modules) throw new Error("The install saved no node_modules."); + + return { inputs: [repo, modules], installCached: install.cached === true }; +} + +// Step timeouts and container errors throw, even with allowFailure. Catch them, +// so that the check fails and does not stay in progress. +async function runJob( + step: WorkflowStep, + { name, command }: Job, + inputs: RunnerOutput[], +): Promise { + try { + const run = await step.runner(name, JOB_CONFIG, { + image: IMAGE, + // JOB_COMMAND keeps the quotes in the job command intact inside `sh -c`. + command: `timeout ${COMMAND_TIMEOUT_MINUTES}m sh -c "$JOB_COMMAND"`, + env: { ...RUNNER_ENV, JOB_COMMAND: `cd repo && corepack enable && ${command}` }, + inputs, + instanceSize: "standard-3", + allowFailure: true, + }); + // The runner returns one combined log stream: { data, truncated }. + return { + passed: run.exitCode === 0, + exitCode: run.exitCode, + log: run.logs.data, + truncated: run.logs.truncated, + }; + } catch (error) { + return { passed: false, exitCode: null, reason: "runner error", error: errorMessage(error) }; + } +} + +function checkName(name: string) { + return `cloudflare-ci/${name}`; +} + +function startCheck({ env, step, sha, runUrl }: RunContext, name: string) { + return step.do(`start ${name}`, () => + writeCheck(env, sha, checkName(name), { status: "in_progress", detailsUrl: runUrl }), + ); +} + +async function completeCheck( + { env, step, sha, runUrl }: RunContext, + name: string, + result: RunResult, +): Promise { + const check = checkName(name); + const reason = result.passed ? undefined : failureReason(result); + const { checkRunId } = await step.do(`complete ${name}`, () => + writeCheck(env, sha, check, { + status: "completed", + conclusion: result.passed ? "success" : "failure", + title: reason === undefined ? "Passed" : `Failed (${reason})`, + summary: formatSummary(result), + detailsUrl: runUrl, + }), + ); + return { check, passed: result.passed, reason, checkRunId }; +} + +function failureReason({ exitCode, reason }: RunResult) { + if (reason !== undefined) return reason; + if (exitCode === TIMEOUT_EXIT_CODE) return `timed out after ${COMMAND_TIMEOUT_MINUTES} minutes`; + return `exit ${exitCode}`; +} + +function errorMessage(error: unknown) { + return error instanceof Error ? `${error.name}: ${error.message}` : String(error); +} + +// The runner keeps at most 16 KiB of log, which fits in a check summary +// (65,535 characters). The four-backtick fence allows ``` in the log. +function formatSummary({ log, truncated, error }: RunResult) { + if (error !== undefined) return error; + const heading = truncated ? "The last 16 KiB of the runner log:" : "The runner log:"; + return `${heading}\n\n\`\`\`\`text\n${log ?? ""}\n\`\`\`\``; +} + +// Each check name links to its check page on the PR, which shows the runner log. +function formatComment({ env, sha, runUrl }: RunContext, mr: number, results: JobResult[]) { + const checksUrl = `https://github.com/${env.GITHUB_REPO}/pull/${mr}/checks`; + const lines = results.map( + ({ check, passed, reason, checkRunId }) => + `- ${passed ? "✅" : "❌"} [\`${check}\`](${checksUrl}?check_run_id=${checkRunId})` + + (reason === undefined ? "" : ` (${reason})`), + ); + return [ + `Cloudflare CI on \`${sha.slice(0, 7)}\`:`, + ...lines, + "", + `[View the run in the Cloudflare dashboard](${runUrl})`, + ].join("\n"); +} + +// The Worker serves no HTTP requests. The checkout no longer needs a source server. +export default { + fetch: () => new Response("Not found", { status: 404 }), +} satisfies ExportedHandler; diff --git a/.cloudflare/ci/src/runner.d.ts b/.cloudflare/ci/src/runner.d.ts new file mode 100644 index 0000000..84a4687 --- /dev/null +++ b/.cloudflare/ci/src/runner.d.ts @@ -0,0 +1,57 @@ +// Types for step.runner(). @cloudflare/workers-types does not include it yet. +// The result shape comes from the runtime. The docs show `logs.stdout` and +// `logs.stderr`, but the runtime returns one combined stream in `logs`. +export {}; + +declare module "cloudflare:workers" { + interface WorkflowStep { + runner(name: string, options: RunnerOptions): Promise; + runner(name: string, config: WorkflowStepConfig, options: RunnerOptions): Promise; + } + + /** + * A saved output of a runner. Pass it to `inputs` of a later runner. Change + * `path` to restore the files somewhere else. Treat the other fields as opaque. + */ + export interface RunnerOutput { + /** Where the files are restored, relative to /workspace. */ + path: string; + /** The SHA-256 of the content. The cache key includes it. */ + hash: string; + } + + export interface RunnerOptions { + /** A shell script, run with /bin/sh in /workspace as root. */ + command: string; + /** A managed image name or an image in the account's registry. */ + image?: + | "cloudflare/debian-trixie" + | "workflows/node" + | "workflows/python" + | { repository: string; digest: string }; + /** Restored in order. A later input at the same or a parent path replaces earlier ones. */ + inputs?: RunnerOutput[]; + /** Output name to a path to save after the command. */ + outputs?: Record; + /** Not for secrets: values can appear in logs and step output. */ + env?: Record; + instanceSize?: "lite" | "basic" | "standard-1" | "standard-2" | "standard-3" | "standard-4"; + allowFailure?: boolean; + /** + * Reuse the result of an earlier run with the same image, command, env, + * outputs, allowFailure, and input hashes and paths. Results are kept for + * 7 days. Allowed failures are cached too. + */ + cache?: boolean | { key?: string }; + } + + export interface RunnerResult { + exitCode: number; + /** The last 16 KiB of stdout and stderr, combined in order. */ + logs: { data: string; truncated: boolean }; + /** `null` when the path did not exist after an allowed failure. */ + outputs: Record; + /** Set when the result came from the cache and no container ran. */ + cached?: true; + } +} diff --git a/.cloudflare/ci/src/scm.d.ts b/.cloudflare/ci/src/scm.d.ts new file mode 100644 index 0000000..5129dd4 --- /dev/null +++ b/.cloudflare/ci/src/scm.d.ts @@ -0,0 +1,36 @@ +// Copied from the Cloudflare CI "Get started" guide. +// Wrangler does not generate types for the scm binding yet. +// Changes from the docs: Env has RUN_URL_BASE and no source server variables. +interface ScmRepository { + checkout(target: { sha: string }): Promise; + checkout(target: { mr: number }): Promise; + outbound(): Promise; +} + +interface ScmCheckout { + readonly checks: { + write(name: string, update: ScmCheckUpdate): Promise<{ checkRunId: number; url: string }>; + }; + readFile(file: { path: string }): Promise; +} + +interface ScmCheckUpdate { + status: "queued" | "in_progress" | "completed"; + conclusion?: "success" | "failure" | "neutral" | "cancelled"; + title?: string; + summary?: string; + detailsUrl?: string; +} + +interface ScmMergeRequestCheckout extends ScmCheckout { + readonly comments: { + write(body: string): Promise<{ commentId: number; url: string }>; + }; +} + +interface Env { + REPO: ScmRepository; + CI_WORKFLOW: Workflow; + GITHUB_REPO: string; + RUN_URL_BASE: string; +} diff --git a/.cloudflare/ci/tsconfig.json b/.cloudflare/ci/tsconfig.json new file mode 100644 index 0000000..76ac972 --- /dev/null +++ b/.cloudflare/ci/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "Bundler", + "lib": ["ESNext"], + "types": ["@cloudflare/workers-types"], + "strict": true, + "noEmit": true, + "skipLibCheck": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "verbatimModuleSyntax": true, + "isolatedModules": true + }, + "include": ["src/**/*"] +} diff --git a/.cloudflare/ci/wrangler.jsonc b/.cloudflare/ci/wrangler.jsonc new file mode 100644 index 0000000..3c53d7a --- /dev/null +++ b/.cloudflare/ci/wrangler.jsonc @@ -0,0 +1,33 @@ +{ + // Cloudflare CI pipeline for this repository. See CONTRIBUTING.md#cloudflare-ci. + "name": "setup-vp-ci", + "main": "src/index.ts", + "compatibility_date": "2026-11-01", + // The Worker serves no HTTP requests, so it needs no workers.dev URL. + "workers_dev": false, + "workflows": [{ "name": "setup-vp-ci", "binding": "CI_WORKFLOW", "class_name": "CI" }], + "vars": { + "GITHUB_REPO": "voidzero-dev/setup-vp", + // The dashboard URL of a run, without the instance ID. Checks link to it. + "RUN_URL_BASE": "https://dash.cloudflare.com/f8b59a295069bd81a0f256b7012f2c53/workers/workflows/setup-vp-ci/instance/", + }, + "unsafe": { + "bindings": [ + { + "type": "scm", + "name": "REPO", + "provider": "github", + "repo": "voidzero-dev/setup-vp", + "scopes": [ + "contents:read", + "checks:write", + "comments:write", + "merge_requests:read", + // pullRequestHead() reads the PR head SHA through outbound(). + "outbound:read", + ], + }, + ], + }, + "observability": { "enabled": true }, +} diff --git a/.fallowrc.json b/.fallowrc.json index 8894caf..0d56a53 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -1,5 +1,11 @@ { "$schema": "./node_modules/fallow/schema.json", - "entry": ["src/index.ts", "src/gitlab/index.ts", "src/azure/index.ts"], + "entry": [ + "src/index.ts", + "src/gitlab/index.ts", + "src/azure/index.ts", + ".cloudflare/ci/src/index.ts" + ], + "ignorePatterns": ["!.cloudflare/**"], "ignoreDependencies": ["@e18e/eslint-plugin"] } diff --git a/AGENTS.md b/AGENTS.md index b3d7395..744c605 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,6 +8,7 @@ setup-vp installs [Vite+](https://viteplus.dev) (`vp`) through GitHub Actions, G - For GitHub Actions behavior, start with `action.yml` and `src/index.ts`; input parsing and schemas live in `src/inputs.ts` and `src/types.ts`. - For GitLab or Azure behavior, start with `src/gitlab/index.ts` or `src/azure/index.ts` and the corresponding templates and bootstrap scripts in `gitlab/` or `azure/`. See [Integration Design](CONTRIBUTING.md#integration-design) for the design references. - For behavior shared across integrations, start with `src/ci/` and the corresponding adapters under `src/`, `src/gitlab/`, and `src/azure/`. +- For the Cloudflare CI pipeline, start with `.cloudflare/ci/src/index.ts` and follow [Cloudflare CI](CONTRIBUTING.md#cloudflare-ci). Its jobs mirror the `build` and Linux unit test jobs in `.github/workflows/test.yml`. ## Implementation Constraints diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67ab93a..3dc21b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ The action uses the exact `fallow` version in `package.json`. After `vp install` vp exec fallow audit --base origin/main ``` -[`.fallowrc.json`](.fallowrc.json) declares the three runtime entry points. Fallow excludes generated files under `dist/` by default. Results appear in annotations, CI logs, and the job summary. The workflow does not write PR comments. +[`.fallowrc.json`](.fallowrc.json) declares the three runtime entry points and the [Cloudflare CI](#cloudflare-ci) pipeline entry point. Fallow skips hidden directories by default, so the configuration includes `.cloudflare/` explicitly. Fallow excludes generated files under `dist/` by default. Results appear in annotations, CI logs, and the job summary. The workflow does not write PR comments. ## Integration Design @@ -108,6 +108,78 @@ For a standalone run, omit `pull_request`. Set `setup_ref` to an exact commit SH Pushes, merge queue commits, merges, and release tags do not automatically start GitLab pipelines. Release PRs must pass the full suite on their current head commit before merging; follow the [release procedure](#releasing). +## Cloudflare CI + +[`.cloudflare/ci/`](.cloudflare/ci/) contains a Cloudflare CI pipeline. Cloudflare CI is in preview. The pipeline runs two jobs from [`test.yml`](.github/workflows/test.yml) in Cloudflare runners and reports them as GitHub checks: + +- `cloudflare-ci/build`: `typecheck`, `check`, `build`, and a check that `dist/` is up to date. +- `cloudflare-ci/unit-tests`: `build`, then `test`. + +The other jobs in `test.yml` run the action through `uses: ./`, so they stay on GitHub Actions. The Cloudflare CI checks are not required checks. + +The pipeline is a Workflow in the `setup-vp-ci` Worker of the `VoidZero-docs` Cloudflare account. The deployed version runs for every branch. A change under `.cloudflare/ci/` takes effect only after a deploy, so a PR that changes the pipeline still runs the deployed version. + +To use Wrangler, you need access to the `VoidZero-docs` account. Run `npx wrangler@4.163.0 login` first. + +### Start a Run + +GitHub triggers are not available yet, so start each run with Wrangler: + +```bash +cd .cloudflare/ci + +# A pull request: posts the checks, and a PR comment if a check fails. +npx wrangler@4.163.0 workflows trigger setup-vp-ci '{"mr":123}' + +# A commit (full SHA): posts or updates the checks, with no comment. +npx wrangler@4.163.0 workflows trigger setup-vp-ci "{\"sha\":\"$(git rev-parse HEAD)\"}" + +# Follow runs. +npx wrangler@4.163.0 workflows instances list setup-vp-ci +npx wrangler@4.163.0 workflows instances describe setup-vp-ci +``` + +An `mr` run posts a PR comment only when a check fails. Cloudflare CI cannot update a comment yet, so each failed run posts a new one. A second run on the same commit updates the same checks. + +### Read Logs + +- Each check summary shows the runner log, up to its last 16 KiB. The runner keeps no more than that. +- In the PR comment, each check name links to its check page on the PR, which shows the log. +- The **Details** link of each check and the last link in the PR comment open the run in the Cloudflare dashboard. Only members of the `VoidZero-docs` account can open it. +- `describe` and `describe --json` cut each step output to about 1 KiB. Use them for the step status and the run error, not for logs. +- Each job runs in `timeout 14m`. A job that hangs stops with exit code 124 and keeps its log. The 15-minute step timeout would lose the log. +- To run a failed job again without the other steps before it, restart the run from that job's step. The restart also runs every later step, which includes the PR comment of an `mr` run: + + ```bash + npx wrangler@4.163.0 workflows instances restart setup-vp-ci --from-step-name "unit-tests" + ``` + +### Change the Pipeline + +1. Edit the files in `.cloudflare/ci/src/`, and increase `PIPELINE_VERSION` in `index.ts`. +2. Run `vp check`. It formats, lints, and type-checks the pipeline with [`.cloudflare/ci/tsconfig.json`](.cloudflare/ci/tsconfig.json) and `@cloudflare/workers-types`. +3. After the change merges, deploy from `main`: + + ```bash + cd .cloudflare/ci + npx wrangler@4.163.0 deploy + ``` + +4. Read `output.version` in the result of the next run. A run that starts in the first minutes after a deploy can still use the previous version. The plain `describe` output does not include the return value, so use `--json`: + + ```bash + npx wrangler@4.163.0 workflows instances describe setup-vp-ci --json --step-output=false + ``` + +### Runner Environment + +- Every runner uses the managed `workflows/node` image. It has Node.js 24, Corepack (pnpm and yarn), `git`, `jq`, `curl`, and build-essential. GitHub CI uses `lts/*` from `.node-version`. +- The `checkout` step fetches the commit from GitHub with `git fetch --depth 1`. The repository is public, so this needs no token, also for the head of a fork PR. The `build` job compares `dist/` with `git diff --exit-code`, the same as `test.yml`. +- The `install` step gets only `package.json`, `pnpm-lock.yaml`, and `pnpm-workspace.yaml`, and saves `node_modules` for the jobs. It uses the runner cache, so a run skips it while those files do not change. The cache keeps results for 7 days. `output.installCached` in the run result shows whether the install came from the cache. +- The install uses `pnpm install --ignore-scripts`. The root `prepare` script (`vp config`) sets up Git hooks, and the install step has no repository to set them up in. The repository allows no dependency build scripts, so the flag skips nothing else. +- If the checkout or the install fails, both checks fail with the error. These steps retry 2 times, because network errors can cause them. +- `@cloudflare/workers-types` does not include `step.runner()`. [`runner.d.ts`](.cloudflare/ci/src/runner.d.ts) declares it with the result that the runtime returns, `logs: { data, truncated }`. The Cloudflare CI docs show `logs.stdout` and `logs.stderr` instead. + ## Dependency Updates For same-repository PRs with the `needs-bundle-rebuild` label, [the build workflow](.github/workflows/rebuild-bundle.yml) builds the exact PR commit with read-only access. After a successful build, a maintainer reviews its commit and dispatches [the publisher](.github/workflows/publish-bundle.yml) on `main` with that build's run ID: diff --git a/package.json b/package.json index 312dc23..0e07c66 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "zod": "^4.0.0" }, "devDependencies": { + "@cloudflare/workers-types": "^5.20261116.1", "@e18e/eslint-plugin": "^0.8.1", "@types/node": "^24.0.0", "fallow": "3.33.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d76ec65..f37fae9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -200,6 +200,9 @@ importers: specifier: ^4.0.0 version: 4.6.7 devDependencies: + '@cloudflare/workers-types': + specifier: ^5.20261116.1 + version: 5.20261116.1 '@e18e/eslint-plugin': specifier: ^0.8.1 version: 0.8.1(oxlint@1.88.0(oxlint-tsgolint@7.0.2004)(vite-plus@1.3.0(@types/node@24.12.2)(@vitest/ui@5.0.5)(typescript@7.0.2)(yaml@2.9.1))) @@ -313,6 +316,9 @@ packages: '@blazediff/core@1.10.0': resolution: {integrity: sha512-AOQff0zgR7cGsZL+4E7hVkmujoPUpm0J9xzWGWZj5wCjd3gmxESXAPfKyuzs93VdpQNFhHlBhfOjrcZ+XTERtQ==} + '@cloudflare/workers-types@5.20261116.1': + resolution: {integrity: sha512-bym4dNT9Hnm+goedLTTTH85T6S4wOJJaOpKgk9MlEGU18/JKsChN+wHvSWUAIy5YVSm6LnuaUu3d3N4K0m8Dtg==} + '@e18e/eslint-plugin@0.8.1': resolution: {integrity: sha512-OV3T7l0r52/IglskdAuoO+BJyzsCs7AcIHpwpBMlIMO0+3RHskM2h5MuHdLuesIhSRhwCURGMKtp/XwnfXrfxg==} peerDependencies: @@ -1684,6 +1690,8 @@ snapshots: '@blazediff/core@1.10.0': {} + '@cloudflare/workers-types@5.20261116.1': {} + '@e18e/eslint-plugin@0.8.1(oxlint@1.88.0(oxlint-tsgolint@7.0.2004)(vite-plus@1.3.0(@types/node@24.12.2)(@vitest/ui@5.0.5)(typescript@7.0.2)(yaml@2.9.1)))': dependencies: empathic: 2.1.0 diff --git a/src/cloudflare-ci-failure.test.ts b/src/cloudflare-ci-failure.test.ts new file mode 100644 index 0000000..d85f5b5 --- /dev/null +++ b/src/cloudflare-ci-failure.test.ts @@ -0,0 +1,6 @@ +import { expect, it } from "vite-plus/test"; + +// Fails on purpose to show a failed Cloudflare CI check. Do not merge. +it("fails on purpose to show a failed Cloudflare CI check", () => { + expect({ answer: 1 + 1 }).toEqual({ answer: 3 }); +});