forked from elalish/manifold
-
Notifications
You must be signed in to change notification settings - Fork 1
429 lines (417 loc) · 15.4 KB
/
manifold.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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
build:
timeout-minutes: 45
strategy:
matrix:
cuda_support: [OFF]
parallel_backend: [NONE, TBB]
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
outputs:
java_package_version_changed: ${{ steps.check_version.outputs.changed }}
container:
image: docker://nvidia/cuda:12.0.1-devel-ubuntu22.04
steps:
- name: Install dependencies
run: |
apt-get -y update
DEBIAN_FRONTEND=noninteractive apt install -y libomp-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip lcov
pip install trimesh
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 2
- uses: jwlawson/[email protected]
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Install Maven
run: |
apt-get update
apt-get install -y maven
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build ${{matrix.backend}}
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DMANIFOLD_DEBUG=ON -DMANIFOLD_EXPORT=ON -DMANIFOLD_PAR=${{matrix.parallel_backend}} .. && make
- name: Get version
id: get_version
run: echo "VERSION=$(cat bindings/java/version.txt)" >> $GITHUB_ENV
shell: bash
- name: Check if version has changed
id: check_version
shell: bash
run: |
if git diff --quiet HEAD~1 -- bindings/java/version.txt
then
echo "Version Unchanged!"
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "Version Changed!"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Build Java package
shell: bash
run: |
cd bindings/java
BACKEND=""
if [ "${{matrix.parallel_backend}}" = "NONE" ] && [ "${{matrix.cuda_support}}" = "ON" ]; then
BACKEND="-cuda"
elif [ "${{matrix.parallel_backend}}" = "NONE" ] && [ "${{matrix.cuda_support}}" = "OFF" ]; then
BACKEND=""
elif [ "${{matrix.cuda_support}}" = "ON" ]; then
BACKEND="-${{matrix.parallel_backend}}-cuda"
else
BACKEND="-${{matrix.parallel_backend}}"
fi
mvn versions:set -DnewVersion=$(cat version.txt) --file pom.xml
mvn package -Dos.classifier=linux$BACKEND-x86_64
# - name: Test ${{matrix.parallel_backend}} with CUDA ${{matrix.cuda_support}}
# # note that the test for CUDA backend does not really test CUDA, as we
# # don't have CUDA GPU on GitHub Action
# if: matrix.parallel_backend != 'NONE' || matrix.cuda_support != 'OFF'
# run: |
# export PYTHONPATH=$PYTHONPATH:$(pwd)/build/bindings/python
# cd build/test
# ./manifold_test
#- name: Coverage Report
# # only do code coverage for default sequential backend, it seems that TBB
# # backend will cause failure
# # perhaps issue related to invalid memory access?
# if: matrix.parallel_backend == 'NONE' && matrix.cuda_support == 'OFF'
# run: |
# cd build
# cmake -DOUTPUT_TO_BIN=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DMANIFOLD_PAR=${{matrix.parallel_backend}} -DMANIFOLD_USE_CUDA=${{matrix.cuda_support}} -DCODE_COVERAGE=ON .. && make
# lcov --capture --initial --directory . --output-file ./code_coverage_init.info
# cd bin
# ./manifold_test
# cd ../
# lcov --capture --directory . --output-file ./code_coverage_test.info
# lcov --add-tracefile ./code_coverage_init.info --add-tracefile ./code_coverage_test.info --output-file ./code_coverage_total.info
# lcov --remove ./code_coverage_total.info '/usr/*' '*/third_party/*' '*/test/*' '*/extras/*' '*/bindings/*' --output-file ./code_coverage.info
- uses: codecov/codecov-action@v2
with:
files: build/code_coverage.info
fail_ci_if_error: false
name: ${{matrix.parallel_backend}}-${{matrix.cuda_support}}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: manifold_java_bindings_linux_${{matrix.parallel_backend}}_${{matrix.cuda_support}}_${{env.VERSION}}
path: bindings/java/target/*.jar
# build_cbind:
# timeout-minutes: 30
# runs-on: ubuntu-22.04
# if: github.event.pull_request.draft == false
# container:
# image: docker://nvidia/cuda:12.0.1-devel-ubuntu22.04
# steps:
# - name: Install dependencies
# run: |
# apt-get -y update
# DEBIAN_FRONTEND=noninteractive apt install -y libomp-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# - uses: jwlawson/[email protected]
# - name: Build C bindings with TBB and CUDA
# run: |
# mkdir build
# cd build
# cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DMANIFOLD_DEBUG=ON -DMANIFOLD_CBIND=ON -DMANIFOLD_PAR=TBB -DMANIFOLD_USE_CUDA=ON .. && make
# - name: Test ${{matrix.parallel_backend}} with CUDA ${{matrix.cuda_support}}
# # note that the test for CUDA backend does not really test CUDA, as we
# # don't have CUDA GPU on GitHub Action
# run: |
# cd build/test
# ./manifold_test --gtest_filter=CBIND.*
# build_wasm:
# timeout-minutes: 30
# runs-on: ubuntu-22.04
# if: github.event.pull_request.draft == false
# steps:
# - name: Install dependencies
# run: |
# sudo apt-get -y update
# DEBIAN_FRONTEND=noninteractive sudo apt install -y nodejs
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# - name: Setup WASM
# run: |
# # setup emscripten
# git clone https://github.com/emscripten-core/emsdk.git
# cd emsdk
# ./emsdk install latest
# ./emsdk activate latest
# - uses: jwlawson/[email protected]
# - name: Build WASM
# run: |
# source ./emsdk/emsdk_env.sh
# mkdir build
# cd build
# emcmake cmake -DCMAKE_BUILD_TYPE=Release .. && emmake make
# - name: Test WASM
# run: |
# cd build/test
# node ./manifold_test.js
# - name: Test examples
# run: |
# cd bindings/wasm/examples
# npm ci
# npm run build
# npm test
# - name: Upload WASM files
# uses: actions/upload-artifact@v3
# with:
# name: wasm
# path: bindings/wasm/examples/dist/
# retention-days: 90
# build_windows:
# timeout-minutes: 30
# strategy:
# matrix:
# parallel_backend: [NONE]
# cuda_support: [OFF]
# max-parallel: 1
# runs-on: windows-2019
# if: github.event.pull_request.draft == false
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# fetch-depth: 2
# - uses: jwlawson/[email protected]
# - uses: ilammy/msvc-dev-cmd@v1
# - uses: actions/setup-java@v2
# with:
# java-version: '11'
# distribution: 'adopt'
# - name: Install Maven
# run: choco install maven
# - name: Install CUDA
# if: matrix.backend == 'CUDA'
# env:
# cuda: "11.3.0"
# shell: powershell
# run: |
# Invoke-RestMethod https://raw.githubusercontent.com/ptheywood/cuda-cmake-github-actions/21811d232fc775fa8d44dddf7f8c5ce2cf8d2b81/scripts/actions/install_cuda_windows.ps1 -OutFile install_cuda_windows.ps1
# .\install_cuda_windows.ps1
# - name: nvcc check
# if: matrix.backend == 'CUDA'
# shell: powershell
# run: |
# nvcc -V
# ls $env:CUDA_PATH
# ls $env:CUDA_PATH\bin
# ls $env:CUDA_PATH\include
# - name: Install Assimp from source
# shell: bash
# run: |
# git clone https://github.com/assimp/assimp.git
# cd assimp
# git checkout v5.2.5
# cmake CMakeLists.txt -DASSIMP_BUILD_ZLIB=ON -DCMAKE_BUILD_TYPE=Release
# cmake --build . --config Release
# cmake --install . --config Release
# echo "C:/Program Files (x86)/Assimp/bin/" >> $GITHUB_PATH
# - name: Add Assimp to PATH
# shell: powershell
# run: |
# Add-Content $env:GITHUB_PATH "C:/Program Files (x86)/Assimp/bin/"
# - name: Build ${{matrix.backend}}
# shell: powershell
# run: |
# cmake . -DOUTPUT_TO_BIN=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DMANIFOLD_EXPORT=ON -DCMAKE_BUILD_TYPE=Release -B build -DMANIFOLD_DEBUG=ON -DPYBIND11_FINDPYTHON=OFF -DMANIFOLD_PAR=${{matrix.parallel_backend}} -DMANIFOLD_USE_CUDA=${{matrix.cuda_support}} -A x64
# cd build
# cmake --build . --target ALL_BUILD --config Release
# - name: List DLL dependencies
# shell: powershell
# run: |
# echo "List DLL dependencies"
# $currentDir = Get-Location
# $binPath = Join-Path -Path $currentDir -ChildPath "build/bin"
# Add-Content $env:GITHUB_PATH $binPath
# - name: Build Java package
# run: |
# cd bindings/java
# mvn versions:set -DnewVersion="$(cat version.txt)" --file pom.xml
# mvn package
# #- name: Test ${{matrix.parallel_backend}} with CUDA ${{matrix.cuda_support}}
# # shell: bash
# # run: |
# # cd build/bin
# # ./Release/manifold_test.exe
# - name: Upload Java artifacts
# uses: actions/upload-artifact@v2
# with:
# name: manifold_java_bindings_windows
# path: bindings/java/target/*.jar
build_mac:
timeout-minutes: 30
strategy:
matrix:
parallel_backend: [NONE, TBB]
runs-on: macos-14
if: github.event.pull_request.draft == false
steps:
- name: Install Python 3.12
run: |
brew update
brew install [email protected]
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- name: Configure Python 3.12 Environment
run: |
echo "PATH=$(brew --prefix [email protected])/bin:/opt/homebrew/opt/[email protected]/libexec/bin:$PATH" >> $GITHUB_ENV
- name: Install common dependencies
run: |
python3 -m venv .venv
brew install pkg-config assimp
# pip install trimesh
- name: Install TBB
if: matrix.parallel_backend == 'TBB'
run: brew install tbb
- name: Install Java and Maven
run: |
brew install openjdk@17
export PATH="/usr/local/opt/openjdk@17/bin:$PATH"
brew install --ignore-dependencies maven
echo "JAVA_HOME=$(/usr/libexec/java_home -v 17)" >> $GITHUB_ENV
- name: Check Java version
run: java -version
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 2
- uses: jwlawson/[email protected]
- name: Build
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DMANIFOLD_EXPORT=ON -DMANIFOLD_PAR=${{matrix.parallel_backend}} .. && make
shell: bash
- name: Find Libs
run: |
find . -name "*.dylib"
shell: bash
- name: Build Java package
shell: bash
run: |
export PATH="/usr/local/opt/openjdk@17/bin:$PATH"
cd bindings/java
JAVA_PACKAGE_VERSION=$(cat version.txt)
echo "JAVA_PACKAGE_VERSION=$JAVA_PACKAGE_VERSION" >> $GITHUB_ENV
mvn versions:set -DnewVersion=$JAVA_PACKAGE_VERSION --file pom.xml
mvn package -Dos.classifier=mac-${{matrix.parallel_backend}}-x86_64
# - name: Test
# run: |
# cd build/test
# ./manifold_test
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: manifold_java_bindings_mac_${{matrix.parallel_backend}}_${{env.JAVA_PACKAGE_VERSION}}
path: bindings/java/target/*.jar
- name: Upload Surefire Reports
if: failure() # This step will run only if the previous steps failed
uses: actions/upload-artifact@v3
with:
name: surefire-reports
path: |
/Users/runner/work/manifold/manifold/bindings/java/target/surefire-reports
/Users/runner/work/manifold/manifold/bindings/java/target/*.dump
/Users/runner/work/manifold/manifold/bindings/java/target/*-jvmRun*.dump
/Users/runner/work/manifold/manifold/bindings/java/target/*.dumpstream
# build_nix:
# timeout-minutes: 30
# strategy:
# matrix:
# variant: [none, omp, tbb, none-cuda, omp-cuda, tbb-cuda]
# runs-on: ubuntu-latest
# if: github.event.pull_request.draft == false
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# - uses: cachix/install-nix-action@v15
# - run: nix build -L '.?submodules=1#manifold-${{matrix.variant}}'
deploy_jars:
runs-on: ubuntu-22.04
needs: [build, build_mac]
if: github.event.pull_request.draft == false && ${{needs.build.outputs.java_package_version_changed}} == 'true'
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Install Maven
run: |
sudo apt-get update
sudo apt-get install -y maven
- name: Get version
id: get_version
run: echo "VERSION=$(cat bindings/java/version.txt)" >> $GITHUB_ENV
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: manifold_java_bindings_linux_NONE_OFF_${{env.VERSION}}
path: linux-jar
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: manifold_java_bindings_mac_TBB_${{env.VERSION}}
path: mac-tbb-jar
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: manifold_java_bindings_linux_TBB_OFF_${{env.VERSION}}
path: linux-tbb-jar
- name: Deploy Jars
shell: bash
run: |
VERSION=$(cat bindings/java/version.txt)
linux_jar_file=linux-jar/manifold3d-$VERSION-linux-x86_64.jar
linux_tbb_jar_file=linux-tbb-jar/manifold3d-$VERSION-linux-TBB-x86_64.jar
mac_tbb_jar_file=mac-tbb-jar/manifold3d-$VERSION-mac-TBB-x86_64.jar
mvn versions:set -DnewVersion=$VERSION --file bindings/java/pom.xml
mvn deploy:deploy-file \
-DpomFile=bindings/java/pom.xml \
-DrepositoryId=clojars \
-Durl=https://clojars.org/repo \
-DgroupId=org.clojars.cartesiantheatrics \
-DartifactId=manifold3d \
-Dversion=$VERSION \
-Dpackaging=jar \
-Dfile=$linux_tbb_jar_file \
-Dclassifier=linux-TBB-x86_64 \
-Dfiles=$mac_tbb_jar_file,$linux_jar_file \
-Dclassifiers=mac-TBB-x86_64,linux-x86_64 \
-Dtypes=jar,jar \
--settings=bindings/java/settings.xml
env:
CLOJARS_PASSPHRASE: ${{ secrets.CLOJARS_PASSPHRASE }}
CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }}