-
-
Notifications
You must be signed in to change notification settings - Fork 54
190 lines (166 loc) · 5.35 KB
/
tests.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
name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
jobs:
wsi-artifacts:
runs-on: ubuntu-latest
steps:
- name: Cache WSI files
uses: actions/cache@v2
id: cache-wsis
with:
path: tests/fixtures/external-svs
key: wsi-files
- name: Download WSI artifacts
if: steps.cache-wsis.outputs.cache-hit != 'true'
id: load-wsis
run: |
mkdir -p tests/fixtures/external-svs
wget https://dbarchive.biosciencedbc.jp/data/open-tggates-pathological-images/LATEST/images/isoniazid/Liver/2458.svs -O tests/fixtures/external-svs/liver-1.svs
wget http://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-3.svs -O tests/fixtures/external-svs/cmu-3.svs
- name: Temporarly save WSI artifacts
uses: actions/upload-artifact@v2
with:
name: wsi-artifact
path: tests/fixtures/external-svs
retention-days: 1
build:
needs: wsi-artifacts
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
python-version: [3.7]
include:
- os: macOS-latest
python-version: 3.8
- os: ubuntu-latest
python-version: 3.8
- os: macOS-latest
python-version: 3.9
- os: ubuntu-latest
python-version: 3.9
- os: macOS-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.10"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Pixman 0.40 on Ubuntu
id: pixman-ubuntu
if: ${{ runner.os == 'Linux' }}
run: |
wget https://www.cairographics.org/releases/pixman-0.40.0.tar.gz
tar -xvf pixman-0.40.0.tar.gz
cd pixman-0.40.0
./configure
make
sudo make install
cd ..
- name: Install openslide
id: install-openslide
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install openslide-tools
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install openslide
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install wget
choco install 7zip-zstd
wget https://github.com/openslide/openslide-winbuild/releases/download/v20171122/openslide-win64-20171122.zip -P /c/downloads
7z e /c/downloads/openslide-win64-20171122.zip -aoa
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- uses: msys2/setup-msys2@v2
if: ${{ runner.os == 'Windows' }}
with:
update: true
- name: Install Pixman 0.40 on Windows
id: pixman-windows
if: ${{ runner.os == 'Windows' }}
run: |
pacman --noconfirm -S --needed mingw-w64-x86_64-pixman
pacman -Ql mingw-w64-x86_64-pixman
cp /mingw64/bin/libpixman-1-0.dll .
shell: msys2 {0}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
id: python-dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[testing]
python -m pip install flake8==3.8.4
python -m pip install black==22.3.0
python -m pip install pooch
python -m pip install bandit==1.7.0
- name: Black Code Style Format Check
id: black
run: |
black . --check --diff
- name: Lint with flake8
id: flake8
run: |
flake8 . --config=setup.cfg --count --statistics
- name: Check Vulnerabilities with Bandit
id: bandit
run: |
bandit -r -c bandit.yaml .
- name: Retrieve saved WSIs
uses: actions/download-artifact@v2
with:
name: wsi-artifact
path: tests/fixtures/external-svs
- name: Test with pytest
id: tests
run: |
python -m pytest --ignore=tests/benchmarks --cov=histolab --cov-report=xml
- name: DocTests
id: doctests
run: |
python -m pytest histolab/ --doctest-modules
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-umbrella
fail_ci_if_error: true
verbose: false
- name: Slack Notification
uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
delete-wsi-artifacts:
runs-on: ubuntu-latest
needs: build
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: wsi-artifact
failOnError: false