forked from carpentries-incubator/SDC-BIDS-dMRI
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (84 loc) · 3.25 KB
/
build-test.yaml
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
name: Build, test
on:
push:
branches: main
pull_request
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
env:
ANTSPATH: /opt/ants
FSLPATH: /opt/fsl
steps:
- name: Checkout GitHub repository
uses: actions/checkout@v2
# Run with multiple Python versions
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Install Python requirements
- name: Install requirements
uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.pythonLocation }}-
if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest nbval
- name: Install ANTs
uses: actions/cache@v2
with:
path: /opt/ants
key: ants-v1
restore-keys: |
ants-v1
run: |
if [[ ! -d "${ANTSPATH}" ]]; then
sudo mkdir -p $ANTSPATH
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
fi
- name: Install FSL
uses: actions/cache@v2
with:
path: /opt/fsl
key: fsl-v1
restore-keys: |
fsl-v1
run: |
if [[ ! -d "${FSLPATH}" ]]; then
wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py || echo "Failed to download FSL installer"
python fslinstaller.py -d $FSLPATH -p -q || echo "Failed to install FSL"
rm -rf /opt/fsl/*/data/atlases
fi
# Download the necessary data
- name: Download data
run: |
pushd `pwd`
cd ${{ github.workspace }}/data
osf -p cmq8a fetch ds000221_subject/ds000221_sub-010006.zip
unzip ds000221_sub-010006.zip
rm ds000221_sub-010006.zip
popd
# Run the actual tests of all the Python Notebooks.
- name: Test Notebooks
run: |
export PYTHONPATH=$PYTHONPATH:`realpath ${{ github.workspace }}`
pytest --nbval-lax -v code/introduction/introduction.ipynb
pytest --nbval-lax -v code/introduction/solutions/introduction_solutions.ipynb
pytest --nbval-lax -v code/diffusion_tensor_imaging/diffusion_tensor_imaging.ipynb
pytest --nbval-lax -v code/diffusion_tensor_imaging/solutions/diffusion_tensor_imaging_solutions.ipynb
pytest --nbval-lax -v code/constrained_spherical_deconvolution/constrained_spherical_deconvolution.ipynb
pytest --nbval-lax -v code/constrained_spherical_deconvolution/solutions/constrained_spherical_deconvolution_solutions.ipynb
pytest --nbval-lax -v code/deterministic_tractography/deterministic_tractography.ipynb
pytest --nbval-lax -v code/deterministic_tractography/solutions/deterministic_tractography_solutions.ipynb
pytest --nbval-lax -v code/probabilistic_tractography/probabilistic_tractography.ipynb