Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Testing and CI/CD

GitHub Actions Workflow

The pipeline uses GitHub Actions for continuous integration. Tests run automatically on pull requests (.github/workflows/nf-test.yml):

NF-test Structure

Tests are organized at two levels:

LevelLocationPurpose
Module testsmodules/local/*/tests/main.nf.testUnit tests for individual processes
Pipeline teststests/main.nf.testEnd-to-end integration tests

Each test file contains multiple test cases. Most include both a “real” test and a “stub” test:

ModuleTest CasesContainer
cellprofiler/illumcalc2CellProfiler
cellprofiler/illumapply2CellProfiler
cellprofiler/segcheck2CellProfiler
cellprofiler/preprocess2CellProfiler
cellprofiler/combinedanalysis2CellProfiler
fiji/stitchcrop3Fiji
qc/montageillum4Python (numpy/pillow)
qc/barcodealign2Python (pandas)
qc/preprocess2Python (pandas)
tests/main.nf.test5Full pipeline
Total26

The pipeline tests in tests/main.nf.test cover different QC gate scenarios:

Handling Non-Reproducible Outputs

Image processing outputs (CellProfiler, Fiji) have non-reproducible checksums due to floating point operations, compression variations, and metadata differences. The pipeline handles this in two ways:

1. Global ignore file (tests/.nftignore):

# Ignore all image types with unstable checksums
*.tiff
*.tif
*.npy
*.png
*.csv
*.html

2. File existence assertions in test files (see modules/local/cellprofiler/combinedanalysis/tests/main.nf.test):

// Exclude specific files from snapshot, check existence instead
process.out.csv_stats.get(0).get(1).findAll {
    file(it).name != "Experiment.csv" &&
    file(it).name != "Image.csv"
}
// Then assert file exists separately
{ assert process.out.csv_stats.get(0).get(1).any { file(it).name == "Experiment.csv" } }

Updating Snapshots

When to update snapshots:

When you DON’T need to update snapshots:

When intentionally changing outputs, update snapshots using GitHub Codespaces (recommended for macOS users):

# Create a codespace with enough resources (need 3+ CPUs for FIJI processes)
gh codespace create --repo broadinstitute/nf-pooled-cellpainting --branch dev --machine largePremiumLinux

# Open in browser
gh codespace code --codespace <name> --web

# Inside the codespace, run tests with snapshot update
nf-test test tests/main.nf.test --profile debug,test,docker --update-snapshot

# Review changes, commit, and push
git diff tests/main.nf.test.snap
git add tests/main.nf.test.snap
git commit -m "fix: regenerate snapshots"
git push

# Delete codespace when done (to avoid charges)
gh codespace delete --codespace <name>

!!! warning “Local macOS Limitations” Running nf-test test --update-snapshot locally on macOS may fail due to workflow.trace not being populated correctly with Nextflow edge versions. Use GitHub Codespaces instead.

This overwrites existing .nf.test.snap files. Review the diff carefully before committing.