Skip to content
GitHubBlueskydev.toRSS

06Run on CI

Run the same checks locally and on CI

Write a run once in .vx/workspace.ts. Then you and CI type the same short command:

Terminal window
vx pipeline pr
Read
.vx/workspace.ts
import { defineWorkspace } from '@vzn/vx/config'
import { github } from '@vzn/vx-ci'
import { bun } from '@vzn/vx-lockfile'
export default defineWorkspace({
plugins: [bun(), github()],
pipelines: {
pr: { tasks: ['lint', 'test', 'build'], affected: true },
main: { tasks: ['lint', 'test', 'build'] },
},
})

pr runs lint, test and build only where your branch changed something. main runs them in every project. Run vx lock after the edit.

You can now name a run once and stop retyping its flags.

On a branch, --dry shows what pr would run, and runs nothing:

Terminal window
vx pipeline pr --dry
Terminal window
Plan 4 status cache time task
run miss — @demo/web#lint
affected: packages/web/src/index.ts changed (an input)
run miss — @demo/web#test
affected: packages/web/src/index.ts changed (an input)
cached local — @demo/ui#build
run miss — @demo/web#build
affected: packages/web/src/index.ts changed (an input)
tasks 4 planned · 1 cache hit (1 local) · 3 would run
predicted ~680ms wall · ~1.28s total execution

Read the line under each task: it says why the task is in the plan.

Only packages/web changed. @demo/ui#build is listed because web’s build and test need it, and it comes from the cache.

Check yourself Why is @demo/ui#build in the plan, when packages/ui did not change?

@demo/web#build depends on it (^build), so the run needs its output. It did not change, so the plan reads it from the cache: cached local.

You can now check a pull request’s run before you push it.

.github/workflows/ci.yml
- run: bun vx lock --check
- run: >
bun vx pipeline ${{ github.event_name == 'pull_request' && 'pr' || 'main' }}

The same two steps as the CI page: pr on a pull request, main on a push or merge queue. vx lock --check fails the job when a config changed without vx lock (Keep the lock fresh).

You can now run one command on your machine and get CI’s exact result.

PatternsChange a pipeline for one run

A flag you type beats the pipeline’s key. This runs main’s tasks in @demo/web, plus the @demo/ui#build it needs:

Terminal window
vx pipeline main --filter @demo/web

--dry works on any pipeline. vx pipeline main --dry lists every task and whether the cache holds it.

You can now reuse a saved pipeline for a one-off run.

DetailsWhen vx refuses a pipeline

On main itself, pr has no base to compare with:

vx pipeline pr, on main
✗ vx pipeline --affected has no default on the base branch (main): drop --affected, --all runs every project (the cache skips what did not change), or name the last good commit, --affected=<sha>
--affected is `pipelines.pr.affected` in .vx/workspace

Run main there: the cache still skips what did not change.

A name no pipeline has names the closest one:

vx pipeline prr
✗ vx pipeline no pipeline named prr; pipelines: pr, main
fix vx pipeline pr

Every key a pipeline takes: Pipeline keys, and vx pipeline.

NextRemote cache →

Each CI machine starts with an empty cache. Share one, and every runner reuses what another built.

Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.