-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from effigies/ci/test_minimum_dependencies
MAINT: Test minimum dependencies with TravisCI
- Loading branch information
Showing
8 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# vim ft=yaml | ||
os: linux | ||
dist: xenial | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- libgomp1 | ||
|
||
|
||
language: python | ||
cache: pip | ||
|
||
python: | ||
- 3.6 | ||
- 3.7 | ||
- 3.8 | ||
|
||
env: | ||
global: | ||
- CHECK_TYPE="tests" | ||
- INSTALL_DEPENDS="pip setuptools" | ||
- DEPENDS="-r min-requirements.txt" | ||
- MRI_ROBUST_TEMPLATE=sx2n7/providers/osfstorage/5e825301d0e35400ebb481f2 | ||
- FS_LICENSE=/tmp/freesurfer/license.txt | ||
- TEST_DATA_HOME=/tmp/data | ||
|
||
before_install: | ||
- python -m pip install --upgrade pip virtualenv | ||
- virtualenv --python=python /tmp/venv | ||
- source /tmp/venv/bin/activate | ||
- python --version | ||
- python -m pip --version | ||
- python -m pip install --upgrade $INSTALL_DEPENDS | ||
- python -m pip --version | ||
|
||
install: | ||
- if [ -n "$DEPENDS" ]; then python -m pip install $DEPENDS; fi | ||
- python -m pip install . | ||
- python -c "import sdcflows; print(sdcflows.__version__)" | ||
- travis_retry python -m pip install "sdcflows[$CHECK_TYPE]" | ||
|
||
before_script: | ||
# External dependencies | ||
- travis_retry bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh); | ||
- sudo apt-get update | ||
- sudo apt-get install -y --no-install-recommends git-annex-standalone fsl afni ants | ||
- curl https://files.osf.io/v1/resources/$MRI_ROBUST_TEMPLATE?direct > mri_robust_template | ||
- sudo install mri_robust_template /usr/local/bin | ||
- mkdir /tmp/freesurfer | ||
- echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > $FS_LICENSE | ||
- python -m pip install datalad | ||
# Data dependencies | ||
- python -c "from templateflow import api as tfapi; | ||
tfapi.get('MNI152NLin2009cAsym', resolution=2, desc='brain', suffix='mask'); | ||
tfapi.get('MNI152NLin2009cAsym', resolution=1, label='brain', suffix='probseg'); | ||
tfapi.get('MNI152NLin2009cAsym', resolution=2, desc='fMRIPrep', suffix='boldref');" | ||
- mkdir -p $TEST_DATA_HOME | ||
- datalad install -rg -J 1 -s ///openneuro/ds001600 $TEST_DATA_HOME/ds001600 | ||
- curl https://files.osf.io/v1/resources/9sy2a/providers/osfstorage/5d44b940bcd6d900198ed6be/?zip= --output testdata.zip | ||
- unzip testdata.zip -d $TEST_DATA_HOME/testdata | ||
|
||
script: | ||
- pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules sdcflows | ||
|
||
after_script: | ||
- python -m pip install codecov | ||
- python -m codecov --flags travis --file cov.xml -e $TRAVIS_JOB_NUMBER |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Auto-generated by tools/update_requirements.py | ||
nibabel==3.0.1 | ||
niflow-nipype1-workflows==0.0.1 | ||
nipype==1.5.1 | ||
niworkflows==1.3.0 | ||
numpy | ||
pybids==0.11.1 | ||
templateflow==0.6 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Auto-generated by tools/update_requirements.py | ||
nibabel>=3.0.1 | ||
niflow-nipype1-workflows~=0.0.1 | ||
nipype<2.0,>=1.5.1 | ||
niworkflows~=1.3.0 | ||
numpy | ||
pybids>=0.11.1 | ||
templateflow>=0.6 |
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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python3 | ||
from copy import copy | ||
from configparser import ConfigParser | ||
from pathlib import Path | ||
from packaging.requirements import Requirement, SpecifierSet | ||
|
||
repo_root = Path(__file__).parent.parent | ||
setup_cfg = repo_root / "setup.cfg" | ||
reqs = repo_root / "requirements.txt" | ||
min_reqs = repo_root / "min-requirements.txt" | ||
|
||
config = ConfigParser() | ||
config.read(setup_cfg) | ||
requirements = [Requirement(req) | ||
for req in config.get("options", "install_requires").strip().splitlines()] | ||
|
||
script_name = Path(__file__).relative_to(repo_root) | ||
|
||
|
||
def to_min(req): | ||
if req.specifier: | ||
req = copy(req) | ||
min_spec = [spec for spec in req.specifier if spec.operator in ('>=', '~=')][0] | ||
min_spec._spec = ('==', ) + min_spec._spec[1:] | ||
req.specifier = SpecifierSet(str(min_spec)) | ||
return req | ||
|
||
|
||
lines = [f"# Auto-generated by {script_name}", ""] | ||
|
||
# Write requirements | ||
lines[1:-1] = [str(req) for req in requirements] | ||
reqs.write_text("\n".join(lines)) | ||
|
||
# Write minimum requirements | ||
lines[1:-1] = [str(to_min(req)) for req in requirements] | ||
min_reqs.write_text("\n".join(lines)) |