Read the CI workflow before you read the README. Your first commit should run in the same environment that grades it.
A README records the maintainers’ setup guidance. An active required pipeline records commands that participate in the merge decision. Those two drift apart quietly, and you inherit the gap.
This is for engineers in their first days on an unfamiliar codebase. You need a fresh clone, shell access, and permission to read the pipeline config.
The decision: which instructions win
On day one you usually find two sets of setup instructions. The README says install and go. The pipeline pins a version and runs a specific command.
When they disagree, identify the workflow actually required on the target branch. The README may describe a valid local path with a different setup, so reproduce the mismatch before changing either file.
This is not a claim that CI is correct. It is a claim about which one you can verify from the outside.
Prerequisites
- A fresh clone you have not modified yet.
- Read access to the pipeline definitions and to branch protection settings.
- A runtime version manager for your language, so pinning is reversible.
- Willingness to spend setup time before writing code.
Steps
Find the job that actually gates merges. Look in
.github/workflows/,.gitlab-ci.yml,Jenkinsfile, or whatever the repo uses. Then check branch protection and note which check is marked required. List all required jobs and any external checks. Start with the one that exercises the code you plan to change.Write down three facts from that job. The runtime version, the install command, and the test command. Copy the strings, do not paraphrase them.
The shape below is illustrative, not executed, and placeholders vary by repo:
# illustrative excerpt only - not executed
jobs:
test:
runs-on: <runner-image>
steps:
- uses: <setup-action>
with:
version: '<X.Y>' # fact 1: copy
- run: <install-command> # fact 2: copy
- run: <test-command> # fact 3: copy
Pin your local runtime to fact 1. Many repos already ship a version file such as
.nvmrc,.tool-versions,.python-version,go.mod, orrust-toolchain.toml. Use it. If the file is missing while the pipeline pins a version, that is a legitimate first issue to file.Match the install command exactly.
npm ciandnpm installare not interchangeable. The former checks the manifests for consistency and installs without updating the lockfile. The latter can update the lockfile when the manifest requires it. Use the same relevant flags or project npm configuration. npm ci documentation Installing differently from CI hides the failure you would hit in review.Run the test command from the same working directory. Flags matter. A watch mode default or a narrowed path selector turns a real run into a partial one.
List what you cannot reproduce locally. Secrets, service containers, other matrix legs. Write that list into your PR description later. Keep it out of your head.
Test
You can check environment parity before changing any code. All steps here are illustrative; run them yourself and judge the output.
- Runtime check. Ask your runtime for its version and compare it with the pinned value. A different major version means stop and fix it first.
- Command check. Compare the test target, relevant flags, environment and working directory. A CI-only wrapper can expand variables differently on a laptop.
- Negative check. On a scratch branch, break one assertion on purpose and run the suite. Make sure a selected test actually executes the altered assertion. Look for its failure in the runner output.
- Revert the scratch change. Do this before you stage anything else.
Expected observation: steps 1 and 2 match, and step 3 produces a genuine failure.
If step 3 stays green, inspect test collection, skip reasons and whether the changed assertion executed. This negative control alone cannot tell you whether CI exercises it either.
Always verify against the repository's current pipeline file, not against this draft. Pipelines change.
Failure modes
- Matrix builds. Start with the matrix leg that gates your change. The oldest supported version can reveal missing features, and newer versions can introduce incompatibilities.
- Service containers. CI may run PostgreSQL while your default is SQLite. Same tests, different semantics.
- Silent skips. Integration suites often skip without credentials. A green run can mean zero tests executed.
- Dependency caches. A warm CI cache can mask a lockfile that does not install from scratch.
- Operating system drift. Case-insensitive filesystems and CRLF handling differ from Linux runners.
When this does not apply
- The pipeline is already failing on the default branch. Fix the signal before you trust it.
- The required job needs infrastructure you cannot run, such as a private registry or a GPU.
- For a documentation-only change, use the checks declared for that path; examples, links or generated content may still be tested.
- The repo pins an end-of-life runtime you cannot install. Report it; do not fake a green run.
Tradeoffs
Full parity costs setup time on day one. It buys faster feedback and a smaller first PR.
The cheaper alternative is to open a draft PR and let CI tell you what is wrong. That works, but you learn less about the environment and you wait for every round trip.
A middle path: match the runtime version and the test command, and accept that services and secrets stay CI-only. Document the gap in the PR.
This article was created with AI assistance. The workflow excerpt is schematic; use your repository’s actual required checks to pick the local commands.
Top comments (0)