209 lines (184 loc) · 7.83 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
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:
changed_file: ${{ steps.files.outputs.added_modified }}
keepgoing: ${{ steps.checkfiles.outputs.keepgoing }}
steps:
- id: files
uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42
with:
format: 'json'
- id: checkfiles
run: |
if [[ ${{ steps.files.outputs.added_modified }} == *.yml* || ${{ steps.files.outputs.added_modified }} == *.py* || ${{ steps.files.outputs.added_modified }} == *test* || ${{ steps.files.outputs.added_modified }} == *requirements* ]]; then
echo "::set-output name=keepgoing::true"
else
echo "::set-output name=keepgoing::false"
fi
tests:
needs:
- changes
if: needs.changes.outputs.keepgoing == 'true'
timeout-minutes: 720
defaults:
run:
shell: bash -l {0}
strategy:
max-parallel: 6
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.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}
# 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@v2
- uses: actions/setup-node@v2
- 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@v1
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.1.1
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 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 "##[set-output name=version;]$(head -1 VERSION | awk '{print $3}')"
echo "##[set-output name=mainbiocversion;]$(Rscript -e 'cat(unlist(tools:::.BioC_version_associated_with_R_version()))' | awk '{print $1}')"
echo "##[set-output name=subbiocversion;]$(Rscript -e 'cat(unlist(tools:::.BioC_version_associated_with_R_version()))' | awk '{print $2}')"
echo "##[set-output name=biocversion;]$(Rscript -e 'cat(as.character(tools:::.BioC_version_associated_with_R_version()))' | awk '{print $1}')"
shell: bash -l {0}
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ steps.R.outputs.version}}
- name: Setup r-lib/remotes
run: |
install.packages('remotes')
shell: Rscript {0}
- name: Cache ubuntu R packages
if: "!contains(github.event.head_commit.message, '/nocache') && matrix.config.os == 'ubuntu-latest'"
uses: actions/cache@v2
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@v2
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: Install Dandelion
run: |
python -m pip install .
- name: Install ubuntu R dependencies
if: matrix.config.os == 'ubuntu-latest'
run: |
install.packages(c('RCurl','XML'))
remotes::install_cran("BiocManager")
BiocManager::install(version = ${{ steps.R.outputs.biocversion}}, ask = FALSE)
BiocManager::install(c('GenomeInfoDb', 'Rsamtools'))
BiocManager::install(c('Biostrings', 'GenomicAlignments', 'IRanges'))
install.packages(c('shazam', 'alakazam', 'tigger', 'airr', 'optparse'))
shell: Rscript {0}
- name: Install macOS R dependencies
if: matrix.config.os != 'ubuntu-latest'
run: |
options(install.packages.compile.from.source = "never")
install.packages(c('RCurl','XML'))
remotes::install_cran("BiocManager")
BiocManager::install(version = ${{ steps.R.outputs.biocversion}}, ask = FALSE)
BiocManager::install(c('GenomeInfoDb', 'Rsamtools'))
BiocManager::install(c('Biostrings', 'GenomicAlignments', 'IRanges'))
install.packages('matrixStats')
install.packages(c('shazam', 'alakazam', 'tigger', 'airr', '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
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