forked from MeshInspector/MeshLib
-
Notifications
You must be signed in to change notification settings - Fork 0
707 lines (613 loc) · 25.8 KB
/
pip-build.yml
File metadata and controls
707 lines (613 loc) · 25.8 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
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
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
name: Build Pip Wheels
# When ran from the github UI, we build the target commit exactly.
# When ran on release, we use the latest tagged commit in the `master` branch.
# This doesn't run directly on pull request, because it's impossible to disable the whole file
# with a single condition (specific label present). Because of that, we conditionally run this from a separate `.yml` file.
on:
release:
types: [ published ]
# This is the manual run from the UI.
workflow_dispatch:
inputs:
vcpkg_docker_image_tag:
# Empty string means the same thing as "latest", but we use an empty string here to ensure this works,
# because `types: [published]` can't have any inputs, so there we are forced to use an empty string, so it needs to work.
default: ""
required: false
type: string
publish:
default: false
required: false
type: boolean
# This is the `uses:` call from other `.yml` files.
workflow_call:
inputs:
vcpkg_docker_image_tag:
required: true
type: string
publish:
default: false
required: false
type: boolean
env:
VCPKG-VERSION: '2025.04.09'
CUDA-VERSION: '12.0.1.52833'
CUDA-MAJOR: '12'
CUDA-MINOR: '0'
jobs:
setup:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
version_tag: ${{ steps.get-latest-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v5
# Disabling this with an `if:` results in `steps.get-latest-tag.outputs.tag` being empty.
# Passing that to `ref:` makes it default to the current commit, which is exactly what we need.
- uses: actions-ecosystem/action-get-latest-tag@v1
if: ${{ github.event_name == 'release' || inputs.publish }}
id: get-latest-tag
manylinux-pip-build:
needs: setup
timeout-minutes: 80
runs-on: ${{ matrix.runner }}
container:
image: meshlib/meshlib-${{matrix.os}}:${{inputs.vcpkg_docker_image_tag || 'latest'}}
options: ${{ matrix.container-options }}
strategy:
fail-fast: false
matrix:
platform: ["x86_64", "aarch64"]
include:
- platform: "x86_64"
os: rockylinux8-vcpkg-x64
container-options: "--user root"
runner: ubuntu-latest
compiler: /usr/bin/clang++
- platform: "aarch64"
os: rockylinux8-vcpkg-arm64
container-options: " " # empty
runner: [ self-hosted, linux-arm64, on-demand, meshinspector ]
compiler: /usr/bin/clang++
steps:
- name: Work-around possible permission issues
shell: bash
run: |
# NOTE: {GITHUB_WORKSPACE} != {{ github.workspace }}
# Related issue: https://github.com/actions/runner/issues/2058
if test -d $GITHUB_WORKSPACE && test -n "$(find ${GITHUB_WORKSPACE} -user root)" ; then
mv ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}_${RANDOM}
mkdir ${GITHUB_WORKSPACE}
fi
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{needs.setup.outputs.version_tag}}
- name: Checkout third-party submodules
# Some of those safe.directory rules could be redudant.
run: |
# have to checkout selective submodules by our own
# related issue: https://github.com/actions/checkout/issues/1779
export HOME=${RUNNER_TEMP}
echo ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/imgui
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/parallel-hashmap
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/mrbind-pybind11
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/mrbind
git submodule update --init --recursive --depth 1 thirdparty/imgui thirdparty/parallel-hashmap thirdparty/mrbind-pybind11 thirdparty/mrbind
- name: Install mrbind
# Also print the amount of RAM. If there's not enough RAM, building MRBind bindings can fail. Not doing it in that step, because OOM fails can erase logs from the current step.
run: |
./scripts/mrbind/install_mrbind_rockylinux.sh
free -h
- name: Build
run: ./scripts/build_source.sh
env:
MESHLIB_BUILD_RELEASE: "ON"
MESHLIB_BUILD_DEBUG: "OFF"
CMAKE_CXX_COMPILER: ${{ matrix.compiler }}
MR_CMAKE_OPTIONS: >
-DMRVIEWER_NO_GTK=ON
-DMR_PCH_USE_EXTRA_HEADERS=ON
-DCMAKE_CUDA_HOST_COMPILER=/opt/rh/gcc-toolset-11/root/usr/bin/g++
- name: Generate and build MRBind bindings
run: |
make -f scripts/mrbind/generate.mk -B --trace \
FOR_WHEEL=1 \
CXX_FOR_ABI=${{ matrix.compiler }} \
CXX_FOR_BINDINGS=${{ matrix.compiler }} \
DEPS_BASE_DIR=${VCPKG_ROOT}/installed/${VCPKG_TRIPLET}
# install helper utility for Python version management
- name: Install uv
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6
- name: Build Python shim libs
run: |
PYTHON_VERSIONS=$(cat scripts/mrbind-pybind11/python_versions.txt | xargs)
GET_SYSCONFIG_VAR=${PWD}/scripts/wheel/get_sysconfig_var.py
for PYTHON_VER in ${PYTHON_VERSIONS} ; do
export PKG_CONFIG_PATH=$(uv run --python ${PYTHON_VER} ${GET_SYSCONFIG_VAR} LIBPC)
make shims -f scripts/mrbind/generate.mk -B --trace \
FOR_WHEEL=1 \
CXX_FOR_ABI=${{ matrix.compiler }} \
CXX_FOR_BINDINGS=${{ matrix.compiler }} \
DEPS_BASE_DIR=${VCPKG_ROOT}/installed/${VCPKG_TRIPLET} \
PYTHON_VERSIONS=${PYTHON_VER}
done
- name: Run Tests
run: MR_LOCAL_RESOURCES=1 xvfb-run -a ./build/Release/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd
- name: Unit Tests
run: build/Release/bin/MRTest
- name: Python Tests
run: |
PYTHON_VERSIONS=$(cat scripts/mrbind-pybind11/python_versions.txt | xargs)
REQUIREMENTS_FILE=${PWD}/requirements/python.txt
GET_SYSCONFIG_VAR=${PWD}/scripts/wheel/get_sysconfig_var.py
cd build/Release/bin
for PYTHON_VER in ${PYTHON_VERSIONS} ; do
PYTHON_LIB_DIR=$(uv run --python ${PYTHON_VER} ${GET_SYSCONFIG_VAR} LIBDIR)
LD_LIBRARY_PATH=${PYTHON_LIB_DIR} \
uv run \
--python ${PYTHON_VER} \
--with-requirements ${REQUIREMENTS_FILE} \
--with pytest \
python3 ./../../../scripts/run_python_test_script.py -d '../test_python'
done
- name: Create and fix Wheel
run: |
python3.12 -m venv ./wheel_venv
source ./wheel_venv/bin/activate
python3.12 -m pip install patchelf
python3.12 ./scripts/wheel/build_wheel.py --version ${{needs.setup.outputs.version_tag || '0'}}
- name: Upload Python Stubs
if: ${{ (github.event_name == 'release' || inputs.publish) && matrix.platform == 'aarch64' }}
uses: actions/upload-artifact@v4
with:
name: PythonStubs
path: ./scripts/wheel/meshlib/meshlib/*.pyi
retention-days: 1
- name: Generate C bindings
if: ${{ (github.event_name == 'release' || inputs.publish) && matrix.platform == 'aarch64' }}
env:
CXX: /usr/bin/clang++
run: make -f scripts/mrbind/generate.mk TARGET=c -B --trace
- name: Upload C bindings headers
if: ${{ (github.event_name == 'release' || inputs.publish) && matrix.platform == 'aarch64' }}
uses: actions/upload-artifact@v4
with:
name: CBindings
path: ./source/MeshLibC2/include
retention-days: 1
- name: Upload to Test Artifacts
uses: actions/upload-artifact@v4
with:
name: ManyLinux-${{matrix.platform}}
path: ./scripts/wheel/meshlib/wheelhouse/meshlib-*.whl
retention-days: 1
update-documentation:
# always() need to ignore general fail previous job, because this job depends on one matrix variant (aarch64 && py-version == 3.10),
# and if this variant failed this job also will fail
if: ${{ ( github.event_name == 'release' || inputs.publish ) && always() }}
needs:
- manylinux-pip-build
uses: ./.github/workflows/update-docs.yml
with:
output_folder: MeshLib
secrets: inherit
windows-pip-build:
needs: setup
timeout-minutes: 90
runs-on: [windows-2022]
strategy:
fail-fast: false
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
ref: ${{needs.setup.outputs.version_tag}}
- name: Clean Vcpkg Directory
working-directory: C:\vcpkg
run: git clean -ffdx
- name: Checkout Vcpkg ${{env.VCPKG-VERSION}}
working-directory: C:\vcpkg
run: |
git fetch
git pull --rebase
git checkout ${{env.VCPKG-VERSION}}
bootstrap-vcpkg.bat
vcpkg.exe integrate install
- name: Restore Vcpkg Cache
uses: actions/cache@v4
id: vcpkg-cache
with:
key: vcpkg-cache-${{env.VCPKG-VERSION}}
path: |
C:\vcpkg\*
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@8e2d02296bcf12c081e192c60f3cb80d77f4f76a # v4
with:
role-to-assume: arn:aws:iam::259351611210:role/GitHubMeshLibAwsCredsRole
aws-region: us-east-1
- name: Update vcpkg packages
run: |
.\thirdparty\install.bat --write-s3
- name: Vcpkg integrate install
working-directory: C:\vcpkg
run: C:\vcpkg\vcpkg.exe integrate install
- name: Install all Python versions
run: scripts/mrbind-pybind11/install_all_python_versions_windows.bat
- name: Restore CUDA Cache
uses: actions/cache@v4
id: cuda-cache
with:
key: cuda-${{env.CUDA-VERSION}}
path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA*
- name: Install CUDA
if: steps.cuda-cache.outputs.cache-hit != 'true'
run: choco install cuda --version=${{env.CUDA-VERSION}} --confirm
- name: Setup CUDA
run: |
"CUDA_PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${{ env.CUDA-MAJOR }}.${{ env.CUDA-MINOR }}" >> $env:GITHUB_ENV
"CUDA_PATH_V${{ env.CUDA-MAJOR }}_${{ env.CUDA-MINOR }}=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${{ env.CUDA-MAJOR }}.${{ env.CUDA-MINOR }}" >> $env:GITHUB_ENV
"CUDA_PATH_VX_Y=CUDA_PATH_V${{ env.CUDA-MAJOR }}_${{ env.CUDA-MINOR }}" >> $env:GITHUB_ENV
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${{ env.CUDA-MAJOR }}.${{ env.CUDA-MINOR }}\\bin" >> $env:GITHUB_PATH
- name: Install Visual Studio Integration
run: |
$x = (dir $env:CUDA_PATH -dir -recurse -depth 2).where({$_.name -eq 'visual_studio_integration'}).fullname
$y = (dir $x -dir -recurse).where({$_.name -eq 'MSBuildExtensions'}).fullname + '\*'
(gi 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\*\BuildCustomizations').fullname.foreach({cp $y $_})
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
- name: Build
run: msbuild -m source\MeshLib.sln -p:Configuration=Release
# Install MSYS2 using their github action instead of ours `install_deps_windows_msys2.bat`. Locally users should use that bat file.
# I'm expecting the official action to be better suited for CI needs (e.g. they promise some form of caching in the readme), but I didn't perform a proper comparison.
- name: Install MSYS2 for MRBind
uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2
with:
msystem: clang64
install: make gawk procps-ng mingw-w64-clang-x86_64-cmake
location: C:\msys64_meshlib_mrbind
- name: Install Clang in MSYS2
shell: msys2 {0}
run: |
./scripts/mrbind/msys2_install_clang_ver.sh $(cat scripts/mrbind/clang_version_msys2.txt)
- name: Build MRBind
shell: cmd
env:
# Need this env variable because our .bat files assume msys2 installed directly to `C:\msys64_meshlib_mrbind`,
# and the setup-msys2 action always adds the `...\msys64` component at the end, and it's a tiny bit wasteful to move it around when running in the CI.
MSYS2_DIR: C:\msys64_meshlib_mrbind\msys64
run: call ./scripts/mrbind/install_mrbind_windows_msys2.bat
- name: Generate and build MRBind bindings
shell: cmd
env:
MSYS2_DIR: C:\msys64_meshlib_mrbind\msys64
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64
call ./scripts/mrbind/generate_win.bat -B --trace FOR_WHEEL=1
- name: Run Test
working-directory: source\x64\Release
run: .\MeshViewer.exe -tryHidden -noEventLoop
- name: Unit Tests
run: source\x64\Release\MRTest.exe
- name: Python Tests
working-directory: source\x64\Release
run: py ..\..\..\scripts\run_python_test_script.py -multi-cmd
- name: Create and fix Wheel
run: |
py -3.11 -m venv venv
venv\Scripts\Activate
python -m pip install --upgrade pip
python .\scripts\wheel\build_wheel.py --plat-name=win-amd64 --version ${{needs.setup.outputs.version_tag || '0'}}
- name: Upload to Test Artifacts
uses: actions/upload-artifact@v4
with:
name: Windows
path: wheelhouse\meshlib-*.whl
retention-days: 1
macos-pip-build:
needs: setup
timeout-minutes: 80
runs-on: ${{ matrix.instance }}
strategy:
fail-fast: false
matrix:
platform: ["x86", "arm64"]
include:
- platform: "x86"
# On 12.0 x86 `brew` doesn't have binary packages for Clang.
plat-name: macosx_13_0_x86_64
instance: macos-13
brewpath: /usr/local
- platform: "arm64"
plat-name: macosx_12_0_arm64
instance: [ self-hosted, macos-12, arm64, build ]
brewpath: /opt/homebrew
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
ref: ${{needs.setup.outputs.version_tag}}
- name: Python setup
env:
ENABLE_SUDO: ${{ fromJSON('["1", "0"]')[matrix.platform == 'arm64'] }}
run: |
scripts/mrbind-pybind11/install_all_python_versions_macos.sh
- name: Create virtualenv
run: |
# Remove from PATH anything with the word `anaconda` in it.
# Even if Anaconda's Python works, it's probably a good idea to avoid it for consistency (because without this line only one specific Python version gets taken from Anaconda.)
export PATH="$(echo "$PATH" | perl -pe 's/[^:]*anaconda[^:]*//g;s/::|^:|:$//g')"
python3 -m venv .venv
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Install thirdparty libs
run: |
./scripts/build_thirdparty.sh
./scripts/mrbind/install_deps_macos.sh
./scripts/mrbind/install_mrbind_macos.sh
- name: Build
run: ./scripts/build_source.sh
env:
MESHLIB_BUILD_RELEASE: "ON"
MESHLIB_BUILD_DEBUG: "OFF"
CMAKE_CXX_COMPILER: /usr/bin/clang++
MR_CMAKE_OPTIONS: >
-DMRVIEWER_NO_GTK=ON
# not realy needed
CMAKE_C_COMPILER: /usr/bin/clang
- name: Generate and build MRBind bindings
env:
PATH: ${{matrix.brewpath}}/opt/make/libexec/gnubin:${{matrix.brewpath}}/opt/grep/libexec/gnubin:${{env.PATH}}
# `MACOS_MIN_VER` picked arbitrarily to match what Apple Clang uses when building MeshLib.
# Not setting this or setting a different value cases a warning when linking the bindings, and you can get the correct (?) value from those warnings.
run: |
make --version
make -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 MACOS_MIN_VER=12.7
- name: Unit Tests
run: build/Release/bin/MRTest
- name: Python Tests
working-directory: ./build/Release/bin
run: python3 ./../../../scripts/run_python_test_script.py -multi-cmd -create-venv
- name: Create and fix Wheel
run: |
python3 ./scripts/wheel/build_wheel.py --plat-name=${{matrix.plat-name}} --version ${{needs.setup.outputs.version_tag || '0'}}
- name: Upload to Test Artifacts
uses: actions/upload-artifact@v4
with:
name: Macos-${{matrix.platform}}
path: meshlib-*.whl
retention-days: 1
manylinux-pip-test:
needs: [manylinux-pip-build]
timeout-minutes: 20
runs-on: ${{ matrix.runner }}
container:
image: ${{matrix.container-prefix}}${{matrix.os}}
options: ${{ matrix.container-options }}
strategy:
fail-fast: false
matrix:
platform: ["x86_64", "aarch64"]
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- platform: "x86_64"
runner: ubuntu-latest
container-options: "--user root"
container-prefix: " "
- platform: "aarch64"
runner: [ self-hosted, linux-arm64, on-demand, meshinspector ]
container-options: " " # empty
container-prefix: "arm64v8/"
- py-version: "3.8"
os: "rockylinux:8"
- py-version: "3.9"
os: "debian:11-slim"
- py-version: "3.10"
os: "ubuntu:22.04"
- py-version: "3.11"
os: "fedora:37"
- py-version: "3.12"
os: "fedora:39"
- py-version: "3.13"
os: "fedora:42"
env:
PYTHON_CMD: python${{ matrix.py-version }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{needs.setup.outputs.version_tag}}
- name: Rocky Linux system setup
if: ${{ matrix.os == 'rockylinux:8' }}
run: dnf -y install python38-pip
- name: Debian/Ubuntu system setup
if: ${{ matrix.os == 'debian:11-slim' || matrix.os == 'ubuntu:22.04' }}
run: apt -y update && apt -y install curl libssl-dev python3-pip
- name: Fedora system setup
if: ${{ matrix.os == 'fedora:37' || matrix.os == 'fedora:39' || matrix.os == 'fedora:42' }}
run: dnf -y install python3-pip
- name: Pip setup
run: |
${{ env.PYTHON_CMD }} -m pip install --upgrade pip
${{ env.PYTHON_CMD }} -m pip uninstall -y meshlib
${{ env.PYTHON_CMD }} -m pip install --upgrade -r ./requirements/python.txt
${{ env.PYTHON_CMD }} -m pip install pytest
- name: Download Meshlib wheel from Artifact
uses: actions/download-artifact@v5
with:
name: ManyLinux-${{matrix.platform}}
merge-multiple: true
- name: Meshlib wheel install
run: ${{ env.PYTHON_CMD }} -m pip install ${{ matrix.pip-options }} ./meshlib-*.whl
- name: Run Python tests
working-directory: test_python
run: ${{ env.PYTHON_CMD }} -m pytest -s -v
windows-pip-test:
needs: [windows-pip-build]
timeout-minutes: 20
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{needs.setup.outputs.version_tag}}
- name: Download Meshlib wheel from Artifact
uses: actions/download-artifact@v5
with:
name: Windows
merge-multiple: true
- name: Python setup
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.py-version }}
- name: Setup pip
run: |
py -${{matrix.py-version}} -m pip install --upgrade pip
py -${{matrix.py-version}} -m pip uninstall -y meshlib
py -${{matrix.py-version}} -m pip install --upgrade -r ./requirements/python.txt
py -${{matrix.py-version}} -m pip install pytest
- name: Install Meshlib wheel
shell: pwsh
run: $wheel_file=Get-ChildItem -Filter meshlib*win*.whl; py -${{matrix.py-version}} -m pip install $wheel_file
- name: Run Python tests
working-directory: test_python
run: py -${{matrix.py-version}} -m pytest -s -v
macos-pip-test:
needs: [macos-pip-build]
timeout-minutes: 20
runs-on: ${{ matrix.instance }}
strategy:
fail-fast: false
matrix:
platform: ["arm64", "x86"]
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
exclude: # python 3.8 disabled on x86 macOS since 2024-10-14
- platform: "x86"
py-version: "3.8"
include:
- platform: "x86"
# On 12.0 x86 `brew` doesn't have binary packages for Clang.
plat-name: macosx_13_0_x86_64
instance: macos-13
- platform: "arm64"
plat-name: macosx_12_0_arm64
instance: [ self-hosted, macos-12, arm64, build ]
- py-version: "3.8"
py-cmd: "python3.8"
- py-version: "3.9"
py-cmd: "python3.9"
- py-version: "3.10"
py-cmd: "python3.10"
- py-version: "3.11"
py-cmd: "python3.11"
- py-version: "3.12"
py-cmd: "python3.12"
- py-version: "3.13"
py-cmd: "python3.13"
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{needs.setup.outputs.version_tag}}
- name: Python setup
if: ${{ !(matrix.platform == 'x86' && ( matrix.py-version == '3.11' || matrix.py-version == '3.12' || matrix.py-version == '3.13' ) ) }}
run: brew install python@${{matrix.py-version}}
- name: Create virtualenv
run: |
# Remove from PATH anything with the word `anaconda` in it.
# Even if Anaconda's Python works, it's probably a good idea to avoid it for consistency (because without this line only one specific Python version gets taken from Anaconda.)
export PATH="$(echo "$PATH" | perl -pe 's/[^:]*anaconda[^:]*//g;s/::|^:|:$//g')"
${{ matrix.py-cmd }} -m venv .venv
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
pip install pytest
- name: Pip setup
run: |
${{ matrix.py-cmd }} -m pip install --upgrade pip
${{ matrix.py-cmd }} -m pip uninstall -y meshlib
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt
${{ matrix.py-cmd }} -m pip install pytest
- name: Download Meshlib wheel from Artifact
uses: actions/download-artifact@v5
with:
name: Macos-${{matrix.platform}}
merge-multiple: true
- name: Meshlib wheel install
run: ${{ matrix.py-cmd }} -m pip install ${{ matrix.pip-options }} ./meshlib-*${{matrix.platform}}*.whl
- name: Run Python tests
working-directory: test_python
run: ${{ matrix.py-cmd }} -m pytest -s -v
upload-to-release:
if: ${{ github.event_name == 'release' || inputs.publish }}
needs: [manylinux-pip-test, windows-pip-test, macos-pip-test]
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Download Wheels Artifacts
uses: actions/download-artifact@v5
with:
pattern: ManyLinux-*
merge-multiple: true
- name: Download Wheels Artifacts
uses: actions/download-artifact@v5
with:
pattern: Windows
merge-multiple: true
- name: Download Wheels Artifacts
uses: actions/download-artifact@v5
with:
pattern: Macos-*
merge-multiple: true
- name: Install twine
run: python3 -m pip install --upgrade pip twine packaging
- name: Upload to Production PyPi
run: twine upload ./meshlib-*.whl -u __token__ -p ${{ secrets.PYPI_MESHINSPECTOR_TOKEN }} --skip-existing
post-release-test:
if: ${{ github.event_name == 'release' || inputs.publish }}
needs: upload-to-release
uses: MeshInspector/MeshLib/.github/workflows/release-tests.yml@master
delete-artifacts:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: upload-to-release
if: always()
steps:
- name: Delete all ManyLinux
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
with:
name: ManyLinux-*
failOnError: false
- name: Delete Python Stubs
if: ${{ github.event_name == 'release' || inputs.publish }}
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
with:
name: PythonStubs
failOnError: false
- name: Delete C bindings headers
if: ${{ github.event_name == 'release' || inputs.publish }}
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
with:
name: CBindings
failOnError: false
- name: Delete all Windows
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
with:
name: Windows
failOnError: false
- name: Delete all Macos
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
with:
name: Macos-*
failOnError: false