From b95a9b6c666de783d74469a3893cb6d5644107e8 Mon Sep 17 00:00:00 2001 From: Jason Stajich Date: Fri, 27 Nov 2026 14:33:04 -0800 Subject: [PATCH 1/2] CI: cover the crossclade_domain_search and curation suites Four test folders were in no CI job at all: crossclade_domain_search, curation, aga1_class and input_tests. The first two were being run by hand after each merge, which is coverage that depends on somebody remembering. Both need nothing but the standard library and run in 0.14 s between them (30 and 61 tests), so they go in the existing no-torch job rather than the torch matrix. The job's full command now passes 1,365 tests in 10.5 s. Two things found and deliberately NOT changed here, because they are judgement calls rather than omissions: aga1_class needs pandas, which the no-torch job does not install. input_tests collects zero tests. Co-Authored-By: Claude Opus 5 --- .github/workflows/build_and_test.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index fa39946..a1ca919 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -23,7 +23,7 @@ jobs: - run: ruff format --check . test-sorting-hat: - name: Unit tests (tests/cellsurface_sorting_hat and tests/class_table, no torch) + name: Unit tests (no torch) runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -33,11 +33,18 @@ jobs: cache: pip # These suites import only the standard library, numpy and pyyaml (checked: no torch, esm or sklearn), # so the package is not installed; src/ is put on the path instead. + # + # crossclade_domain_search (30 tests) and curation (61 tests) run in 0.14 s between them and need + # nothing but the standard library, so they belong here rather than in the torch matrix below. + # They were being run by hand after each merge, which is coverage that depends on somebody + # remembering; this is the same check, permanently. - run: pip install pytest pyyaml numpy - name: Run tests env: PYTHONPATH: src - run: pytest tests/cellsurface_sorting_hat tests/class_table + run: > + pytest tests/cellsurface_sorting_hat tests/class_table + tests/crossclade_domain_search tests/curation analysis-tests: name: Analysis tests (${{ matrix.suite }}, informational) From 0141e18ac320d39bb4dcd2e5e891c46ceb2a98ba Mon Sep 17 00:00:00 2001 From: Jason Stajich Date: Fri, 27 Nov 2026 14:37:57 -0800 Subject: [PATCH 2/2] CI: collapse the torch matrix from 10 jobs to 2 Measured on a real run of main: the analysis-tests matrix cost 881 of the run's 916 runner-seconds, while the tests themselves take about 37 s in total. The rest was ten copies of the same `pip install torch`. Only step1_compare imports torch, esm or sklearn. It keeps its own job. The other nine share one light job on pytest/pyyaml/numpy plus scipy and biopython (secretome_discovery uses Bio.Phylo). Verified locally: all nine pass in that environment, 739 tests in 9 s. Checked before splitting, because a speedup that silently stops running tests is worse than no speedup: the tests these suites skip are skipped for missing BINARIES (hmmer, mafft) and absent data files, never for a missing Python package. Dropping torch turns no running test into a skipped one. The suites still get one pytest process each, since each conftest.py puts its own analysis/ directory on sys.path and module names such as figures_ext exist in more than one. The loop runs all nine even when one fails, groups each in the log, and fails the step if any failed. Expected cost per run: about 916 -> 350 runner-seconds. Wall-clock is unchanged, because step1_compare (259 s) already ran in parallel and still dominates. Both analysis jobs keep continue-on-error, so this changes cost, not what can block a merge. Co-Authored-By: Claude Opus 5 --- .github/workflows/build_and_test.yml | 48 +++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index a1ca919..e7fd5ba 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -46,16 +46,49 @@ jobs: pytest tests/cellsurface_sorting_hat tests/class_table tests/crossclade_domain_search tests/curation - analysis-tests: - name: Analysis tests (${{ matrix.suite }}, informational) + # Nine of the ten analysis suites do not need torch. Measured on a real run of main, the matrix + # that installed torch ten times cost 881 runner-seconds while the tests themselves took about + # 37 s in total; the rest was ten copies of the same install. Only step1_compare imports torch, + # esm or sklearn, so it keeps its own job below and the other nine share one light job. + # + # Checked before splitting: the tests these suites skip are skipped for missing BINARIES (hmmer, + # mafft) and absent data files, never for a missing Python package, so dropping torch does not + # turn a running test into a skipped one. + analysis-tests-light: + name: Analysis tests (no torch, informational) runs-on: ubuntu-latest continue-on-error: true - strategy: - fail-fast: false - matrix: + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: actions/setup-python@v7 + with: + python-version: "3.12" + cache: pip + # scipy and biopython are for secretome_discovery (Bio.Phylo in test_driver and test_stats). + - run: pip install pytest pyyaml numpy scipy biopython + - name: Run each suite in its own process + env: + PYTHONPATH: src # One pytest process per folder: each conftest.py puts its own analysis/ directory on # sys.path, and module names such as figures_ext exist in more than one of them. - suite: [step1_compare, hydrophobin_truth, fungi_scan, calibration_truth, cys_candidates, lectin_class_report, lectin_validation, secretome_discovery, wall_fusion_report, wall_fusion_truth] + # Every suite runs even if an earlier one fails, and the step fails if any of them did. + run: | + failed="" + for suite in hydrophobin_truth fungi_scan calibration_truth cys_candidates \ + lectin_class_report lectin_validation secretome_discovery \ + wall_fusion_report wall_fusion_truth; do + echo "::group::$suite" + pytest "tests/$suite" || failed="$failed $suite" + echo "::endgroup::" + done + if [ -n "$failed" ]; then echo "FAILED suites:$failed"; exit 1; fi + + analysis-tests-torch: + name: Analysis tests (step1_compare, torch, informational) + runs-on: ubuntu-latest + continue-on-error: true steps: - uses: actions/checkout@v7 with: @@ -67,9 +100,8 @@ jobs: - run: pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu - run: pip install -e ".[dev]" - name: Cache ESM-2 8M weights (tests/step1_compare/test_esm_embed.py) - if: matrix.suite == 'step1_compare' uses: actions/cache@v6 with: path: ~/.cache/torch/hub/checkpoints key: esm2-t6-8M-UR50D-v1 - - run: pytest tests/${{ matrix.suite }} + - run: pytest tests/step1_compare