Run it anywhere
The GitHub Action is the shortest path. Everywhere else — your laptop,
GitLab, Gitea, Forgejo, Jenkins — use the Docker image, which carries the Rust toolchain
and cargo-mutants, or the static binary.
What it needs
- Linux.
cargo-mutantscannot test mutants on Windows (a temp-path length limit). macOS works, more slowly. On Windows, use the image. - Your Rust toolchain and dependencies — each mutant is compiled and tested the way your CI builds the project.
cargo-mutantsonPATH. The Action and the image bring it; with the bare binary,cargo install cargo-mutants.- Full history for the base ref, so there is a merge-base to diff
against:
fetch-depth: 0,GIT_DEPTH: "0", or agit fetchof the target branch.
Docker image
mancube/mergestro-gate — Alpine with the Rust toolchain,
cargo-mutants and git, for linux/amd64 and
linux/arm64, about 280 MB compressed. It runs as a non-root user; mount the
repository at /work.
$ git fetch origin main
$ docker run --rm -v "$PWD:/work" mancube/mergestro-gate:0.6.1 \
--repo /work --base origin/main --advisory
| Tag | Tracks |
|---|---|
0.6.1 | exactly this release — pin this in CI |
0.6 | the newest 0.6.x |
latest | the newest release; it moves under you |
Prebuilt binary
A static musl binary for Linux x86-64, with a SHA-256 checksum on every release.
$ curl -sSL -o slop-gate.tar.gz \
https://github.com/lucheeseng827/mergestro-gate/releases/download/v0.6.1/slop-gate-x86_64-unknown-linux-musl.tar.gz
$ tar xzf slop-gate.tar.gz && sudo mv slop-gate /usr/local/bin/
$ cargo install cargo-mutants --locked
$ slop-gate --repo . --base origin/main --advisory
GitLab CI
Run the image on merge-request pipelines and write the report as Markdown. The gate job's exit code is the verdict.
.gitlab-ci.yml — the gate job
behavioral-gate:
image:
name: mancube/mergestro-gate:0.6
entrypoint: [""] # let GitLab run the script in a shell
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
GIT_DEPTH: "0"
script:
- git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- |
set +e
slop-gate --repo . --base "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" \
--max-survivors 0 --format markdown > mergestro-report.md
GATE_RC=$?
set -e
cat mergestro-report.md
exit $GATE_RC
artifacts:
when: always
paths: [mergestro-report.md]
The full example adds a second job that posts the report as a merge-request note and updates it in place on the next push.
Gitea, Forgejo and Jenkins
Same image, same exit codes. Working pipelines, including the pull-request comment:
Predict the cost first
Wall-clock time is roughly the number of mutants times your suite's run time.
estimate enumerates the mutants a diff produces, after the per-function cap,
without building or testing anything:
$ slop-gate estimate --repo . --base origin/main # add --json for CI
If the number is large, bound the run with a time budget or split it across jobs.
Next: What's new in 0.6 →