-
Notifications
You must be signed in to change notification settings - Fork 140
457 lines (432 loc) · 15 KB
/
workflow_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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# for a list of available software on the different virtual environments, please see:
# https://github.com/actions/virtual-environments/tree/main/images
name: workflow ci
on: [push, pull_request]
env:
RETENTION_DAYS: 15
jobs:
#checks if this file has changed
check_workflow:
name: check workflow_ci
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: .github/workflows/workflow_ci.yml
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
#checks if build scripts have changed
check_build_scripts:
name: check build scripts and tools
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: |
.github/workflows/workflow_ci.yml
Current_Development_Tools.md
script/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
check_tests_dotnet:
name: check if dotnet tests changed
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: |
tests/dotnet/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
check_tests_js:
name: check if js tests changed
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: |
tests/javascript/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
check_tests_py:
name: check if py tests changed
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: |
tests/python/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
#checks if src/dotnet files have changed
check_dotnet:
name: check src/dotnet
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: src/dotnet/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
#checks if src/bindings have changed
check_bindings:
name: check src/bindings
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: checkout
uses: actions/[email protected]
with:
fetch-depth: 2
- name: check changed files
uses: tj-actions/changed-files@v42
id: changed-files
with:
files: |
src/bindings/**
src/CMakeLists.txt
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
#only run if src files have changed.
build_js:
name: build rhino3dm.js
runs-on: ubuntu-latest
needs: [check_bindings, check_workflow, check_build_scripts, check_tests_js]
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_js.outputs.any_changed == 'true' }}
container:
image: emscripten/emsdk:3.1.30
steps:
- name: info
run: python3 --version && emcc --version && cmake --version
- name: checkout
uses: actions/[email protected]
- name: safe dir
run: git config --system --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: git submodule update --init
- name: bootstrap
run: python3 script/bootstrap.py -p js
- name: setup js module
run: python3 script/setup.py -p js -o -v -d -m
- name: build js module
run: python3 script/build.py -p js -o -v
- name: copy files
shell: bash
run: |
mkdir src/build/javascript/artifacts
mv src/build/javascript/rhino3dm.js src/build/javascript/artifacts/rhino3dm.module.js
cp package.json src/build/javascript/artifacts
cp docs/javascript/RHINO3DM.JS.md src/build/javascript/artifacts/README.md
cp src/js/rhino3dm.d.ts src/build/javascript/artifacts/rhino3dm.d.ts
- name: setup js
run: python3 script/setup.py -p js -o -v -d
- name: build js
run: python3 script/build.py -p js -o -v
- name: copy files
shell: bash
run: |
mv src/build/javascript/rhino3dm.js src/build/javascript/artifacts
mv src/build/javascript/artifacts_js/rhino3dm.wasm src/build/javascript/artifacts
npm install -g uglify-js
cd src/build/javascript/artifacts
uglifyjs rhino3dm.module.js --compress -o rhino3dm.module.min.js
uglifyjs rhino3dm.js --compress -o rhino3dm.min.js
- name: artifacts
uses: actions/[email protected]
with:
path: src/build/javascript/artifacts
name: rhino3dm.js
retention-days: ${{ env.RETENTION_DAYS }}
build_py_all_bdist:
name: build python ${{ matrix.python-version }} ${{ matrix.target }} ${{ matrix.os }} bdist
runs-on: ${{ matrix.os }}
needs: [check_bindings, check_workflow, check_build_scripts, check_tests_py]
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_py.outputs.any_changed == 'true' }}
strategy:
matrix:
os: [ubuntu-latest, windows-2019, macos-12, macos-14]
python-version: ['3.10', '3.11', '3.12']
include:
- os: ubuntu-latest
target: linux
- os: windows-2019
target: windows
- os: macos-12
target: macos
- os: macos-14
target: macos
fail-fast: false
steps:
- name: set up python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: info
run: python --version && cmake --version
- name: install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: checkout
uses: actions/[email protected]
- name: update submodules
run: git submodule update --init
- name: build python ${{ matrix.python-version }} ${{ matrix.os }}
run: python setup.py bdist_wheel build --debug
- name: artifacts
uses: actions/[email protected]
with:
path: dist
name: rhino3dm.py ${{ matrix.python-version }} ${{ matrix.os }}
retention-days: ${{ env.RETENTION_DAYS }}
build_py_sdist:
name: build python sdist
runs-on: ubuntu-latest
needs: [check_bindings, check_workflow, check_build_scripts, check_tests_py]
if: ${{ needs.check_bindings.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_py.outputs.any_changed == 'true' }}
steps:
- name: setup python
uses: actions/[email protected]
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.9.x'
- name: info
run: python --version && cmake --version
- name: install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: checkout
uses: actions/[email protected]
- name: update submodules
run: git submodule update --init
- name: build python sdist
run: python setup.py sdist
- name: check sdist
run: |
# installs rhino3dm from the source distribution
# into a virtualenv and tries to import it
# set up directory
rm -rf test_install
mkdir test_install
cd test_install
# create virtualenv
python -m venv venv
. venv/bin/activate
pip install wheel
# install
pip install --verbose ../dist/*.tar.gz
# test
python -c "import rhino3dm; print(rhino3dm.__version__)"
- name: list files
run: ls -R
- name: artifact name
id: artifactname
run: |
cd dist
echo "file=$(ls *.tar.gz| head -1)" >> $GITHUB_OUTPUT
- name: artifacts
uses: actions/[email protected]
with:
path: dist
name: ${{ steps.artifactname.outputs.file }}
build_dotnet:
name: build dotnet
runs-on: ubuntu-latest
#container:
#image: mcneel/rhino3dm-dev-amzn2
needs: [check_dotnet, check_workflow, check_build_scripts, check_tests_dotnet]
if: ${{ needs.check_dotnet.outputs.any_changed == 'true' || needs.check_workflow.outputs.any_changed == 'true' || needs.check_build_scripts.outputs.any_changed == 'true' || needs.check_tests_dotnet.outputs.any_changed == 'true'}}
steps:
- name: info
run: python3 --version && cmake --version && dotnet --version && git --version
- name: checkout
uses: actions/[email protected]
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: ls && git submodule update --init
- name: bootstrap
run: python3 script/bootstrap.py -p linux
- name: setup
run: python3 script/setup.py -p linux -v
- name: build dotnet
run: python3 script/build.py -p linux -v
- name: pack dotnet
run: dotnet pack src/dotnet/Rhino3dm.csproj -c Debug
- name: artifacts
uses: actions/[email protected]
with:
path: |
src/build/linux/dotnet/Rhino3dm.dll
src/build/linux/librhino3dm_native.so
src/dotnet/bin/Debug/*.nupkg
name: rhino3dm.net
retention-days: ${{ env.RETENTION_DAYS }}
#tests
test_dotnet:
name: test dotnet
runs-on: ubuntu-latest
needs: [build_dotnet]
steps:
- name: info
run: python3 --version && cmake --version && dotnet --version && git --version
- name: checkout
uses: actions/[email protected]
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: download artifact
uses: actions/[email protected]
with:
name: rhino3dm.net
path: tests/dotnet/lib
- name: test dotnet
run: |
NUGET_FILE="$(find tests/dotnet/lib/dotnet/bin/Debug -type f -name "*.nupkg")"
FILENAME=$(basename ${NUGET_FILE})
NAME=${FILENAME%.*}
VERSION=${NAME:9}
dotnet nuget add source $(pwd)/tests/dotnet/lib/dotnet/bin/Debug
cd tests/dotnet
dotnet add package Rhino3dm -v ${VERSION}
dotnet build
dotnet test
test_python_bdist:
name: test py ${{ matrix.python-version }} ${{ matrix.target }} ${{ matrix.os }} bdist
runs-on: ${{ matrix.os }}
needs: [build_py_all_bdist]
strategy:
matrix:
os: [ubuntu-latest, windows-2019, macos-12, macos-14]
python-version: ['3.10', '3.11', '3.12']
include:
- os: ubuntu-latest
target: linux
- os: windows-2019
target: windows
- os: macos-12
target: macos
- os: macos-14
target: macos
fail-fast: false
steps:
- name: set up python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: info
run: python --version && cmake --version
- name: checkout
uses: actions/[email protected]
- name: download artifact
uses: actions/[email protected]
with:
name: rhino3dm.py ${{ matrix.python-version }} ${{ matrix.os }}
path: tests/python/lib
- name: install whl
shell: bash
run: pip install --no-index tests/python/lib/*.whl --force-reinstall
- name: test python bdist
run: |
cd tests/python
python -m unittest discover .
test_javascript:
name: test javascript
runs-on: ubuntu-latest
needs: [build_js]
steps:
- name: info
run: python3 --version && cmake --version && node --version
- name: checkout
uses: actions/[email protected]
- name: download artifact
uses: actions/[email protected]
with:
name: rhino3dm.js
path: tests/javascript/lib
- name: test javascript
run: |
ls tests/javascript/lib
cd tests/javascript
npm i
npm test