Skip to content

Running in CI

Properties need nothing special to run in CI: your build runs them as it runs every other test. Three things make them better there. A pull request wants a quick, repeatable answer, and the inputs that found bugs before. A failure on a CI machine needs to be read, and run again, after the machine has gone. And the inputs a run finds are worth keeping for the next one.

PROPTASTIC_PROFILE=pr runs every corpus entry, the inputs earlier runs found, then 10 random tries a property, whatever the property asks for. So a pull request always checks what was found before, stays fast, and still tries something new each time. Profiles and budgets has the profiles.

Each run picks a new seed, so each tries different inputs. A failure prints its seed and a rerun: line, which runs it again exactly, on your own machine.

When a property fails, the run leaves its counterexample, its event and the manifest in build/proptastic/, or target/proptastic/ under Maven. Keep that directory as the job’s artifact when it fails: the counterexample replays the failure, and the event says what failed, for a person or a tool. Files a run leaves says what each holds.

The corpus, .proptastic/corpus/, is the inputs kept from earlier counterexamples. It’s a cache: keep it between runs and each starts from what the last ones found; lose it and nothing is lost that a longer run can’t find again. The corpus

In a Java project, let the build plugin run the job: ./gradlew proptasticRun -Pproptastic.profile=pr or ./mvnw proptastic:run -Dproptastic.profile=pr runs the tests with the pr profile, says every failure once in a summary, and writes the report CI keeps, with nothing to install on the runner (Build plugins). The examples below run the build’s own test task, which needs nothing from proptastic but the library.

Each does the same three things: runs the tests with the pr profile, restores and keeps the corpus, and keeps build/proptastic/ when the tests fail. They use Gradle; under Maven, run ./mvnw test and keep target/proptastic/.

.github/workflows/tests.yml
name: Tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# v6.1.0
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad
with:
distribution: temurin
java-version: 21
# The inputs earlier runs found, so this one tries them first. v6.1.0
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: .proptastic/corpus
key: proptastic-corpus-${{ github.run_id }}
restore-keys: proptastic-corpus-
- run: ./gradlew test
env:
PROPTASTIC_PROFILE: pr
# What a failure left: its counterexample, its event, the manifest.
# v7.0.2
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
if: failure()
with:
name: proptastic
path: build/proptastic/

Each action is pinned to a commit, its version beside it.

A pull request’s run is quick on purpose. A scheduled job has time: proptastic fuzz --for=30m searches longer, starting from the corpus the pull requests use, and what it finds is saved and replayed as any failure is. Each file below installs the command at the commit these docs describe, until it’s released, and keeps the corpus in the same cache as the pull requests’ runs. It also keeps .proptastic/fuzz/, the inputs each search kept, so the next night’s search starts where the last one stopped; Jenkins keeps both in the workspace.

The search is coverage-guided where its worker can start: a test JDK of 24 or later, and proptastic-fuzz and proptastic-agent at the project’s proptastic version where the build finds them. Otherwise it searches in rounds, and its first line says so.

.github/workflows/search-longer.yml
name: Search longer
on:
schedule:
- cron: "0 3 * * *"
jobs:
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The agent that guides the search needs a test JDK of 24 or later. v6.1.0
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad
with:
distribution: temurin
java-version: 25
# The proptastic command, at the commit these docs describe.
- run: |
rustup toolchain install 1.100.0 --profile minimal
cargo +1.100.0 install --locked proptastic-cli \
--git https://github.com/proptastic/proptastic-rs \
--rev 7349002f99aa5437ad26042cf3fe18895eefe393
# The corpus pull requests start from, kept between runs. v6.1.0
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: .proptastic/corpus
key: proptastic-corpus-${{ github.run_id }}
restore-keys: proptastic-corpus-
# The inputs the last search kept, which this one starts from. v6.1.0
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: .proptastic/fuzz
key: proptastic-fuzz-${{ github.run_id }}
restore-keys: proptastic-fuzz-
- run: proptastic fuzz --for=30m
# What a find left: its counterexample, its event, the report.
# v7.0.2
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
if: failure()
with:
name: proptastic
path: build/proptastic/

Where machines each keep a corpus of their own, proptastic corpus --merge takes another’s in: Keeping the corpus.

A counterexample CI finds is worth keeping as an example, but a change to the tests is a person’s to make. With CI set, proptastic example won’t pin or accept, and says how to propose instead, for the pull request’s reviewer to accept:

Terminal window
CI=true proptastic example c890c8808 --accept
proptastic: CI is set, and CI doesn't edit source, so c890c8808 wasn't pinned: pin it on your machine. To propose it for a person to accept instead:
proptastic example c890c8808 --propose --reason="<why>"

Keeping an example has the rest.

Privacy