-
Notifications
You must be signed in to change notification settings - Fork 1.1k
163 lines (158 loc) · 5.5 KB
/
setupapp.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
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
158
159
160
161
162
163
# Jenkinsfile.monai-postmerge
name: deploy
on:
# full tests for all the important branches
push:
branches:
- main
- releasing/*
- feature/*
- dev
concurrency:
# automatically cancel the previously triggered workflows when there's a newer version
group: deploy-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# caching of these jobs:
# - docker-py3-pip- (shared)
# - ubuntu 37 38 39 310-pip-
# - os-latest-pip (shared)
coverage-py3:
if: github.repository == 'Project-MONAI/MONAI'
container:
image: nvcr.io/nvidia/pytorch:22.04-py3
options: --gpus all
runs-on: [self-hosted, linux, x64, integration]
steps:
- uses: actions/checkout@v3
- name: cache weekly timestamp
id: pip-cache
run: |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
- name: cache for pip
if: ${{ startsWith(github.ref, 'refs/heads/dev') }}
uses: actions/cache@v3
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: docker-py3-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install the dependencies
run: |
which python
python -m pip install --upgrade pip wheel
python -m pip install --upgrade torch torchvision
python -m pip install -r requirements-dev.txt
- name: Run unit tests report coverage
run: |
python -m pip list
git config --global --add safe.directory /__w/MONAI/MONAI
git clean -ffdx
df -h
# python -m pip cache info
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils | tail -n 1)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
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")))'
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
coverage xml --ignore-errors
if pgrep python; then pkill python; fi
shell: bash
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage.xml
test-py3x:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: cache weekly timestamp
id: pip-cache
run: |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
- name: cache for pip
uses: actions/cache@v3
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install the dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt
- name: Run quick tests CPU ubuntu
run: |
python -m pip list
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
BUILD_MONAI=0 ./runtests.sh --build --quick --unittests --disttests
BUILD_MONAI=1 ./runtests.sh --build --quick --min
coverage xml --ignore-errors
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage.xml
install: # pip install from github url, the default branch is dev
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: cache weekly timestamp
id: pip-cache
run: |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
- name: cache for pip
uses: actions/cache@v3
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install the default branch no build (dev branch only)
if: github.ref == 'refs/heads/dev'
run: |
BUILD_MONAI=0 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
python -c 'import monai; monai.config.print_config()'
cd $(python -c 'import monai; import os; print(os.path.dirname(monai.__file__))')
ls .
pip uninstall -y monai
- name: Install the default branch with build (dev branch only)
if: github.ref == 'refs/heads/dev'
run: |
BUILD_MONAI=1 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
python -c 'import monai; monai.config.print_config()'
- name: Get the test cases (dev branch only)
if: github.ref == 'refs/heads/dev'
uses: actions/checkout@v3
with:
ref: dev
- name: Quick test installed (dev branch only)
if: github.ref == 'refs/heads/dev'
run: |
cd $GITHUB_WORKSPACE
rm -rf monai/
ls -al .
python -m pip install -r requirements-min.txt
python -m tests.min_tests
env:
QUICKTEST: True