Skip to content

Commit 615887c

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

9 files changed

+270
-0
lines changed

.github/workflows/tests.yml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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-18.04']
30+
python-version: [3.6, 3.7, 3.8, 3.9]
31+
check: ['test']
32+
pip-flags: ['']
33+
depends: ['REQUIREMENTS']
34+
deb-depends: [false]
35+
nipype-extras: ['doc,tests,profiler']
36+
include:
37+
- os: ubuntu-18.04
38+
python-version: 3.8
39+
check: test
40+
pip-flags: ''
41+
depends: REQUIREMENTS
42+
deb-depends: true
43+
nipype-extras: doc,tests,nipy,profiler,duecredit,ssh
44+
env:
45+
DEPENDS: ${{ matrix.depends }}
46+
CHECK_TYPE: ${{ matrix.check }}
47+
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
48+
INSTALL_DEB_DEPENDENCIES: ${{ matrix.deb-depends }}
49+
NIPYPE_EXTRAS: ${{ matrix.nipype-extras }}
50+
INSTALL_TYPE: pip
51+
CI_SKIP_TEST: 1
52+
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
submodules: recursive
57+
fetch-depth: 0
58+
- name: Set up Python ${{ matrix.python-version }}
59+
uses: actions/setup-python@v2
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
- name: Display Python version
63+
run: python -c "import sys; print(sys.version)"
64+
- name: Create virtual environment
65+
run: tools/ci/create_venv.sh
66+
- name: Build archive
67+
run: |
68+
source tools/ci/build_archive.sh
69+
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
70+
- name: Install Debian dependencies
71+
run: tools/ci/install_deb_dependencies.sh
72+
if: ${{ matrix.os == 'ubuntu-18.04' }}
73+
- name: Install dependencies
74+
run: tools/ci/install_dependencies.sh
75+
- name: Install Nipype
76+
run: tools/ci/install.sh
77+
- name: Run tests
78+
run: tools/ci/check.sh
79+
if: ${{ matrix.check != 'skiptests' }}
80+
- uses: codecov/codecov-action@v1
81+
with:
82+
file: coverage.xml
83+
if: ${{ always() }}
84+
- name: Upload pytest test results
85+
uses: actions/upload-artifact@v2
86+
with:
87+
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
88+
path: test-results.xml
89+
if: ${{ always() && matrix.check == 'test' }}

tools/ci/activate.sh

+9
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

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
elif [ "$INSTALL_TYPE" == "pip" ]; then
25+
export ARCHIVE="."
26+
fi
27+
28+
set +eux

tools/ci/check.sh

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

tools/ci/create_venv.sh

+24
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

+17
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

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
echo Installing nipype
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 nipype

tools/ci/install_deb_dependencies.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
11+
sudo apt update
12+
sudo apt install -y -qq fsl afni elastix fsl-atlases xvfb fusefat graphviz
13+
fi

tools/ci/install_dependencies.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
14+
set -x
15+
16+
if [ -n "$EXTRA_PIP_FLAGS" ]; then
17+
EXTRA_PIP_FLAGS=${!EXTRA_PIP_FLAGS}
18+
fi
19+
20+
if [ -n "$DEPENDS" ]; then
21+
pip install ${EXTRA_PIP_FLAGS} --prefer-binary ${!DEPENDS}
22+
fi
23+
24+
set +eux
25+
26+
echo Done installing dependencies

0 commit comments

Comments
 (0)