-
Notifications
You must be signed in to change notification settings - Fork 139
541 lines (523 loc) · 18.5 KB
/
workflow_release.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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
name: workflow release
on: [workflow_dispatch]
jobs:
build_py_sdist:
name: build python sdist
runs-on: ubuntu-latest
steps:
- name: setup python
uses: actions/setup-python@v5.0.0
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.7.x'
- name: info
run: python --version && cmake --version
- name: install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: checkout
uses: actions/checkout@v4.1.1
- name: update submodules
run: git submodule update --init
- name: build python sdist
run: python setup.py sdist build --debug
- 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__)"
#cd ..
#python -m unittest discover tests/python/
- 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/upload-artifact@v4.3.1
with:
path: dist
name: ${{ steps.artifactname.outputs.file }}
build_py_manylinux:
name: build python ${{ matrix.python-version }} manylinux_2_28
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64 #manylinux2014_x86_64
strategy:
matrix:
python-version: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
fail-fast: false
steps:
- name: info
run: /opt/python/${{ matrix.python-version }}/bin/python --version
- name: checkout
uses: actions/checkout@v4.1.1 #needs to stay this version until we upgrade this os
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: git submodule update --init
- name: build python manylinux
run: /opt/python/${{ matrix.python-version }}/bin/python setup.py bdist_wheel build --debug
- name: audit python wheel
run: auditwheel repair dist/*.whl
- name: list files
run: ls -R
- name: test python
shell: bash
run: |
find ./dist -type f -name "*.whl" -exec cp '{}' ./tests/python/lib \;
/opt/python/${{ matrix.python-version }}/bin/python -m pip install --no-index tests/python/lib/*.whl --force-reinstall
cd tests/python
/opt/python/${{ matrix.python-version }}/bin/python -m unittest discover .
- name: artifact name
id: artifactname
run: |
cd wheelhouse
echo "file=$(ls *.whl| head -1)" >> $GITHUB_OUTPUT
- name: artifacts
uses: actions/upload-artifact@v4.3.1 #needs to stay this version until we upgrade this os
with:
path: wheelhouse/*.whl
name: ${{ steps.artifactname.outputs.file }}
build_py_all_bdist:
name: build python ${{ matrix.python-version }} ${{ matrix.target }} bdist
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, macos-12, macos-14]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
include:
- os: windows-2019
target: windows
- os: macos-12
target: macos
- os: macos-14
target: macos
exclude:
- os: macos-14
python-version: 3.7
fail-fast: false
steps:
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5.0.0
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/checkout@v4.1.1
- name: update submodules
run: git submodule update --init
- name: build python ${{ matrix.python-version }} ${{ matrix.os }}
run: python setup.py bdist_wheel
- name: code-sign native libraries
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_TEMP_PWD: ${{ secrets.MACOS_KEYCHAIN_TEMP_PWD }}
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
./script/codesign-native.sh src/build
else
echo "$RUNNER_OS not supported for code-signing"
exit 0
fi
shell: bash
- name: list files
run: ls -R
- name: test python bdist
shell: bash
run: |
find ./dist -type f -name "*.whl" -exec cp '{}' ./tests/python/lib \;
pip install --no-index tests/python/lib/*.whl --force-reinstall
cd tests/python
python -m unittest discover .
- name: artifact name
id: artifactname
shell: bash
run: |
cd dist
echo "file=$(ls *.whl| head -1)" >> $GITHUB_OUTPUT
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: dist
name: ${{ steps.artifactname.outputs.file }}
build_dotnet_os:
name: build dotnet ${{ matrix.target }}
runs-on: ${{ matrix.os }}
#container:
#image: ${{ matrix.image }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-2022]
include:
- os: ubuntu-latest
target: linux
#image: mcneel/rhino3dm-dev-amzn2
artifact-path: src/build/linux/librhino3dm_native.so
- os: windows-2022
target: windows
#image: ""
artifact-path: src\build\windows\*\Release\librhino3dm_native.dll
- os: macos-14
target: macos
#image: ""
artifact-path: src/build/macos/Release/librhino3dm_native.dylib
fail-fast: false
steps:
#- name: setup dotnet
# if: ${{ matrix.target == 'macos'}}
# uses: actions/setup-dotnet@v4.0.0
# with:
# dotnet-version: '7.0.x'
- name: setup cmake
if: ${{ matrix.target != 'linux' }}
uses: jwlawson/actions-setup-cmake@v2.0.0
with:
cmake-version: '3.25.0'
- name: checkout
uses: actions/checkout@v4.1.1
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: ls && git submodule update --init
- name: bootstrap dotnet ${{ matrix.target }}
run: python3 script/bootstrap.py -p ${{ matrix.target }}
- name: setup dotnet ${{ matrix.target }}
run: python3 script/setup.py -p ${{ matrix.target }} -v -l
- name: build dotnet ${{ matrix.target }}
run: python3 script/build.py -p ${{ matrix.target }} -v -l
- name: list
run: "ls -R src/build/${{ matrix.target }}"
- name: code-sign native libraries
if: ${{ matrix.target == 'macos' }}
env:
IDENTITY_ID: ${{ secrets.IDENTITY_ID }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_TEMP_PWD: ${{ secrets.MACOS_KEYCHAIN_TEMP_PWD }}
shell: bash
run: ./script/codesign-native.sh src/build/macos/Release
- name: notarize native library
if: ${{ matrix.target == 'macos' }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MACDEV_PW: ${{ secrets.MACDEV_PW }}
shell: bash
run: ./script/notarize-native.sh src/build/macos/Release/librhino3dm_native.dylib
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: ${{ matrix.artifact-path }}
name: rhino3dm.net ${{ matrix.target }}
build_dotnet_arm64:
name: build dotnet arm 64
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4.1.1
- name: safe directory
run: git config --global --add safe.directory /__w/rhino3dm/rhino3dm
- name: update submodules
run: ls && git submodule update --init
- name: setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: build rhino3dm native lib
uses: addnab/docker-run-action@v3
with:
image: mcneel/rhino3dm-dev-arm64
options: -v ${{ github.workspace }}:/src
run: |
uname -a
cd src
echo 'info'
python3 --version && cmake --version && dotnet --version && git --version
echo 'bootstrap'
python3 script/bootstrap.py -p linux
echo 'setup'
python3 script/setup.py -p linux -v -l
echo 'build'
python3 script/build.py -p linux -v -l
ldd src/build/linux/librhino3dm_native.so
- name: artifacts
uses: actions/upload-artifact@v4.3.1
with:
path: |
src/build/linux/librhino3dm_native.so
name: rhino3dm.net linux arm64
retention-days: ${{ env.RETENTION_DAYS }}
pack_dotnet:
name: pack dotnet
needs: [build_dotnet_os, build_dotnet_arm64]
runs-on: windows-2022
steps:
- name: set up python
uses: actions/setup-python@v5.0.0
with:
python-version: 3.7.x
- name: setup cmake
uses: jwlawson/actions-setup-cmake@v2.0.0
with:
cmake-version: '3.21.1'
- name: checkout
uses: actions/checkout@v4.1.1
- name: update submodules
run: ls && git submodule update --init
- name: bootstrap dotnet
run: python script/bootstrap.py -p windows
- name: setup dotnet
run: python script/setup.py -p windows -v
- name: build dotnet
run: dotnet build src/dotnet/Rhino3dm.csproj
- name: download rhino3dm.net linux
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net linux
path: src/build/linux/Release/
- name: download rhino3dm.net linux arm64
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net linux arm64
path: src/build/linux/arm64/Release/
- name: download rhino3dm.net macos
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net macos
path: src/build/macos/Release/
- name: download rhino3dm.net windows
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net windows
path: src/build/windows/
- name: list
run: "ls -R src/build/"
- name: pack dotnet
run: dotnet pack src/dotnet/Rhino3dm.csproj
- name: artifacts nupkg
uses: actions/upload-artifact@v4.3.1
with:
path: src/dotnet/bin/Release/Rhino3dm.*.nupkg #${{ matrix.artifact-path }}
name: rhino3dm.net nupkg
build_js:
name: build rhino3dm.js
runs-on: ubuntu-latest
container:
image: emscripten/emsdk:3.1.30
steps:
- name: info
run: python3 --version && emcc --version && cmake --version
- name: checkout
uses: actions/checkout@v4.1.1
- 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 -m
- name: build js
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
- 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/upload-artifact@v4.3.1
with:
path: src/build/javascript/artifacts
name: rhino3dm.js
retention-days: ${{ env.RETENTION_DAYS }}
# TESTS
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/checkout@v4.1.1
- name: download artifact
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.js
path: tests/javascript/lib
- name: test javascript
run: |
ls tests/javascript/lib
cd tests/javascript
npm i
npm test
test_dotnet:
name: test dotnet
runs-on: ubuntu-latest
needs: [pack_dotnet]
steps:
- name: checkout
uses: actions/checkout@v4.1.1
- name: download rhino3dm.net nuget
uses: actions/download-artifact@v4.1.7
with:
name: rhino3dm.net nupkg
path: tests/dotnet/lib
- name: test dotnet
run: |
NUGET_FILE="$(find tests/dotnet/lib -type f -name "*.nupkg")"
FILENAME=$(basename ${NUGET_FILE})
NAME=${FILENAME%.*}
VERSION=${NAME:9}
dotnet nuget add source $(pwd)/tests/dotnet/lib
cd tests/dotnet
dotnet add package Rhino3dm -v ${VERSION}
dotnet build
dotnet test
# pack_py:
# name: pack python
# needs: [build_py_manylinux2014, build_py_sdist, build_py_all_bdist]
# runs-on: ubuntu-latest
# steps:
# - name: download python artifacts dist
# uses: elonh/download-artifact-regexp@master
# with:
# pattern: ^.*\.(whl|tar.gz)$ #.*whl(:|$).*
# path: dist
# - name: Display structure of downloaded files
# run: ls -R
# #- name: unzip files
# # run: |
# # mkdir output
# # find dist -type f -print0 | xargs -0 mv -t output
# # cd output
# # ls
# - name: artifacts
# uses: actions/upload-artifact@v4.3.1
# with:
# path: dist
# name: rhino3dm.py all wheels
# build_dotnet_ios:
# name: build dotnet ios
# runs-on: macos-11
# steps:
# - name: setup cmake
# uses: jwlawson/actions-setup-cmake@v1.9
# with:
# cmake-version: '3.21.1'
# - name: setup xcode
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '12.5'
# - name: info
# run: python3 --version && cmake --version
# - name: checkout
# uses: actions/checkout@v2
# - name: update submodules
# run: git submodule update --init
# #- name: setup-xamarin
# # uses: maxim-lobanov/setup-xamarin@v1
# # with:
# # mono-version: '6.12'
# # xamarin-ios-version: '14.14.2.5'
# - name: bootstrap
# run: python3 script/bootstrap.py -p ios
# - name: setup
# run: python3 script/setup.py -p ios -v
# - name: build dotnet ios
# run: python3 script/build.py -p ios -v
# - name: pack dotnet ios
# run: nuget pack src/dotnet/Rhino3dm.iOS.nuspec
# - name: artifacts nupkg
# uses: actions/upload-artifact@v2
# with:
# path: Rhino3dm.iOS.*.nupkg #src/build/ios/dotnet/Rhino3dm.iOS.dll
# name: rhino3dm.net ios nupkg
# - name: artifacts
# uses: actions/upload-artifact@v2
# with:
# path: src/build/ios/dotnet/Rhino3dm.iOS.dll
# name: rhino3dm.net ios
# build_dotnet_android:
# name: build dotnet android
# runs-on: macos-11
# steps:
# - name: set up python
# uses: actions/setup-python@v5.0.0
# with:
# python-version: 3.7.1
# - name: setup cmake
# uses: jwlawson/actions-setup-cmake@v1.9
# with:
# cmake-version: '3.21.1'
# - name: setup xcode
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '12.5'
# - name: setup-xamarin
# uses: maxim-lobanov/setup-xamarin@v1
# with:
# mono-version: '6.12' # specify version in '<major>.<minor>' format
# xamarin-android-version: '11.3.0.4' # specify full version; it is not recomended option because your pipeline can be broken suddenly in future
# - name: setup android ndk
# uses: maxim-lobanov/setup-android-tools@v1
# with:
# packages: ndk;21.0.6113669
# cache: true
# - name: info
# run: python3 --version && cmake --version
# - name: checkout
# uses: actions/checkout@v2
# - name: update submodules
# run: git submodule update --init
# - name: bootstrap
# run: python3 script/bootstrap.py -p android
# - name: setup
# run: python3 script/setup.py -p android -v
# - name: build dotnet android
# run: python3 script/build.py -p android -v
# - name: pack dotnet android
# run: nuget pack src/dotnet/Rhino3dm.Android.nuspec
# - name: artifacts nupkg
# uses: actions/upload-artifact@v2
# with:
# path: Rhino3dm.Android.*.nupkg #src/build/android/dotnet/Rhino3dm.Android.dll
# name: rhino3dm.net android nupkg
# - name: artifacts
# uses: actions/upload-artifact@v2
# with:
# path: src/build/android/dotnet/Rhino3dm.Android.dll
# name: rhino3dm.net android