Reuse and sharding
Skip a check whose inputs already passed, and split a long test suite across copies of the job
Reuse an earlier pass
A check whose inputs haven't changed since it last passed doesn't need to run again. Declare each check's inputs in .pod/checks.json, on the branch your pull requests merge into:
{
"version": 1,
"checks": {
"unit": { "inputs": ["src/**/*.rs", "Cargo.toml", "Cargo.lock"] },
"docs": { "inputs": ["docs/**"] }
}
}Then make the check's first step ask whether it may reuse, and skip the rest on a reuse:
jobs:
unit:
runs-on: pod-4
steps:
- uses: actions/checkout@v4
- id: reuse
run: pod-ci-helper reuse --check unit
- if: steps.reuse.outputs.reused != 'true'
run: cargo testThe step writes reused (true or false) and, on a reuse, reused-from, the commit the check passed on. It never fails the job: with no answer in 20 seconds, the check runs.
The file
versionis1. At most 200 checks; a field the format doesn't name makes the file unreadable.- A check's name is 1 to 64 letters, digits,
.,_or-, the name the step passes to--check. It doesn't have to be the job's name. inputslists 1 to 100 glob patterns, relative to the repository's root.*matches within one part of a path,?one character, and**any number of parts.- The workflow file that runs the check is always an input.
When a check is reused
Pod CI decides from GitHub's facts, never from the job:
- Only a trusted pull request's job may reuse. The default branch always runs every check, and untrusted jobs neither reuse nor record a pass.
- The file is read from the base branch, never from the pull request.
- The inputs are hashed at the commit the job runs on: GitHub's test merge of the pull request into its base. A change on the base branch to a declared input means the check runs.
- The job must start from the same runner image as the pass. A new image, or a job whose image Pod CI can't tell, means the check runs.
- A file that doesn't read, a check it doesn't name, or a check with no matching files means the check runs.
List reuses, or mpod ci reuses list, shows the checks that were reused and the pass each one reused.
Shard a test suite
Not available yet Sharding needs forks with a first action and sandbox groups from Pod; until then the step fails with a message saying so.
A long test suite can run as several copies of the same job. Each copy is a fork of the job's sandbox as it is when you ask, so it starts with everything the job has done so far: the checkout, the installed packages, a database that is migrated and running.
jobs:
test:
runs-on: pod-4
steps:
- uses: actions/checkout@v4
- run: pnpm install && pnpm db:migrate
- uses: Mapier-Labs/pod-ci-qa/packages/shard-action@main
with:
count: 3
run: uv run pytest -p pytest_pod_shardEach copy's command gets POD_CI_SHARD_INDEX (from 0), POD_CI_SHARD_COUNT and POD_CI_SHARD_OUT. What a copy leaves in POD_CI_SHARD_OUT, such as JUnit files or Playwright's blob reports, is copied back under out-dir/shard-<n>/ when it ends. The step passes only if every copy passed.
Add-ons pick each copy's slice of the tests: pytest_pod_shard for pytest, and one for Playwright that sets its shard and blob reporter.
- At most 8 copies a job.
- Copies count against your core limit and are billed as runners of the job's size.
- On a public repository, a job from outside the repository may not shard.
List a job's shards, or mpod ci jobs shards <job_id>, shows the copies a job asked for.