simplify build container #1961
Workflow file for this run
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
name: tests | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "master" | |
env: | |
cache-version: "cache-v1" | |
jobs: | |
changes: | |
name: Checking changed files | |
runs-on: ubuntu-latest | |
outputs: | |
keepgoing: ${{ steps.changed-files.outputs.any_changed }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v35 | |
with: | |
files: | | |
*.{yml,yaml,py} | |
**/*.{yml,yaml,py} | |
requirements.txt | |
container/database | |
container/tests | |
container/*.{yml,yaml,py} | |
tests | |
- name: List all changed files | |
run: | | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
echo "$file was changed" | |
done | |
echo ${{ steps.changed-files.outputs.any_changed }} | |
tests: | |
needs: | |
- changes | |
if: needs.changes.outputs.keepgoing == 'true' | |
timeout-minutes: 720 | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
max-parallel: 10 | |
matrix: | |
config: | |
# - { python-version: 3.7, os: ubuntu-latest } | |
- { python-version: 3.8, os: ubuntu-latest } | |
- { python-version: 3.9, os: ubuntu-latest } | |
- { python-version: "3.10", os: ubuntu-latest } | |
- { python-version: "3.11", os: ubuntu-latest } | |
# - { python-version: 3.7, os: macos-latest } | |
- { python-version: 3.8, os: macos-latest } | |
- { python-version: 3.9, os: macos-latest } | |
- { python-version: "3.10", os: macos-latest } | |
- { python-version: "3.11", os: macos-latest } | |
# disabled until it's fixed. | |
runs-on: ${{ matrix.config.os }} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
NOT_CRAN: true | |
TZ: UTC | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- name: Install ubuntu system dependencies | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get install libcurl4-openssl-dev | |
sudo apt-get update -y && sudo apt-get install -y zlib1g-dev libglpk-dev libgmp3-dev libxml2-dev libicu-dev libhdf5-serial-dev libcurl4-gnutls-dev | |
- name: Install macOS system dependencies | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
brew install cairo pkg-config autoconf automake libtool | |
- name: Cache conda | |
uses: actions/cache@v3 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('environment.yml') }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-activate-base: true | |
auto-update-conda: true | |
activate-environment: dandelion | |
channels: conda-forge, bioconda, anaconda, defaults | |
channel-priority: true | |
python-version: ${{ matrix.config.python-version }} | |
environment-file: environment.yml | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Display Python version | |
run: | | |
python --version | |
which python | |
- name: Setup blast and igblast | |
# just in case this happens again in the future | |
# conda install -c bioconda igblast blast ncbi-vdb=2.11.0 | |
# https://github.com/bioconda/bioconda-recipes/issues/33479 | |
run: | | |
conda install -c bioconda "igblast>=1.17.0" blast | |
- name: Test if blast works | |
run: | | |
blastn -h | |
- name: Test if igblast works | |
run: | | |
igblastn -h | |
- id: R | |
name: Check R version | |
run: | | |
R --version > VERSION | |
echo "version=$(head -1 VERSION | awk '{print $3}')" >> $GITHUB_OUTPUT | |
echo "mainbiocversion=$(Rscript -e 'cat(unlist(tools:::.BioC_version_associated_with_R_version()))' | awk '{print $1}')" >> $GITHUB_OUTPUT | |
echo "subbiocversion=$(Rscript -e 'cat(unlist(tools:::.BioC_version_associated_with_R_version()))' | awk '{print $2}')" >> $GITHUB_OUTPUT | |
echo "biocversion=$(Rscript -e 'cat(as.character(tools:::.BioC_version_associated_with_R_version()))' | awk '{print $1}')" >> $GITHUB_OUTPUT | |
shell: bash -l {0} | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ steps.R.outputs.version}} | |
- name: Cache ubuntu R packages | |
if: "!contains(github.event.head_commit.message, '/nocache') && matrix.config.os == 'ubuntu-latest'" | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/work/_temp/Library | |
key: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-RELEASE_${{ steps.R.outputs.mainbiocversion}}_${{ steps.R.outputs.subbiocversion}}-r-${{ steps.R.outputs.version}}-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-RELEASE_${{ steps.R.outputs.mainbiocversion}}_${{ steps.R.outputs.subbiocversion}}-r-${{ steps.R.outputs.version}}- | |
- name: Cache macOS R packages | |
if: "!contains(github.event.head_commit.message, '/nocache') && matrix.config.os != 'ubuntu-latest'" | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-RELEASE_${{ steps.R.outputs.mainbiocversion}}_${{ steps.R.outputs.subbiocversion}}-r-${{ steps.R.outputs.version}}-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-RELEASE_${{ steps.R.outputs.mainbiocversion}}_${{ steps.R.outputs.subbiocversion}}-r-${{ steps.R.outputs.version}}- | |
- name: Setup r-lib/remotes | |
run: | | |
options(install.packages.compile.from.source = "never") | |
install.packages(c('remotes', 'optparse', 'RCurl', 'XML','matrixStats', 'stringi')) | |
shell: Rscript {0} | |
- name: Install Dandelion | |
run: | | |
python -m pip install . | |
python -m pip install palantir | |
python -m pip install git+https://github.com/emdann/milopy.git | |
- name: Install ubuntu R dependencies | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
options(install.packages.compile.from.source = "never") | |
remotes::install_cran("BiocManager") | |
BiocManager::install(c('Biostrings', 'GenomicAlignments', 'IRanges')) | |
install.packages(c('shazam', 'alakazam', 'tigger', 'optparse')) | |
shell: Rscript {0} | |
- name: Install macOS R dependencies | |
if: matrix.config.os != 'ubuntu-latest' | |
run: | | |
options(install.packages.compile.from.source = "never") | |
remotes::install_cran("BiocManager") | |
BiocManager::install(c('Biostrings', 'GenomicAlignments', 'IRanges')) | |
install.packages(c('shazam', 'alakazam', 'tigger', 'optparse')) | |
shell: Rscript {0} | |
- name: Test if R dependencies are installed properly | |
run: | | |
Rscript tests/r_dependencies.R | |
shell: bash -l {0} | |
- name: Test with pytest | |
run: | | |
python -m pytest --cov=dandelion --cov-report=xml --ignore=container -rP -W ignore::DeprecationWarning -W ignore::PendingDeprecationWarning -W ignore::FutureWarning | |
- name: Show coverage | |
run: | | |
coverage report | |
- name: Upload coverage to Codecov | |
if: matrix.config.os == 'ubuntu-latest' && matrix.config.python-version == '3.10' && github.actor != 'dependabot[bot]' | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
directory: ./coverage/reports/ | |
env_vars: ${{ format('OS={0},PYTHON={1}', matrix.config.os, matrix.config.python-version) }} | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
path_to_write_report: ./coverage/codecov_report.txt | |
verbose: true |