-
Notifications
You must be signed in to change notification settings - Fork 0
298 lines (291 loc) · 13.1 KB
/
cdci.yml
File metadata and controls
298 lines (291 loc) · 13.1 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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: CICD Python Package
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:
jobs:
test:
name: Unittests+streamlit
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
# ! for now (format output files of vuegen for streamlit)
src: "./src"
- uses: isort/isort-action@v1
with:
# ! should be removed once all imports are correctly sorted
sort-paths: src
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
cache-dependency-path: "**/pyproject.toml"
- name: lint package code with ruff
run: |
python -m pip install --upgrade pip
pip install ruff
ruff check src
- name: Install dependencies for testing
run: |
pip install pytest
pip install .
- name: Run tests
run: python -m pytest tests
- name: Execute streamlit report
run: |
cd docs
vuegen --directory example_data/Earth_microbiome_vuegen_demo_notebook
vuegen --config example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml
other-reports:
name: Reports - ${{ matrix.os.label }}, ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
os:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#example-using-a-multi-dimension-matrix
# - runner: "macos-14"
# label: "macos-14-arm64"
- runner: "ubuntu-latest"
label: "ubuntu-latest-x64"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
cache-dependency-path: "**/pyproject.toml"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install "."
- name: Quarto check
run: |
quarto check -h
quarto check
quarto install chromium
quarto install tinytex --no-prompt
- name: Execute streamlit report (to check)
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook
# here we are testing that the generated config from the -dir call works
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml
# repeat for easier inspection on GitHub:
- name: quarto html report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt html
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt html
- name: quarto pdf report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt pdf -qt_checks
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt pdf -qt_checks
- name: quarto docx report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt docx
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt docx
- name: quarto odt report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt odt
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt odt
- name: quarto revealjs report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt revealjs
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt revealjs
- name: quarto pptx report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt pptx
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt pptx
- name: quarto jupyter report
run: |
cd docs
vuegen -dir example_data/Earth_microbiome_vuegen_demo_notebook -rt jupyter
vuegen -c example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml -rt jupyter
- name: quarto html report based on predefined config file
run: |
cd docs
vuegen -c example_config_files/Basic_example_vuegen_demo_notebook_config.yaml -output_dir ../tests/report_examples/Basic_example_vuegen_demo_notebook_cfg/html -rt html
# Check for changes
if git diff ../tests/report_examples | grep .; then
echo "Error: One or more protected files have been modified."
exit 1
fi
- name: streamlit report based on predefined config file
run: |
cd docs
vuegen -c example_config_files/Basic_example_vuegen_demo_notebook_config.yaml -output_dir ../tests/report_examples/Basic_example_vuegen_demo_notebook_cfg
# Check for changes
if git diff ../tests/report_examples | grep .; then
echo "Error: One or more protected files have been modified."
exit 1
fi
- name: check streamlit report files for chatbot API
run: |
vuegen -c docs/example_config_files/Chatbot_example_config.yaml -output_dir tests/report_examples/chat_bot
if git diff tests/report_examples | grep .; then
echo Failed for report: $format
echo "Error: One or more protected files have been modified."
exit 1
fi
- name: check for changes in report files
run: |
# write streamlit report to test folder
vuegen -dir docs/example_data/Basic_example_vuegen_demo_notebook -output_dir tests/report_examples/Basic_example_vuegen_demo_notebook
# Check for changes
if git diff tests/report_examples | grep .; then
echo "Error: One or more protected files have been modified."
exit 1
fi
- name: check for changes in quarto report files
run: |
# write quarto based report to test folder
for format in html pdf docx odt revealjs pptx jupyter; do
vuegen -dir docs/example_data/Basic_example_vuegen_demo_notebook -output_dir tests/report_examples/Basic_example_vuegen_demo_notebook/$format -rt $format
# Check for changes
if git diff tests/report_examples | grep .; then
echo Failed for report: $format
echo "Error: One or more protected files have been modified."
exit 1
fi
done
publish:
name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags')
permissions:
id-token: write
needs:
- test
- other-reports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install twine and build
run: python -m pip install --upgrade twine build
- name: Build
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
build-executable:
name: Build-binary-${{ matrix.os.label }}
runs-on: ${{ matrix.os.runner }}
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release' ||
startsWith(github.ref, 'refs/tags') ||
github.event_name == 'workflow_dispatch'
needs:
- test
- other-reports
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
os:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#example-using-a-multi-dimension-matrix
- runner: "macos-14"
label: "macos-14-arm64"
- runner: "macos-latest"
label: "macos-15-arm64"
- runner: "windows-latest"
label: "windows-x64"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
cache-dependency-path: "**/pyproject.toml"
- name: Install VueGen GUI dependencies
run: |
pip install --upgrade pip
pip install ".[gui]"
- name: Install quarto tools
run: |
quarto install chromium
quarto install tinytex --no-prompt
- name: Quarto check
run: |
quarto check -h
quarto check
# installing with vuegen lead to a subtle bug installing tinytex through quarto
- name: Install pyinstaller
run: pip install pyinstaller
- name: Build executable
run: |
cd gui
pyinstaller -n vuegen_gui --onefile --windowed --collect-all pyvis --collect-all streamlit --collect-all st_aggrid --collect-all customtkinter --collect-all quarto_cli --collect-all plotly --collect-all _plotly_utils --collect-all traitlets --collect-all referencing --collect-all rpds --collect-all tenacity --collect-all pandas --collect-all numpy --collect-all matplotlib --collect-all openpyxl --collect-all xlrd --collect-all nbformat --collect-all nbclient --collect-all altair --collect-all rfc3987_syntax --collect-all itables --collect-all kaleido --collect-all pyarrow --collect-all dataframe_image --collect-all narwhals --collect-all PIL --collect-all vl_convert --collect-all typing-extensions --add-data ../docs/example_data/Basic_example_vuegen_demo_notebook:example_data/Basic_example_vuegen_demo_notebook --add-data ../docs/images/logo/vuegen_logo.png:. app.py
# --windowed only for mac, see:
# https://pyinstaller.org/en/stable/usage.html#building-macos-app-bundles
# 'Under macOS, PyInstaller always builds a UNIX executable in dist.'
# --onefile --windowed for Windows?
# --collect-all yaml --collect-all strenum --collect-all jinja2 --collect-all fastjsonschema --collect-all jsonschema --collect-all jsonschema_specifications
# replace by spec file once done...
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: vuegen_gui_${{ matrix.os.label }}
path: gui/dist/
- name: Upload MacOS Executable to a GitHub Release)
if: startsWith(matrix.os.runner, 'macos') && startsWith(github.ref, 'refs/tags')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo GITHUB_REF_NAME $GITHUB_REF_NAME
echo "Uploading vuegen_gui_${{ matrix.os.label }} to release $GITHUB_REF_NAME"
echo "Available files in build folder: gui/dist/"
cd gui/dist/
ls -lh
echo "Zip .app folder"
zip -r vuegen_gui_${{ matrix.os.label }}.zip vuegen_gui.app
echo "Uploading..."
gh release upload $GITHUB_REF_NAME vuegen_gui_${{ matrix.os.label }}.zip
# .app is folder that needs to be zipped
- name: Upload MacOS terminal application to a GitHub Release)
if: startsWith(matrix.os.runner, 'macos') && startsWith(github.ref, 'refs/tags')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo GITHUB_REF_NAME $GITHUB_REF_NAME
echo "Uploading vuegen_gui_${{ matrix.os.label }} to release $GITHUB_REF_NAME"
echo "Available files in build folder: gui/dist/"
cd gui/dist/
ls -lh
echo "Zip single file"
zip -r vuegen_gui_${{ matrix.os.label }}.zip vuegen_gui
echo "Uploading..."
gh release upload $GITHUB_REF_NAME vuegen_gui_${{ matrix.os.label }}_terminal.zip
# .app is folder that needs to be zipped
- name: Upload Windows Executable to a GitHub Release
if: startsWith(matrix.os.runner, 'windows') && startsWith(github.ref, 'refs/tags')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "GITHUB_REF_NAME in env $env:GITHUB_REF_NAME"
$GITHUB_REF_NAME = $env:GITHUB_REF_NAME
echo "Uploading vuegen_gui_${{ matrix.os.label }} to release $GITHUB_REF_NAME"
echo "Available files in build folder: gui/dist/"
ls gui/dist/
echo "Uploading..."
gh release upload $GITHUB_REF_NAME gui/dist/vuegen_gui.exe#vuegen_gui_${{ matrix.os.label }}.exe
# https://cli.github.com/manual/gh_release_upload
# .exe is a single file already