Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Tests

on:
pull_request:
workflow_dispatch:

concurrency:
group: tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

jobs:
default-pytest:
name: Default pytest suite
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up conda test environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: scrnaseq-cluster-downsample-tests
environment-file: environment.yml
auto-activate-base: false
use-mamba: true

- name: Show tool versions
run: |
python --version
pytest --version
snakemake --version

- name: Run default tests
run: pytest tests -q

snakemake-rule:
name: Snakemake rule execution
runs-on: ubuntu-latest
timeout-minutes: 90

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up conda test environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: scrnaseq-cluster-downsample-tests
environment-file: environment.yml
auto-activate-base: false
use-mamba: true

- name: Cache Snakemake conda environments
uses: actions/cache@v4
with:
path: .snakemake/conda
key: ${{ runner.os }}-snakemake-conda-${{ hashFiles('workflow/envs/downsample_clusters.yml', 'workflow/envs/downsample_clusters.linux-64.pin.txt') }}
restore-keys: |
${{ runner.os }}-snakemake-conda-

- name: Show tool versions
run: |
python --version
pytest --version
snakemake --version
conda --version

- name: Run Snakemake rule test
run: pytest tests --run-rule -q

full-workflow:
name: Full Snakemake workflow
runs-on: ubuntu-latest
timeout-minutes: 120

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up conda test environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: scrnaseq-cluster-downsample-tests
environment-file: environment.yml
auto-activate-base: false
use-mamba: true

- name: Cache Snakemake conda environments
uses: actions/cache@v4
with:
path: .snakemake/conda
key: ${{ runner.os }}-snakemake-conda-${{ hashFiles('workflow/envs/downsample_clusters.yml', 'workflow/envs/downsample_clusters.linux-64.pin.txt') }}
restore-keys: |
${{ runner.os }}-snakemake-conda-

- name: Show tool versions
run: |
python --version
pytest --version
snakemake --version
conda --version

- name: Run full testdata workflow
run: pytest tests --run-workflow -q
4 changes: 4 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ To execute the full testdata workflow and write outputs under `testdata/results/
pytest tests --run-workflow -q
```

GitHub Actions runs the default suite, the optional rule test, and the full
workflow test on pull requests. The same workflow can also be started manually
from the Actions tab with `workflow_dispatch`.

The full-workflow test removes `testdata/results/` before running so that both expected test fixture outputs are regenerated from scratch. It validates each output table and compares it to the reference snapshot under `tests/reference_outputs/testdata/results/`.

By default Snakemake creates rule conda environments under `.snakemake/conda` in the repository root. To use an explicit Snakemake conda prefix:
Expand Down
Loading