Skip to content

Commit 81181ed

Browse files
committed
MAINT: Move from TravisCI to GHA
Resolves: #103.
1 parent 0adceb8 commit 81181ed

File tree

2 files changed

+267
-0
lines changed

2 files changed

+267
-0
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ '*' ]
9+
tags: [ '*' ]
10+
pull_request:
11+
branches: [ master, 'maint/*' ]
12+
13+
jobs:
14+
build:
15+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: [3.7, 3.8, 3.9]
20+
21+
steps:
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0
29+
- name: Build in confined, updated environment and interpolate version
30+
run: |
31+
python -m venv /tmp/buildenv
32+
source /tmp/buildenv/bin/activate
33+
python -m pip install -U setuptools pip wheel twine docutils
34+
python setup.py sdist bdist_wheel
35+
python -m twine check dist/nitransforms*
36+
37+
# Interpolate version
38+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
39+
TAG=${GITHUB_REF##*/}
40+
fi
41+
THISVERSION=$( python get_version.py )
42+
THISVERSION=${TAG:-$THISVERSION}
43+
echo "Expected VERSION: \"${THISVERSION}\""
44+
echo "THISVERSION=${THISVERSION}" >> ${GITHUB_ENV}
45+
46+
- name: Install in confined environment [sdist]
47+
run: |
48+
python -m venv /tmp/install_sdist
49+
source /tmp/install_sdist/bin/activate
50+
python -m pip install --upgrade pip wheel
51+
python -m pip install dist/nitransforms*.tar.gz
52+
INSTALLED_VERSION=$(python -c 'import nitransforms; print(nitransforms.__version__, end="")')
53+
echo "VERSION: \"${THISVERSION}\""
54+
echo "INSTALLED: \"${INSTALLED_VERSION}\""
55+
test "${INSTALLED_VERSION}" = "${THISVERSION}"
56+
57+
- name: Install in confined environment [wheel]
58+
run: |
59+
python -m venv /tmp/install_wheel
60+
source /tmp/install_wheel/bin/activate
61+
python -m pip install --upgrade pip wheel
62+
python -m pip install dist/nitransforms*.whl
63+
INSTALLED_VERSION=$(python -c 'import nitransforms; print(nitransforms.__version__, end="")')
64+
echo "INSTALLED: \"${INSTALLED_VERSION}\""
65+
test "${INSTALLED_VERSION}" = "${THISVERSION}"
66+
67+
- name: Install in confined environment [pip install .]
68+
run: |
69+
python -m venv /tmp/setup_install
70+
source /tmp/setup_install/bin/activate
71+
python -m pip install --upgrade pip wheel
72+
python -m pip install .
73+
INSTALLED_VERSION=$(python -c 'import nitransforms; print(nitransforms.__version__, end="")')
74+
echo "INSTALLED: \"${INSTALLED_VERSION}\""
75+
test "${INSTALLED_VERSION}" = "${THISVERSION}"
76+
77+
- name: Install in confined environment [pip install -e .]
78+
run: |
79+
python -m venv /tmp/setup_develop
80+
source /tmp/setup_develop/bin/activate
81+
python -m pip install pip
82+
python -m pip install --upgrade pip wheel
83+
python -m pip install -e .
84+
INSTALLED_VERSION=$(python -c 'import nitransforms; print(nitransforms.__version__, end="")')
85+
echo "INSTALLED: \"${INSTALLED_VERSION}\""
86+
test "${INSTALLED_VERSION}" = "${THISVERSION}"
87+
88+
flake8:
89+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v2
93+
- name: Set up Python 3.7
94+
uses: actions/setup-python@v1
95+
with:
96+
python-version: 3.7
97+
- run: pip install flake8
98+
- run: flake8 nitransforms/

.github/workflows/travis.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Deps & CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-linux:
7+
if: "!contains(github.event.head_commit.message, '[skip ci]' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'nipreps/sdcflows'))"
8+
runs-on: ubuntu-latest
9+
env:
10+
TEST_DATA_HOME: /home/runner/sdcflows-tests
11+
FSLDIR: /usr/share/fsl/5.0
12+
FSLOUTPUTTYPE: NIFTI_GZ
13+
FSLMULTIFILEQUIT: TRUE
14+
POSSUMDIR: /usr/share/fsl/5.0
15+
FSLTCLSH: /usr/bin/tclsh
16+
FSLWISH: /usr/bin/wish
17+
AFNI_HOME: /opt/afni
18+
AFNI_MODELPATH: /opt/afni/models
19+
AFNI_IMSAVE_WARNINGS: NO
20+
AFNI_TTATLAS_DATASET: /opt/afni/atlases
21+
AFNI_PLUGINPATH: /opt/afni/plugins
22+
ANTSPATH: /opt/ants
23+
strategy:
24+
max-parallel: 5
25+
matrix:
26+
python-version: [3.7, 3.8, 3.9]
27+
28+
steps:
29+
- uses: actions/cache@v2
30+
with:
31+
path: /var/lib/apt
32+
key: apt-cache-v2
33+
restore-keys: |
34+
apt-cache-v2
35+
- name: Install dependencies
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y --no-install-recommends \
39+
curl bzip2 ca-certificates \
40+
tcsh gsl-bin netpbm \
41+
libjpeg62 xvfb xterm \
42+
libglu1-mesa-dev libglw1-mesa \
43+
libxm4 build-essential
44+
45+
- name: Install FSL
46+
run: |
47+
sudo apt-get install -y --no-install-recommends fsl
48+
49+
- uses: actions/cache@v2
50+
with:
51+
path: /opt/afni
52+
key: afni-v1
53+
restore-keys: |
54+
afni-v1
55+
- name: Install AFNI
56+
run: |
57+
if [[ ! -d "${AFNI_HOME}" ]]; then
58+
curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries && \
59+
tcsh @update.afni.binaries -package linux_ubuntu_16_64 -bindir ${AFNI_HOME}
60+
fi
61+
62+
- uses: actions/cache@v2
63+
with:
64+
path: /opt/ants
65+
key: ants-v1
66+
restore-keys: |
67+
ants-v1
68+
- name: Install ANTS
69+
run: |
70+
if [[ ! -d "${ANTSPATH}" ]]; then
71+
sudo mkdir -p $ANTSPATH
72+
curl -sSL "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" | sudo tar -xzC $ANTSPATH --strip-components 1
73+
fi
74+
75+
- name: Git settings (pacify DataLad)
76+
run: |
77+
git config --global user.name 'NiPreps Bot'
78+
git config --global user.email '[email protected]'
79+
- name: Set up Python ${{ matrix.python-version }}
80+
uses: actions/setup-python@v2
81+
with:
82+
python-version: ${{ matrix.python-version }}
83+
- uses: actions/cache@v2
84+
id: conda
85+
with:
86+
path: |
87+
/usr/share/miniconda/pkgs
88+
/home/runner/.cache/pip
89+
key: python-${{ matrix.python-version }}-v2
90+
restore-keys: |
91+
python-${{ matrix.python-version }}-
92+
- name: Install DataLad
93+
run: |
94+
$CONDA/bin/conda install -c conda-forge git-annex datalad pip
95+
$CONDA/bin/pip install datalad-osf
96+
- uses: actions/checkout@v2
97+
- name: Install minimal dependencies
98+
run: |
99+
$CONDA/bin/pip install -r min-requirements.txt
100+
$CONDA/bin/pip install .[tests]
101+
102+
103+
- uses: actions/cache@v2
104+
with:
105+
path: ~/.cache/templateflow
106+
key: tf-cache-v1
107+
restore-keys: |
108+
tf-cache-
109+
- name: Get TemplateFlow's required objects
110+
run: |
111+
$CONDA/bin/python tools/cache_templateflow.py
112+
113+
- uses: actions/cache@v2
114+
with:
115+
path: ${{ env.TEST_DATA_HOME }}
116+
key: data-cache-v1
117+
restore-keys: |
118+
data-cache-
119+
- name: Install test data
120+
run: |
121+
export PATH=$CONDA/bin:$PATH
122+
mkdir -p ${{ env.TEST_DATA_HOME }}
123+
cd ${{ env.TEST_DATA_HOME }}
124+
125+
# ds001600
126+
datalad install -r https://github.com/nipreps-data/ds001600.git
127+
datalad update -r --merge -d ds001600/
128+
datalad get -r -d ds001600/ ds001600/sub-1/
129+
130+
# HCP/sub-101006
131+
datalad install -r https://github.com/nipreps-data/HCP101006.git
132+
datalad update -r --merge -d HCP101006/
133+
datalad get -r -d HCP101006
134+
135+
# ds001771
136+
datalad install -r https://github.com/nipreps-data/ds001771.git
137+
datalad update -r --merge -d ds001771/
138+
datalad get -r -d ds001771/ ds001771/sub-36/*
139+
datalad get -r -d ds001771/derivatives ds001771/derivatives/openneuro/sub-36/*
140+
141+
# ds000054
142+
datalad install -r https://github.com/nipreps-data/ds000054.git
143+
datalad update --merge -d ds000054/
144+
datalad get -r -d ds000054/ ds000054/sub-100185/*
145+
146+
# ds000206
147+
datalad install -r https://github.com/nipreps-data/ds000206.git
148+
datalad update -r --merge -d ds000206/
149+
datalad get -r -d ds000206/ ds000206/sub-05/
150+
151+
- name: Install FreeSurfer's mri_robust_template
152+
env:
153+
MRI_ROBUST_TEMPLATE: sx2n7/providers/osfstorage/5e825301d0e35400ebb481f2
154+
run: |
155+
curl https://files.osf.io/v1/resources/$MRI_ROBUST_TEMPLATE?direct > mri_robust_template
156+
sudo install mri_robust_template /usr/local/bin
157+
mkdir -p $HOME/.cache/freesurfer/
158+
echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > $HOME/.cache/freesurfer/license.txt
159+
160+
- name: Run pytest with coverage
161+
run: |
162+
export LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH
163+
export PATH=$ANTSPATH:${AFNI_HOME}:/usr/lib/fsl/5.0:$PATH
164+
$CONDA/bin/pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules sdcflows
165+
166+
- name: Submit code coverage
167+
run: |
168+
$CONDA/bin/conda install codecov
169+
$CONDA/bin/python -m codecov --flags travis --file cov.xml -e $GITHUB_RUN_NUMBER

0 commit comments

Comments
 (0)