Skip to content

Commit bf2d515

Browse files
committed
CI: Move from Travis to GitHub actions
1 parent 9e8b655 commit bf2d515

File tree

9 files changed

+276
-0
lines changed

9 files changed

+276
-0
lines changed

.github/workflows/tests.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Stable tests
2+
3+
# This file tests the claimed support range of nipype including
4+
#
5+
# * Operating systems: Linux, OSX
6+
# * Dependencies: minimum requirements, optional requirements
7+
# * Installation methods: setup.py, sdist, wheel, archive
8+
9+
on:
10+
push:
11+
branches:
12+
- master
13+
- maint/*
14+
pull_request:
15+
branches:
16+
- master
17+
- maint/*
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
stable:
25+
# Check each OS, all supported Python, minimum versions and latest releases
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
matrix:
29+
os: ['ubuntu-latest']
30+
python-version: [3.7]
31+
check: ['test']
32+
pip-flags: ['']
33+
depends: ['REQUIREMENTS']
34+
deb-depends: [false]
35+
nipype-extras: ['doc,tests,profiler']
36+
optional-depends: ['DEFAULT_OPT_DEPENDS']
37+
include:
38+
- os: ubuntu-latest
39+
python-version: 3.8
40+
check: test
41+
pip-flags: ''
42+
depends: REQUIREMENTS
43+
deb-depends: true
44+
nipype-extras: doc,tests,nipy,profiler,duecredit,ssh
45+
env:
46+
DEPENDS: ${{ matrix.depends }}
47+
OPTIONAL_DEPENDS: ${{ matrix.optional-depends }}
48+
CHECK_TYPE: ${{ matrix.check }}
49+
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
50+
INSTALL_DEB_DEPENDENCIES: ${{ matrix.deb-depends }}
51+
INSTALL_TYPE: pip
52+
CI_SKIP_TEST: 1
53+
54+
steps:
55+
- uses: actions/checkout@v2
56+
with:
57+
submodules: recursive
58+
fetch-depth: 0
59+
- name: Set up Python ${{ matrix.python-version }}
60+
uses: actions/setup-python@v2
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
- name: Display Python version
64+
run: python -c "import sys; print(sys.version)"
65+
- name: Create virtual environment
66+
run: tools/ci/create_venv.sh
67+
- name: Build archive
68+
run: |
69+
source tools/ci/build_archive.sh
70+
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
71+
- name: Install Debian dependencies
72+
run: tools/ci/install_deb_dependencies.sh
73+
if: ${{ matrix.os == 'ubuntu-latest' }}
74+
- name: Install dependencies
75+
run: tools/ci/install_dependencies.sh
76+
- name: Install NiBabel
77+
run: tools/ci/install.sh
78+
- name: Run tests
79+
run: tools/ci/check.sh
80+
if: ${{ matrix.check != 'skiptests' }}
81+
- uses: codecov/codecov-action@v1
82+
with:
83+
file: for_testing/coverage.xml
84+
if: ${{ always() }}
85+
- name: Upload pytest test results
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
89+
path: for_testing/test-results.xml
90+
if: ${{ always() && matrix.check == 'test' }}

tools/ci/activate.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if [ -e virtenv/bin/activate ]; then
2+
source virtenv/bin/activate
3+
elif [ -e virtenv/Scripts/activate ]; then
4+
source virtenv/Scripts/activate
5+
else
6+
echo Cannot activate virtual environment
7+
ls -R virtenv
8+
false
9+
fi

tools/ci/build_archive.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
echo "Building archive"
4+
5+
source tools/ci/activate.sh
6+
7+
set -eu
8+
9+
# Required dependencies
10+
echo "INSTALL_TYPE = $INSTALL_TYPE"
11+
12+
set -x
13+
14+
if [ "$INSTALL_TYPE" == "sdist" ]; then
15+
python setup.py egg_info # check egg_info while we're here
16+
python setup.py sdist
17+
export ARCHIVE=$( ls dist/*.tar.gz )
18+
elif [ "$INSTALL_TYPE" == "wheel" ]; then
19+
python setup.py bdist_wheel
20+
export ARCHIVE=$( ls dist/*.whl )
21+
elif [ "$INSTALL_TYPE" == "archive" ]; then
22+
export ARCHIVE="package.tar.gz"
23+
git archive -o $ARCHIVE HEAD
24+
fi
25+
26+
set +eux

tools/ci/check.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
echo Running tests
4+
5+
source tools/ci/activate.sh
6+
7+
set -eu
8+
9+
# Required variables
10+
echo CHECK_TYPE = $CHECK_TYPE
11+
12+
set -x
13+
14+
if [ "${CHECK_TYPE}" == "test" ]; then
15+
pytest --capture=no --verbose --doctest-modules -c nipype/pytest.ini \
16+
--cov-config .coveragerc --cov nipype --cov-report xml:cov.xml \
17+
--junitxml=test-results.xml nipype
18+
else
19+
false
20+
fi
21+
22+
set +eux
23+
24+
echo Done running tests

tools/ci/create_venv.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
echo Creating isolated virtual environment
4+
5+
source tools/ci/env.sh
6+
7+
set -eu
8+
9+
# Required variables
10+
echo SETUP_REQUIRES = $SETUP_REQUIRES
11+
12+
set -x
13+
14+
python -m pip install --upgrade pip virtualenv
15+
virtualenv --python=python virtenv
16+
source tools/ci/activate.sh
17+
python --version
18+
python -m pip install -U $SETUP_REQUIRES
19+
which python
20+
which pip
21+
22+
set +eux
23+
24+
echo Done creating isolated virtual environment

tools/ci/env.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SETUP_REQUIRES="pip setuptools>=30.3.0 wheel"
2+
3+
# Minimum requirements
4+
REQUIREMENTS="-r requirements.txt"
5+
# Minimum versions of minimum requirements
6+
MIN_REQUIREMENTS="-r min-requirements.txt"
7+
8+
# Numpy and scipy upload nightly/weekly/intermittent wheels
9+
NIGHTLY_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple"
10+
STAGING_WHEELS="https://pypi.anaconda.org/multibuild-wheels-staging/simple"
11+
PRE_PIP_FLAGS="--pre --extra-index-url $NIGHTLY_WHEELS --extra-index-url $STAGING_WHEELS"
12+
13+
for CONF in (/etc/fsl/fsl.sh /etc/afni/afni.sh); do
14+
if [ -r $CONF ]; then source $CONF; fi
15+
done
16+
17+
FSLOUTPUTTYPE=NIFTI_GZ

tools/ci/install.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
echo Installing nibabel
4+
5+
source tools/ci/activate.sh
6+
source tools/ci/env.sh
7+
8+
set -eu
9+
10+
# Required variables
11+
echo INSTALL_TYPE = $INSTALL_TYPE
12+
echo CHECK_TYPE = $CHECK_TYPE
13+
echo NIPYPE_EXTRAS = $NIPYPE_EXTRAS
14+
echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS
15+
16+
set -x
17+
18+
if [ -n "$EXTRA_PIP_FLAGS" ]; then
19+
EXTRA_PIP_FLAGS=${!EXTRA_PIP_FLAGS}
20+
fi
21+
22+
if [ "$INSTALL_TYPE" == "setup" ]; then
23+
python setup.py install
24+
else
25+
pip install $EXTRA_PIP_FLAGS $ARCHIVE
26+
fi
27+
28+
# Basic import check
29+
python -c 'import nipype; print(nipype.__version__)'
30+
31+
if [ "$CHECK_TYPE" == "skiptests" ]; then
32+
exit 0
33+
fi
34+
35+
pip install $EXTRA_PIP_FLAGS "nipype[$NIPYPE_EXTRAS]"
36+
37+
set +eux
38+
39+
echo Done installing nibabel

tools/ci/install_deb_dependencies.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
echo "Installing NeuroDebian dependencies"
4+
5+
set -eu
6+
7+
echo "INSTALL_DEB_DEPENDENCIES = $INSTALL_DEB_DEPENDENCIES"
8+
9+
if $INSTALL_DEB_DEPENDENCIES; then
10+
sudo rm -rf /dev/shm
11+
sudo ln -s /run/shm /dev/shm
12+
bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
13+
sudo apt update
14+
sudo apt install -y -qq fsl afni elastix fsl-atlases xvfb fusefat graphviz
15+
fi

tools/ci/install_dependencies.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
echo Installing dependencies
4+
5+
source tools/ci/activate.sh
6+
source tools/ci/env.sh
7+
8+
set -eu
9+
10+
# Required variables
11+
echo EXTRA_PIP_FLAGS = $EXTRA_PIP_FLAGS
12+
echo DEPENDS = $DEPENDS
13+
echo OPTIONAL_DEPENDS = $OPTIONAL_DEPENDS
14+
15+
set -x
16+
17+
if [ -n "$EXTRA_PIP_FLAGS" ]; then
18+
EXTRA_PIP_FLAGS=${!EXTRA_PIP_FLAGS}
19+
fi
20+
21+
if [ -n "$DEPENDS" ]; then
22+
pip install ${EXTRA_PIP_FLAGS} --prefer-binary ${!DEPENDS}
23+
if [ -n "$OPTIONAL_DEPENDS" ]; then
24+
for DEP in ${!OPTIONAL_DEPENDS}; do
25+
pip install ${EXTRA_PIP_FLAGS} --prefer-binary $DEP || true
26+
done
27+
fi
28+
fi
29+
30+
set +eux
31+
32+
echo Done installing dependencies

0 commit comments

Comments
 (0)