Skip to content

Commit 4dea83d

Browse files
committed
move the build steps into scripts
1 parent 4290d67 commit 4dea83d

4 files changed

Lines changed: 28 additions & 133 deletions

File tree

.github/workflows/manifold.yml

Lines changed: 4 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -13,118 +13,6 @@ on:
1313
branches: [ master, main ]
1414

1515
jobs:
16-
build_linux:
17-
timeout-minutes: 45
18-
strategy:
19-
matrix:
20-
cuda_support: [OFF]
21-
parallel_backend: [NONE]
22-
runs-on: ubuntu-latest
23-
if: github.event.pull_request.draft == false || startsWith(github.ref, 'refs/tags/')
24-
outputs:
25-
java_package_version_changed: ${{ steps.check_version.outputs.changed }}
26-
container:
27-
image: docker://nvidia/cuda:12.0.1-devel-ubuntu22.04
28-
steps:
29-
- name: Install dependencies
30-
run: |
31-
apt-get -y update
32-
DEBIAN_FRONTEND=noninteractive apt install -y libomp-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip lcov
33-
pip install trimesh
34-
- uses: actions/checkout@v3
35-
with:
36-
submodules: recursive
37-
fetch-depth: 2
38-
- uses: jwlawson/actions-setup-cmake@v1.12
39-
- name: Setup Java
40-
uses: actions/setup-java@v2
41-
with:
42-
java-version: '21'
43-
distribution: 'adopt'
44-
- name: Install Maven
45-
run: |
46-
apt-get update
47-
apt-get install -y maven
48-
- name: Cache Maven packages
49-
uses: actions/cache@v3
50-
with:
51-
path: ~/.m2
52-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
53-
restore-keys: ${{ runner.os }}-m2
54-
- name: Build ${{matrix.backend}}
55-
run: |
56-
mkdir build
57-
cd build
58-
cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_ENABLE=ON -DBUILD_SHARED_LIBS=ON -DMANIFOLD_DEBUG=ON -DMANIFOLD_EXPORT=ON -DMANIFOLD_PAR=${{matrix.parallel_backend}} -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. && make
59-
- name: Get version
60-
id: get_version
61-
run: echo "VERSION=$(cat bindings/java/version.txt)" >> $GITHUB_ENV
62-
shell: bash
63-
- name: Check if version has changed
64-
id: check_version
65-
shell: bash
66-
run: |
67-
if git diff --quiet HEAD~1 -- bindings/java/version.txt
68-
then
69-
echo "Version Unchanged!"
70-
echo "changed=false" >> "$GITHUB_OUTPUT"
71-
else
72-
echo "Version Changed!"
73-
echo "changed=true" >> "$GITHUB_OUTPUT"
74-
fi
75-
- name: Build Java package
76-
shell: bash
77-
run: |
78-
cd bindings/java
79-
80-
BACKEND=""
81-
if [ "${{matrix.parallel_backend}}" = "NONE" ] && [ "${{matrix.cuda_support}}" = "ON" ]; then
82-
BACKEND="-cuda"
83-
elif [ "${{matrix.parallel_backend}}" = "NONE" ] && [ "${{matrix.cuda_support}}" = "OFF" ]; then
84-
BACKEND=""
85-
elif [ "${{matrix.cuda_support}}" = "ON" ]; then
86-
BACKEND="-${{matrix.parallel_backend}}-cuda"
87-
else
88-
BACKEND="-${{matrix.parallel_backend}}"
89-
fi
90-
91-
mvn versions:set -DnewVersion=$(cat version.txt) --file pom.xml
92-
mvn package -Dos.classifier=linux$BACKEND-x86_64
93-
find ./target/classes/ -name "*.class" -delete
94-
# - name: Test ${{matrix.parallel_backend}} with CUDA ${{matrix.cuda_support}}
95-
# # note that the test for CUDA backend does not really test CUDA, as we
96-
# # don't have CUDA GPU on GitHub Action
97-
# if: matrix.parallel_backend != 'NONE' || matrix.cuda_support != 'OFF'
98-
# run: |
99-
# export PYTHONPATH=$PYTHONPATH:$(pwd)/build/bindings/python
100-
# cd build/test
101-
# ./manifold_test
102-
#- name: Coverage Report
103-
# # only do code coverage for default sequential backend, it seems that TBB
104-
# # backend will cause failure
105-
# # perhaps issue related to invalid memory access?
106-
# if: matrix.parallel_backend == 'NONE' && matrix.cuda_support == 'OFF'
107-
# run: |
108-
# cd build
109-
# 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
110-
# lcov --capture --initial --directory . --output-file ./code_coverage_init.info
111-
# cd bin
112-
# ./manifold_test
113-
# cd ../
114-
# lcov --capture --directory . --output-file ./code_coverage_test.info
115-
# lcov --add-tracefile ./code_coverage_init.info --add-tracefile ./code_coverage_test.info --output-file ./code_coverage_total.info
116-
# lcov --remove ./code_coverage_total.info '/usr/*' '*/third_party/*' '*/test/*' '*/extras/*' '*/bindings/*' --output-file ./code_coverage.info
117-
- uses: codecov/codecov-action@v2
118-
with:
119-
files: build/code_coverage.info
120-
fail_ci_if_error: false
121-
name: ${{matrix.parallel_backend}}-${{matrix.cuda_support}}
122-
- name: Upload artifact
123-
uses: actions/upload-artifact@v4 # updated from v3
124-
with:
125-
name: manifold_java_bindings_linux_${{env.VERSION}}
126-
path: bindings/java/target/classes/
127-
12816
build_mac:
12917
timeout-minutes: 30
13018
strategy:
@@ -145,13 +33,8 @@ jobs:
14533
run: |
14634
python3 -m venv .venv
14735
brew install pkg-config assimp
148-
# pip install trimesh
149-
# - name: Install Java and Maven
150-
# run: |
151-
# brew install openjdk@21
152-
# export PATH="/usr/local/opt/openjdk@21/bin:$PATH"
153-
# brew install --ignore-dependencies maven
154-
# echo "JAVA_HOME=$(/usr/libexec/java_home -v 21)" >> $GITHUB_ENV
36+
- name: Install TBB
37+
run: brew install tbb
15538
- name: Install Java and Maven
15639
run: |
15740
brew install openjdk@21
@@ -168,9 +51,7 @@ jobs:
16851
- uses: jwlawson/actions-setup-cmake@v1.12
16952
- name: Build
17053
run: |
171-
mkdir build
172-
cd build
173-
cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_ENABLE=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. && make
54+
bash ./scripts/buildC.sh
17455
shell: bash
17556
- name: Find Libs
17657
run: |
@@ -239,10 +120,7 @@ jobs:
239120
restore-keys: ${{ runner.os }}-m2
240121
- name: Build C code
241122
run: |
242-
mkdir build
243-
cd build
244-
cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_ENABLE=ON -DBUILD_SHARED_LIBS=ON -DMANIFOLD_DEBUG=ON -DMANIFOLD_EXPORT=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. && make
245-
cd ..
123+
bash ./scripts/buildC.sh
246124
- name: Get version
247125
id: get_version
248126
run: echo "VERSION=$(cat bindings/java/version.txt)" >> $GITHUB_ENV

scripts/buildC.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
VERSION=$(cat ./bindings/java/version.txt)
4+
#rm -rf build
5+
mkdir build
6+
cd build
7+
set -e
8+
cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_ENABLE=ON -DBUILD_SHARED_LIBS=ON -DMANIFOLD_DEBUG=ON -DMANIFOLD_EXPORT=ON -DMANIFOLD_PAR=ON -DMANIFOLD_USE_BUILTIN_TBB=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
9+
make
10+
cd ..

scripts/clojar.sh

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ VERSION=$(cat ./bindings/java/version.txt)
1414
linux_jar_file=./bindings/java/target/manifold3d-$VERSION.jar
1515
mv ./bindings/java/target/manifold3d-*-linux-x86_64.jar $linux_jar_file
1616
ls -la $linux_jar_file # verify it exists before deploying
17+
set -e
1718
mvn deploy:deploy-file \
1819
-DpomFile=bindings/java/pom.xml \
1920
-DrepositoryId=clojars \

scripts/makeJars.sh

100644100755
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#!/bin/bash
22

3-
export JAVA_HOME=$HOME/bin/java21/
3+
echo "Java Home set to: "$JAVA_HOME
4+
printenv JAVA_HOME
5+
6+
missing_vars=()
7+
[[ -z "${JAVA_HOME}" ]] && missing_vars+=("JAVA_HOME")
8+
9+
if [[ ${#missing_vars[@]} -gt 0 ]]; then
10+
echo "Error: The following required environment variables are not set: ${missing_vars[*]}"
11+
exit 1
12+
fi
13+
414
VERSION=$(cat ./bindings/java/version.txt)
5-
#rm -rf build
6-
mkdir build
7-
cd build
8-
cmake -DCMAKE_BUILD_TYPE=Release -DASSIMP_ENABLE=ON -DBUILD_SHARED_LIBS=ON -DMANIFOLD_DEBUG=ON -DMANIFOLD_EXPORT=ON -DMANIFOLD_PAR=NONE -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .. && make
9-
cd ..
10-
cd bindings/java
1115

16+
cd bindings/java
17+
set -e
1218
mvn versions:set -DnewVersion=$(cat version.txt) --file pom.xml
1319
mvn package -Dos.classifier=linux-x86_64

0 commit comments

Comments
 (0)