Pierre’s CI is a simple, scriptable (TypeScript), event based system, that allows you to run jobs and manage rich integrations with Pierre’s UI.
$ npm i pierre
At it’s simplest this is Pierre CI:
// .pierre/ci/helloworld.ts
import { run } from "pierre"
export const label = "Hello world";
export default async () => {
await run(`echo "hello world"`);
}
Every top-level file in .pierre/ci
is automatically run as a job in our default Docker container. To create a new job, create a new file. All top-level jobs are run in parallel. Files included in nested directories (e.g. .pierre/ci/util
) are not run as jobs.
Provide a label to give your job a name, otherwise the filename will be used.
Job handlers are executed every time a branch detects a new push. In the future we will likely add additional events for “comments”, “merges”, etc.
Job files in Pierre export a label (used to name your job) and a default function or array of functions.
If you return an array, each function will be evaluated serially:
export const label = "Serial Tasks";
export default [
firstTask,
secondTask,
thirdTask
]
Each Job is called with an id and a branch:
export default async ({id, branch}) => {
if (branch.name === "🍔") throw new Error("No burgers allowed");
console.log("Burger free zone")
}
Everything logged from the default job will be streamed to the Jobs pages in Pierre (https://pierre.co/[team]/[repo]/jobs/[…branch]).
There are a few ways to fail a job. The first, and the most recommended, is to simply throw an error:
export default async () => {
throw new Error("This job failed… 😢");
}