Fix/gh workflows (#456) #675
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Mikado | |
on: | |
[ push, pull_request ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
strategy: | |
matrix: | |
# python-version: [ "3.8", "3.9" ] | |
python-version: [ "3.9" ] | |
# os: [ubuntu-latest, macos-latest] | |
os: [ubuntu-latest] | |
steps: | |
- name: Install system development tools | |
if: startsWith(runner.os, 'Linux') | |
run: | | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt update | |
sudo apt install -y build-essential zlib1g-dev zlib1g | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
if: startsWith(runner.os, 'Linux') | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- uses: actions/cache@v2 | |
if: startsWith(runner.os, 'macOS') | |
with: | |
path: ~/Library/Caches/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache conda | |
id: cache-miniconda | |
uses: actions/cache@v2 | |
env: | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('./environment.yml') }} | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v2 | |
name: setup-Mambaforge | |
with: | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Mambaforge | |
miniforge-version: 4.9.2-4 | |
# mamba-version: "*" | |
# channels: conda-forge, defaults | |
channels: conda-forge, bioconda, defaults, anaconda | |
channel-priority: true | |
activate-environment: "mikado2" | |
environment-file: ./environment.yml | |
use-mamba: true | |
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Verify conda environment | |
run: | | |
conda info --envs | |
conda env list | |
conda activate mikado2 | |
conda list | |
- name: Install dependencies | |
run: | | |
conda activate mikado2 | |
python --version | |
gcc --version | |
pip --version | |
pip install -r requirements.txt | |
python -c "import pysam; print(pysam.__version__)" | |
pip install Cython pytest-cov | |
python setup.py develop | |
- name: Test light | |
run: | | |
pytest -m slow Mikado/tests/test_light.py::LightTest::test_subprocess_multi_empty_orfs | |
- name: Test full with coverage | |
if: startsWith(runner.os, 'Linux') | |
run: | | |
pytest --cov=Mikado --cov-report=xml --cov-config=.coveragerc -m 'not triage'; | |
- name: Test full without coverage | |
if: startsWith(runner.os, 'macOS') | |
run: | | |
pytest -m 'not triage'; | |
- name: Upload coverage to Codecov | |
if: startsWith(runner.os, 'Linux') | |
uses: codecov/codecov-action@v1 | |
# - name: Test daijin | |
# if: startsWith(runner.os, 'Linux') | |
# run: | | |
# mamba install -c bioconda -c conda-forge -y bioconda::portcullis stringtie scallop "gmap!=2021.02.22" \ | |
# star hisat2 prodigal blast diamond transdecoder conda-forge::gnuplot kallisto samtools gffread; | |
# cd sample_data; snakemake --latency-wait 60 --jobs 5 --cores 5 | |
# - name: Test daijin mikado | |
# if: startsWith(runner.os, 'macOS') | |
# run: | | |
# mamba install -c bioconda -c conda-forge -y prodigal blast diamond transdecoder kallisto samtools gffread; | |
# cd sample_data; snakemake --latency-wait 60 --jobs 5 --cores 5 complete_no_assemble | |
- name: Test fast | |
run: | | |
python -c "import Mikado; Mikado.test(label='fast')"; | |
- name: Test seed | |
run: | | |
# Check that the seed is set properly | |
mikado serialise --junctions sample_data/junctions.bed --genome Mikado/tests/chr5.fas.gz \ | |
--transcripts Mikado/tests/check_seed.fa --configuration Mikado/tests/check_seed.yaml; | |
mikado pick --log $(pwd)/pick.20a.log --procs 2 --seed 20 --genome Mikado/tests/chr5.fas.gz \ | |
--configuration Mikado/tests/check_seed.yaml -od 20a Mikado/tests/check_seed.gtf; | |
mikado pick --log $(pwd)/pick.20b.log --procs 2 --seed 20 --genome Mikado/tests/chr5.fas.gz \ | |
--configuration Mikado/tests/check_seed.yaml -od 20b Mikado/tests/check_seed.gtf; | |
mikado pick --log $(pwd)/pick.20c.log --procs 2 --seed 20 --genome Mikado/tests/chr5.fas.gz \ | |
--json-conf Mikado/tests/check_seed.yaml -od 20c Mikado/tests/check_seed.gtf; | |
mikado pick --log $(pwd)/pick.20d.log --procs 2 --seed 20 --genome Mikado/tests/chr5.fas.gz \ | |
--json-conf Mikado/tests/check_seed.yaml -od 20d Mikado/tests/check_seed.gtf; | |
mikado pick --log $(pwd)/pick.10.log --procs 2 --seed 1000 --genome Mikado/tests/chr5.fas.gz \ | |
--json-conf Mikado/tests/check_seed.yaml -od 1000 Mikado/tests/check_seed.gtf; | |
if [[ $(diff -q 20a 20b) || $(diff -q 20a 20c) || $(diff -q 20a 20d) ]]; then exit 1; fi | |
if [[ ! $(diff -q 20a 1000) ]]; then exit 1; fi |