Skip to content

Keep the linter happy #952

Keep the linter happy

Keep the linter happy #952

name: Tests
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
static_tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: false
- name: Install conda environment dependencies
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
miniforge-variant: Mambaforge
python-version: "3.11"
mamba-version: "*"
channels: conda-forge,bioconda #,defaults # see: https://github.com/conda-forge/status/issues/144
channel-priority: strict
activate-environment: V-pipe
auto-update-conda: true
environment-file: tests/conda_lint_env.yaml
- name: Code formatting
run: snakefmt --check .
- name: Setup project
run: |
mkdir -p lintest/config # virus does not matter
cd lintest/
$GITHUB_WORKSPACE/init_project.sh -n
# dummy content so pipeline is configured properly
cp -vr $GITHUB_WORKSPACE/tests/data/hiv/ ./samples
sed -E 's/(#*virus_base_config:) .*$/\1 hiv/;s/false$/true/g;s/(trim_primers:) .*$/\1 false/' $GITHUB_WORKSPACE/config/config.yaml | tee ./config.yaml
- name: Snakemake linting
env:
PYTHONUNBUFFERED: 1
uses: snakemake/snakemake-github-action@v1
with:
directory: lintest/
snakefile: 'workflow/Snakefile'
args: '--lint'
continue-on-error: true # HACK for now snakemake linting is considered non-critical
runtime_tests:
needs: static_tests
strategy:
max-parallel: 5
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11"]
virus: ["hiv", "sars-cov-2"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
with:
lfs: false
# NOTE to save on bandwidth costs, GitHub Action will not use GitHub's own LFS
- name: Install conda environment dependencies
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,bioconda #,defaults # see: https://github.com/conda-forge/status/issues/144
channel-priority: strict
activate-environment: V-pipe
auto-update-conda: true
environment-file: tests/conda_test_env.yaml
- name: Setup project
run: |
mkdir -p /tmp/project/${{ matrix.virus }}/
cd /tmp/project/${{ matrix.virus }}/
$GITHUB_WORKSPACE/init_project.sh -n
- name: Run tests
working-directory: ./tests
run: ./regression_tests.sh ${{ matrix.virus }}
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: regression test output and diffs
path: |
/tmp/v-pipe_tests/*
if-no-files-found: ignore