@inngest/ci
v0.1.0
Published
Inngest Labs: CI pipelines in TypeScript, run by Inngest on Sandboxes
Readme
@inngest/ci
Inngest Labs: write CI pipelines in TypeScript and run every job on its own Inngest Sandbox.
[!NOTE]
@inngest/ciis an Inngest Labs project: something we are building on the Inngest platform in the open. It is early, moving fast, and shaped by your feedback, so APIs may change between 0.x releases. Sandboxes are in open beta.
@inngest/ci turns plain TypeScript functions into CI pipelines. Inngest runs each pipeline as a durable function and each job on its own Sandbox, an ephemeral microVM. One run produces one trace that covers the pipeline, its jobs, and every command.
- Plain TypeScript. Use
if, loops,Promise.all, types, and your own SDKs. Pipelines - Durable jobs. A retry never reruns work that already passed. Concepts
- Jobs that start from other jobs.
from()starts a job on a copy of another job's machine. Machines - The same code locally. Run a pipeline against the Dev Server with your uncommitted changes. Quick start
- GitHub checks. One check for each pipeline and one for each job. Checks and reports
- Flow control. Cancel superseded runs, cap concurrency, debounce, throttle, and rate limit. Flow control
Example
This pipeline runs on every pull request. base installs dependencies once. lint and test each start from a copy of the base machine and run in parallel.
import { Inngest } from "inngest";
import { createCi, github, checkout, from, $ } from "@inngest/ci";
const inngest = new Inngest({ id: "my-app" });
const ci = createCi(inngest);
export const pr = ci.pipeline(
{
id: "pr",
on: github.pullRequest(),
singleton: { key: "event.data.pull_request.number", mode: "cancel" },
},
async () => {
await Promise.all([lint(), test()]);
},
);
const base = ci.job("base", async () => {
await checkout();
await $`pnpm install`;
});
const lint = ci.job("lint", async () => {
await from(base);
await $`pnpm lint`;
});
const test = ci.job("test", async () => {
await from(base);
await $`pnpm test`.retries(1);
});A pipeline run is one trace. lint and test start from a snapshot of base, and a failed command runs again without rerunning the jobs that passed.
Install
npm install @inngest/ci inngestGet started
Follow the Quick start to write, serve, and run your first pipeline locally.
Learn more
- Concepts
- Pipelines and triggers
- Jobs
- Commands
- Machines and
from() - Caching
- Checks and reports
- Run on GitHub
- Reference
- About Inngest Labs
Run metadata
Every pipeline run is tagged with userland.inngest-ci metadata, visible on the run in Inngest. It includes the package version, the repo, ref, sha and pull request number when the run has them, and usage counts for the @inngest/ci APIs the run used. Commands, output, and secrets are never recorded.
See Run metadata for every field.
Example project
examples/ci-pipelines is a runnable example with pipelines, matrices, caching, and GitHub checks.
