forked from Project-MONAI/MONAI
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (146 loc) · 4.49 KB
/
Copy pathpythonapp.yml
File metadata and controls
157 lines (146 loc) · 4.49 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: build
on:
# quick tests for every pull request
push:
branches:
- master
pull_request:
jobs:
flake8-py3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 --version
python -c 'import monai; monai.config.print_config()'
MYPYPATH=$(pwd)/monai flake8 $(pwd) --count --statistics
quick-py3:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Prepare pip wheel
run: |
which python
python -m pip install --upgrade pip wheel
- if: runner.os == 'windows'
name: Install torch cpu from pytorch.org (Windows only)
run: |
python -m pip install torch==1.4 -f https://download.pytorch.org/whl/cpu/torch_stable.html
- name: Install the dependencies
run: |
python -m pip install torch==1.4
python -m pip install -r requirements-dev.txt
python -m pip list
- name: Run quick tests (CPU ${{ runner.os }})
run: |
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
python -m unittest -v
env:
QUICKTEST: True
GPU-quick-py3:
container:
image: nvcr.io/nvidia/pytorch:20.03-py3
options: --gpus all
runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v2
- name: Install the dependencies
run: |
which python
python -m pip install --upgrade pip wheel
python -m pip uninstall -y torch torchvision
python -m pip install torch==1.4
python -m pip install -r requirements-dev.txt
- name: Run quick tests (GPU)
run: |
python -m pip list
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
./runtests.sh --quick
pip list
coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
packaging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install setuptools
run: |
python -m pip install --user --upgrade pip setuptools wheel twine
- name: Test source archive and wheel file
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
root_dir=$PWD
echo "$root_dir"
set -e
# build tar.gz and wheel
python setup.py check -m -s
python setup.py sdist bdist_wheel
python -m twine check dist/*
# move packages to a temp dir
tmp_dir=$(mktemp -d)
cp dist/monai* "$tmp_dir"
rm -r build dist monai.egg-info
cd "$tmp_dir"
ls -al
# install from wheel
python -m pip install monai*.whl
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monai; print(monai.__file__)'
python -m pip uninstall -y monai
rm monai*.whl
# install from tar.gz
python -m pip install monai*.tar.gz
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monai; print(monai.__file__)'
python -m pip uninstall -y monai
rm monai*.tar.gz
# clean up
cd "$root_dir"
rm -r "$tmp_dir"
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r docs/requirements.txt
- name: Make html
run: |
cd docs/
make html