Skip to content

Integrating Snakemake Unittests & CI / CD #113

Integrating Snakemake Unittests & CI / CD

Integrating Snakemake Unittests & CI / CD #113

Workflow file for this run

# This pipeline checks whether the package
# installs properly, passes unit tests and whether
# the code formatting is right.
name: build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11.2"]
poetry-version: ["1.8.3"]
steps:
- uses: actions/checkout@v3
- name: Run black formatting check
uses: psf/black@stable
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
version: ${{ matrix.poetry-version }}
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- name: Install the dependencies
run: poetry install --no-interaction --no-root --with dev
if: steps.cache-deps.outputs.cache-hit != 'true'
- name: Install the module
run: poetry install --with dev --no-interaction
- name: Run unit tests
run: poetry run pytest
- name: Run Ruff
run: poetry run ruff check .
- name: Run interrogate
run: poetry run interrogate src
- name: Run Pyright (type checking)
run: poetry run pyright
- name: Linting
uses: snakemake/snakemake-github-action@v1
with:
directory: '.test'
snakefile: 'workflow/Snakefile'
args: '--lint'
- name: Testing
uses: snakemake/snakemake-github-action@v1
with:
directory: '.test'
snakefile: 'workflow/Snakefile'
args: '--cores 1 --use-conda --conda-cleanup-pkgs cache'
stagein: '' # additional preliminary commands to run (can be multiline)
show-disk-usage-on-error: true