-
Notifications
You must be signed in to change notification settings - Fork 14
80 lines (68 loc) · 2.18 KB
/
test.yml
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
name: nitorch-test
on:
workflow_dispatch:
inputs:
fail-fast:
description: 'Fail fast mode'
required: false
default: 'true'
push:
paths:
# all library files
- "nitorch/**"
branches: [ master ]
pull_request:
# always run tests on pull request
branches: [ master ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: ${{ github.event.inputs.fail-fast == 'true' }}
matrix:
os: [ ubuntu-18.04 ] # we only run tests on ubuntu/cpu
python-version: [ '3.6' ] # smallest version supported
pytorch-version: [ '1.4', '1.10' ] # smallest and biggest versions
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install pip
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install nibabel
pip install tifffile
- name: Install PyTorch ${{ matrix.pytorch-version }}
env:
cuda: cpu
torch: ${{ matrix.pytorch-version }}
shell: bash
run: |
os="$(cut -d'-' -f1 <<< ${{ matrix.os }})"
echo "$os"
if [ ! -f "./scripts/actions/install_pytorch_${os}.sh" ]; then
echo "pytorch not available on ${os}"
exit 1
fi
source "./scripts/actions/install_pytorch_${os}.sh"
# we must build in development mode for pytest to work in place
- name: Build nitorch
run: |
# install scipy ourselves because setuptools does a poor job
pip install scipy
# wget needed for io test
pip install wget
NI_USE_CUDA=0 NI_COMPILED_BACKEND="C" python setup.py develop
python -c "from nitorch._C import spatial"
NI_SHOW_COMPILED_BACKEND=1 python -c "from nitorch._C import grid"
# - name: Lint
# run: |
# pip install flake8
# flake8 .
- name: Tests
run: |
pip install pytest
pytest --ignore nitorch/tests/test_gradcheck_spatial.py