Skip to content

Commit 6fd4ee2

Browse files
committed
Use CellBender test shim in hosted full workflow action
1 parent 9af665b commit 6fd4ee2

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/full-workflow.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
--executor local
2828
--cores 2
2929
TEST_WORKFLOW_JOBS: "2"
30+
TEST_WORKFLOW_FAKE_CELLBENDER_SOURCE: ${{ github.workspace }}/tests/reference_outputs/testdata/results/cellbender
3031
TEST_WORKFLOW_SNAKEMAKE_ARGS: >-
3132
--resources mem_mb=8192
3233
--set-resources
@@ -68,6 +69,9 @@ jobs:
6869
- name: Check out repository
6970
uses: actions/checkout@v4
7071

72+
- name: Add test command shims to PATH
73+
run: echo "${GITHUB_WORKSPACE}/tests/bin" >> "${GITHUB_PATH}"
74+
7175
- name: Create test environment
7276
uses: mamba-org/setup-micromamba@v2
7377
with:

tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ The full-run test calls `tests/run_test_workflow.sh`, which uses `testdata/sampl
5252

5353
For testing, omit `--snakemake-conda-prefix` so Snakemake uses its default `.snakemake/conda` location under the repository root. The runner assumes that the current environment already provides `snakemake` on `PATH`.
5454

55+
The GitHub-hosted full workflow action uses `tests/bin/cellbender` as a test shim for the CellBender rule because hosted runners do not provide the GPU-enabled CellBender container runtime used on the cluster. The shim copies the reference CellBender H5 outputs into the expected rule outputs, while the rest of the workflow runs normally and is still compared against the reference snapshot. Cluster/HPC runs of `pytest tests --run-workflow` do not use this shim unless `tests/bin` is explicitly added to `PATH`.
56+
5557

5658
## Reference outputs
5759

tests/bin/cellbender

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ "${1:-}" != "remove-background" ]]; then
5+
echo "test CellBender shim only supports: cellbender remove-background" >&2
6+
exit 2
7+
fi
8+
shift
9+
10+
if [[ "${1:-}" == "--help" ]]; then
11+
echo "Usage: cellbender remove-background --input INPUT --output OUTPUT [--seed SEED] [--cuda]"
12+
exit 0
13+
fi
14+
15+
output=""
16+
while [[ $# -gt 0 ]]; do
17+
case "$1" in
18+
--output)
19+
output="${2:-}"
20+
shift 2
21+
;;
22+
--input|--seed)
23+
shift 2
24+
;;
25+
--cuda)
26+
shift
27+
;;
28+
*)
29+
shift
30+
;;
31+
esac
32+
done
33+
34+
if [[ -z "${output}" ]]; then
35+
echo "test CellBender shim requires --output" >&2
36+
exit 2
37+
fi
38+
39+
source_dir="${TEST_WORKFLOW_FAKE_CELLBENDER_SOURCE:-}"
40+
if [[ -z "${source_dir}" ]]; then
41+
echo "TEST_WORKFLOW_FAKE_CELLBENDER_SOURCE is required for the test CellBender shim" >&2
42+
exit 127
43+
fi
44+
45+
base_source="${source_dir}/cellbender_test.h5"
46+
filtered_source="${source_dir}/cellbender_test_filtered.h5"
47+
filtered_output="${output%.h5}_filtered.h5"
48+
49+
if [[ ! -s "${base_source}" || ! -s "${filtered_source}" ]]; then
50+
echo "test CellBender shim could not find reference H5 outputs under ${source_dir}" >&2
51+
exit 1
52+
fi
53+
54+
mkdir -p "$(dirname "${output}")"
55+
cp "${base_source}" "${output}"
56+
cp "${filtered_source}" "${filtered_output}"

0 commit comments

Comments
 (0)