Skip to content

Commit 3ea6c4d

Browse files
authored
Linux ARM64 artifact build (#25)
* Add dylibs for iOS and iOS Simulator builds * Add Linux ARM64 build * Add Linux x86_64 without assembly optimizations build
1 parent 5b06dc0 commit 3ea6c4d

File tree

4 files changed

+116
-17
lines changed

4 files changed

+116
-17
lines changed

.github/images/Dockerfile.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt-get -y update && \
4+
apt-get -y install build-essential cmake m4 nasm curl

.github/images/context.build/.gitkeep

Whitespace-only changes.

.github/workflows/build.yml

Lines changed: 108 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010

1111
jobs:
12+
1213
build-linux:
1314
runs-on: ubuntu-22.04
1415
steps:
@@ -22,23 +23,52 @@ jobs:
2223
packages: build-essential cmake m4 nasm
2324
version: 1.0
2425

26+
- name: Setup QEMU to build ARM64 variant
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Setup buildx for ARM64 platform
30+
uses: docker/setup-buildx-action@v3
31+
with:
32+
platforms: linux/amd64,linux/arm64
33+
34+
- name: Prepare Docker image builder for ARM64
35+
uses: docker/build-push-action@v6
36+
env:
37+
DOCKER_BUILD_SUMMARY: false
38+
DOCKER_BUILD_RECORD_UPLOAD: false
39+
with:
40+
push: false
41+
outputs: type=docker
42+
platforms: linux/arm64
43+
file: .github/images/Dockerfile.build
44+
context: ./.github/images/context.build
45+
cache-from: type=gha,scope=buildkit-arm64
46+
cache-to: type=gha,mode=max,scope=buildkit-arm64
47+
tags: builder:arm64
48+
2549
- name: Cache gmp build
2650
uses: actions/cache@v4
2751
with:
2852
path: |
2953
depends/gmp
3054
depends/gmp-6.2.1.tar.xz
31-
key: ${{ runner.os }}-gmp-${{ hashFiles('build_gmp.sh') }}-2
55+
key: ${{ runner.os }}-gmp-${{ hashFiles('build_gmp.sh') }}-4
3256

33-
- name: build gmp for Android arm64
57+
- name: Build gmp for Android arm64
3458
run: if [[ ! -d "depends/gmp/package_android_arm64" ]]; then ./build_gmp.sh android; fi
3559

36-
- name: build gmp for Android x86_64
60+
- name: Build gmp for Android x86_64
3761
run: if [[ ! -d "depends/gmp/package_android_x86_64" ]]; then ./build_gmp.sh android_x86_64; fi
3862

39-
- name: build gmp for Linux x86_64
63+
- name: Build gmp for Linux x86_64
4064
run: if [[ ! -d "depends/gmp/package" ]]; then ./build_gmp.sh host; fi
4165

66+
- name: Build gmp for Linux arm64
67+
run: |
68+
if [[ ! -d "depends/gmp/package_aarch64" ]]; then
69+
docker run --rm --platform=linux/arm64 -i -v $PWD:/work --workdir=/work builder:arm64 ./build_gmp.sh aarch64
70+
fi
71+
4272
- name: Build prover Android ARM64
4373
run: |
4474
mkdir -p build_prover_android && cd build_prover_android
@@ -63,14 +93,33 @@ jobs:
6393
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp_x86_64 -DBUILD_TESTS=OFF -DUSE_OPENMP=ON
6494
make -j4 && make install
6595
66-
- name: Build prover Linux
96+
- name: Build prover Linux x86_64
6797
run: |
6898
mkdir -p build_prover && cd build_prover
6999
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
70100
make -j4 && make install
71101
ctest --rerun-failed --output-on-failure
72102
73-
- name: test rapidsnark
103+
- name: Build prover Linux x86_64 noasm
104+
run: |
105+
mkdir -p build_prover_noasm && cd build_prover_noasm
106+
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_noasm -DUSE_ASM=NO
107+
make -j4 && make install
108+
ctest --rerun-failed --output-on-failure
109+
110+
- name: Build prover Linux arm64
111+
run: |
112+
docker run --rm --platform=linux/arm64 -i -v $PWD:/work --workdir=/work builder:arm64 bash -c "$(cat << 'EOF'
113+
set -x
114+
set -e
115+
mkdir -p build_prover_arm64 && cd build_prover_arm64
116+
cmake .. -DTARGET_PLATFORM=aarch64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_arm64
117+
make -j4 && make install
118+
ctest --rerun-failed --output-on-failure
119+
EOF
120+
)"
121+
122+
- name: Test rapidsnark
74123
run: |
75124
set -x
76125
set -e
@@ -84,16 +133,34 @@ jobs:
84133
set -e
85134
[ $exit_code -ne 0 ]
86135
87-
- name: upload Linux amd64 dev artifacts
136+
- name: Upload Linux x86_64 dev artifacts
88137
if: github.event_name != 'release'
89138
uses: actions/upload-artifact@v4
90139
with:
91-
name: rapidsnark-linux-amd64
140+
name: rapidsnark-linux-x86_64
92141
path: |
93142
package
94143
if-no-files-found: error
95144

96-
- name: upload Android dev artifacts
145+
- name: Upload Linux x86_64 noasm dev artifacts
146+
if: github.event_name != 'release'
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: rapidsnark-linux-x86_64-noasm
150+
path: |
151+
package_noasm
152+
if-no-files-found: error
153+
154+
- name: Upload Linux arm64 dev artifacts
155+
if: github.event_name != 'release'
156+
uses: actions/upload-artifact@v4
157+
with:
158+
name: rapidsnark-linux-arm64
159+
path: |
160+
package_arm64
161+
if-no-files-found: error
162+
163+
- name: Upload Android dev artifacts
97164
if: github.event_name != 'release'
98165
uses: actions/upload-artifact@v4
99166
with:
@@ -102,7 +169,7 @@ jobs:
102169
package_android
103170
if-no-files-found: error
104171

105-
- name: upload Android dev artifacts
172+
- name: Upload Android dev artifacts
106173
if: github.event_name != 'release'
107174
uses: actions/upload-artifact@v4
108175
with:
@@ -111,7 +178,7 @@ jobs:
111178
package_android_openmp
112179
if-no-files-found: error
113180

114-
- name: upload Android x86_64 dev artifacts
181+
- name: Upload Android x86_64 dev artifacts
115182
if: github.event_name != 'release'
116183
uses: actions/upload-artifact@v4
117184
with:
@@ -120,7 +187,7 @@ jobs:
120187
package_android_x86_64
121188
if-no-files-found: error
122189

123-
- name: upload Android x86_64 dev artifacts (with OpenMP)
190+
- name: Upload Android x86_64 dev artifacts (with OpenMP)
124191
if: github.event_name != 'release'
125192
uses: actions/upload-artifact@v4
126193
with:
@@ -129,7 +196,7 @@ jobs:
129196
package_android_openmp_x86_64
130197
if-no-files-found: error
131198

132-
- name: upload Android ARM64 release artifacts
199+
- name: Upload Android ARM64 release artifacts
133200
if: github.event_name == 'release'
134201
env:
135202
GH_TOKEN: ${{ github.token }}
@@ -140,7 +207,7 @@ jobs:
140207
zip -r rapidsnark-android-arm64-${{ github.ref_name }}.zip rapidsnark-android-arm64-${{ github.ref_name }}
141208
gh release upload ${{ github.event.release.tag_name }} rapidsnark-android-arm64-${{ github.ref_name }}.zip
142209
143-
- name: upload Android x86_64 release artifacts
210+
- name: Upload Android x86_64 release artifacts
144211
if: github.event_name == 'release'
145212
env:
146213
GH_TOKEN: ${{ github.token }}
@@ -151,7 +218,7 @@ jobs:
151218
zip -r rapidsnark-android-x86_64-${{ github.ref_name }}.zip rapidsnark-android-x86_64-${{ github.ref_name }}
152219
gh release upload ${{ github.event.release.tag_name }} rapidsnark-android-x86_64-${{ github.ref_name }}.zip
153220
154-
- name: upload Linux x86_64 release artifacts
221+
- name: Upload Linux x86_64 release artifacts
155222
if: github.event_name == 'release'
156223
env:
157224
GH_TOKEN: ${{ github.token }}
@@ -162,8 +229,30 @@ jobs:
162229
zip -r rapidsnark-linux-x86_64-${{ github.ref_name }}.zip rapidsnark-linux-x86_64-${{ github.ref_name }}
163230
gh release upload ${{ github.event.release.tag_name }} rapidsnark-linux-x86_64-${{ github.ref_name }}.zip
164231
232+
- name: Upload Linux x86_64 noasm release artifacts
233+
if: github.event_name == 'release'
234+
env:
235+
GH_TOKEN: ${{ github.token }}
236+
run: |
237+
set -x
238+
mkdir -p rapidsnark-linux-x86_64-noasm-${{ github.ref_name }}
239+
cp -r package_noasm/* rapidsnark-linux-x86_64-noasm-${{ github.ref_name }}/
240+
zip -r rapidsnark-linux-x86_64-noasm-${{ github.ref_name }}.zip rapidsnark-linux-x86_64-noasm-${{ github.ref_name }}
241+
gh release upload ${{ github.event.release.tag_name }} rapidsnark-linux-x86_64-noasm-${{ github.ref_name }}.zip
242+
243+
- name: Upload Linux ARM64 release artifacts
244+
if: github.event_name == 'release'
245+
env:
246+
GH_TOKEN: ${{ github.token }}
247+
run: |
248+
set -x
249+
mkdir -p rapidsnark-linux-arm64-${{ github.ref_name }}
250+
cp -r package_arm64/* rapidsnark-linux-arm64-${{ github.ref_name }}/
251+
zip -r rapidsnark-linux-arm64-${{ github.ref_name }}.zip rapidsnark-linux-arm64-${{ github.ref_name }}
252+
gh release upload ${{ github.event.release.tag_name }} rapidsnark-linux-arm64-${{ github.ref_name }}.zip
253+
165254
build-apple-arm64:
166-
runs-on: macos-13-xlarge
255+
runs-on: macos-14
167256
steps:
168257
- uses: actions/checkout@v4
169258
with:
@@ -186,12 +275,14 @@ jobs:
186275
mkdir -p build_prover_ios && cd build_prover_ios
187276
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios -DBUILD_TESTS=OFF
188277
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj -configuration Release
278+
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnark -project rapidsnark.xcodeproj -configuration Release CODE_SIGNING_ALLOWED=NO
189279
cp ../depends/gmp/package_ios_arm64/lib/libgmp.a src/Release-iphoneos
190280
cd ../
191281
192282
mkdir -p build_prover_ios_simulator && cd build_prover_ios_simulator
193-
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios_simulator -DUSE_ASM=NO -DBUILD_TESTS=OFF
283+
cmake .. -GXcode -DTARGET_PLATFORM=IOS_SIMULATOR -DCMAKE_INSTALL_PREFIX=../package_ios_simulator -DUSE_ASM=NO -DBUILD_TESTS=OFF
194284
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj
285+
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnark -project rapidsnark.xcodeproj CODE_SIGNING_ALLOWED=NO ARCHS=arm64
195286
cp ../depends/gmp/package_iphone_simulator/lib/libgmp.a src/Debug-iphonesimulator
196287
cd ../
197288

cmake/platform.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ elseif(TARGET_PLATFORM MATCHES "ios")
4040
set(CMAKE_OSX_ARCHITECTURES x86_64)
4141
set(GMP_PREFIX ${GMP_ROOT}/package_ios_x86_64)
4242
set(ARCH x86_64)
43+
elseif(TARGET_PLATFORM MATCHES "ios_simulator")
44+
set(CMAKE_OSX_ARCHITECTURES arm64)
45+
set(GMP_PREFIX ${GMP_ROOT}/package_iphone_simulator_arm64)
46+
set(ARCH x86_64)
4347
else()
4448
set(CMAKE_OSX_ARCHITECTURES arm64)
4549
set(GMP_PREFIX ${GMP_ROOT}/package_ios_arm64)

0 commit comments

Comments
 (0)