-
Notifications
You must be signed in to change notification settings - Fork 42
206 lines (171 loc) · 6.67 KB
/
pythonapp.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Python APP
on: [push, pull_request]
jobs:
fetch_cache:
name: fetch cache
runs-on: 'ubuntu-latest'
env:
TestDataUrl: 'https://zenodo.org/record/5147737/files/DICOM-RT-02.zip'
steps:
- name: Cache Test Data
id: cache-TestData
uses: actions/cache@v3
with:
enableCrossOsArchive: true
lookup-only: true
path: DICOM-RT-02.zip
key: ${{ env.TestDataUrl }}
- name: Download Test Data
if: steps.cache-TestData.outputs.cache-hit != 'true'
run: |
sudo apt-get install wget
wget -O DICOM-RT-02.zip $TestDataUrl
build_Linux:
needs: fetch_cache
strategy:
fail-fast: false
matrix:
python:
- '3.9'
- '3.10'
os:
- 'ubuntu-20.04'
# - 'ubuntu-22.04'
name: Build - ${{ matrix.os }} - Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
timeout-minutes: 40
env:
DISPLAY: ':99.0'
TestDataUrl: 'https://zenodo.org/record/5147737/files/DICOM-RT-02.zip'
steps:
- uses: actions/checkout@v3
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
poetry --version
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'poetry'
- name: Upgrade pip and setuptools
run: |
pip install --upgrade pip wheel setuptools
- name: Install plastimatch
run: |
sudo apt-get update
sudo apt-get install plastimatch
- name: Install dependencies
run: |
# python -m pip install --upgrade pip wheel setuptools
poetry install --no-root
- name: Workaround Install pyradiomics (no-use-pep517)
# https://github.com/AIM-Harvard/pyradiomics/issues/653#issuecomment-1245039225
# pyradiomics 3.1.0 has a metadata mismatch
run: |
poetry run pip install pyradiomics==3.0.1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Download Cached Test Data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
fail-on-cache-miss: true
path: DICOM-RT-02.zip
key: ${{ env.TestDataUrl }}
- name: Install test data
run: |
sudo apt-get install unzip
mkdir test/testdata
mkdir test/batchtestdata
unzip DICOM-RT-02.zip -d test/testdata
unzip DICOM-RT-02.zip -d test/batchtestdata
sudo chmod -R 777 test/testdata
sudo chmod -R 777 test/batchtestdata
- name: Testing setup
run: |
sudo apt-get update
sudo apt-get install xvfb libxkbcommon-x11-0 herbstluftwm libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libopengl0 freeglut3 freeglut3-dev
# sudo Xvfb :1 -screen 0 1024x768x24 </dev/null &
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
sleep 3
herbstluftwm &
sleep 1
- name: Testing and Coverage with pytest
run: |
# Append this for fail under x percent "--cov-fail-under=80"
poetry run python -m pytest "test/" -v --durations=10 --cov-config=.coveragerc --cov-report term-missing --cov=.
build_Windows:
needs: fetch_cache
strategy:
fail-fast: false
matrix:
python:
- '3.9'
- '3.10'
os:
# - 'windows-2019'
- 'windows-2022'
name: Build - ${{ matrix.os }} - Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
timeout-minutes: 50
# Tests on Windows are unstable. We do not want it to fail the entire test result
continue-on-error: true
env:
DISPLAY: ':99.0' # do we need this in Windows?
TestDataUrl: 'https://zenodo.org/record/5147737/files/DICOM-RT-02.zip'
PlastimatchWindowsUrl: 'https://downloads.sourceforge.net/project/plastimatch/Windows%20Binaries/Plastimatch-1.9.0-win64.msi'
steps:
- uses: actions/checkout@v3
- name: Install Poetry
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Add-Content $env:GITHUB_PATH "$env:APPDATA\Python\Scripts"
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'poetry'
- name: Upgrade pip and setuptools
run: |
pip install --upgrade pip wheel setuptools
- name: Install plastimatch
run: |
Invoke-WebRequest -Uri ${{ env.PlastimatchWindowsUrl }} -OutFile Plastimatch.msi
Start-Process -Wait msiexec -ArgumentList '/i Plastimatch.msi /passive'
Add-Content $env:GITHUB_PATH "C:\Program Files\Plastimatch"
- name: Install dependencies
run: |
poetry install --no-root
- name: Workaround Install pyradiomics (no-use-pep517)
# https://github.com/AIM-Harvard/pyradiomics/issues/653#issuecomment-1245039225
run: |
poetry run pip install pyradiomics==3.0.1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Download Cached Test Data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
fail-on-cache-miss: true
path: DICOM-RT-02.zip
key: ${{ env.TestDataUrl }}
- name: Install test data
run: |
7z x DICOM-RT-02.zip -o${{ github.workspace }}\test\testdata
7z x DICOM-RT-02.zip -o${{ github.workspace }}\test\batchtestdata
- name: Testing and Coverage with pytest
continue-on-error: true
run: |
# Append this for fail under x percent "--cov-fail-under=80"
# todo: currently in Windows some tests halt. Set timeout (in seconds) as a workaround.
cd ${{ github.workspace }}
poetry run python -m pytest "test/" -v --durations=10 --cov-config=.coveragerc --cov-report term-missing --cov=. --timeout=180