-
Notifications
You must be signed in to change notification settings - Fork 25
251 lines (214 loc) · 6.75 KB
/
ci.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- "*"
workflow_dispatch:
defaults:
run:
shell: bash -l {0}
concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}"
cancel-in-progress: true
jobs:
tests:
name: ${{ matrix.label }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- label: rdkit-2021
python-version: 3.8
extra_dependencies: "rdkit==2021.03.1"
- label: rdkit-latest
python-version: "3.10"
extra_dependencies: "rdkit"
steps:
- uses: actions/checkout@v3
- name: Install Firefox
uses: browser-actions/setup-firefox@latest
- run: firefox --version
- name: Prepare Selenium
uses: browser-actions/setup-geckodriver@latest
with:
geckodriver-version: "0.32.0"
- run: geckodriver --version
- name: Cache conda
uses: actions/cache@v3
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
conda-${{ hashFiles('tests/environment.yml') }}-${{ matrix.label }}-${{ env.CACHE_NUMBER }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('pyproject.toml') }}
restore-keys: pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
environment-file: tests/environment.yml
use-only-tar-bz2: true
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
- name: Check conda and pip
run: |
which python
python --version
pip --version
conda --version
mamba --version
- name: Install remaining conda dependencies
run: |
mamba install 'jupyterlab>=3,<5' ipywidgets=8 ${{ matrix.extra_dependencies }}
mamba list
- name: Build and install package
run: |
pip install .[tests,build]
jupyter labextension develop . --overwrite
pip list
jupyter labextension list
- name: Run tests
run: |
pytest --color=yes --disable-pytest-warnings \
--cov=mols2grid --cov-report=xml \
tests/ -m "not webdriver"
- name: Run webdriver tests
run: |
pytest --color=yes --disable-pytest-warnings \
--cov=mols2grid --cov-report=xml --cov-append \
tests/ -m "webdriver"
- name: Measure tests coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
verbose: true
- name: Prepare for build
run: |
pip uninstall -y mols2grid
python -m build .
echo "$SCRIPT" > test_install.py
cat test_install.py
env:
SCRIPT: |
import mols2grid as mg
from rdkit import RDConfig
sdf = f"{RDConfig.RDDocsDir}/Book/data/solubility.test.sdf"
mg.save(sdf, output="/dev/null")
- name: Test tar.gz build
run: |
pip install dist/mols2grid-*.tar.gz
python test_install.py
pip uninstall -y mols2grid
- name: Test wheel build
run: |
pip install dist/mols2grid-*.whl
python test_install.py
notebook-tests:
name: ${{ matrix.label }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- label: JLab-3-Widgets-7
extra_dependencies: "jupyterlab>=3.2 ipywidgets=7"
- label: JLab-4-Widgets-8
extra_dependencies: "jupyterlab=4 ipywidgets=8"
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
conda-${{ hashFiles('tests/environment.yml') }}-${{ matrix.label }}-${{ env.CACHE_NUMBER }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('pyproject.toml') }}
restore-keys: pip-
- name: Get yarn cache directory path
id: yarn-ui-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn
uses: actions/cache@v3
with:
path: ${{ steps.yarn-ui-cache-dir-path.outputs.dir }}
key: yarn-ui-${{ hashFiles('tests/notebooks/yarn.lock') }}
restore-keys: |
yarn-ui-
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
environment-file: tests/environment.yml
use-only-tar-bz2: true
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
- name: Install remaining conda dependencies
run: |
mamba install rdkit jupyter-packaging~=0.10 ${{ matrix.extra_dependencies }}
mamba list
- name: Build the extension
run: |
pip install -e .[build]
jupyter labextension develop . --overwrite
jupyter labextension list
- name: Install Test Dependencies
run: |
jlpm install --no-immutable
npm install [email protected]
npx playwright install chromium
working-directory: tests/notebooks
- name: Execute integration tests
working-directory: tests/notebooks
run: |
npx playwright test
- name: Upload Playwright Test assets
if: always()
uses: actions/upload-artifact@v3
with:
name: notebooks-test-assets
path: |
tests/notebooks/test-results
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v3
with:
name: notebooks-test-report
path: |
tests/notebooks/playwright-report
- name: Update snapshots
if: failure()
working-directory: tests/notebooks
run: |
jlpm test:update
- name: Upload updated snapshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: notebook-updated-snapshots
path: tests/notebooks/tests