Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Add build CI for macos #18

Add build CI for macos

Add build CI for macos #18

Workflow file for this run

name: Build
on:
push:
branches:
- main
- cibuild
jobs:
build-android:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: install requirements
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: curl xz-utils build-essential cmake m4 nasm
version: 1.0
- name: Cache gmp build
uses: actions/cache@v3
with:
path: |
depends/gmp
gmp-6.2.1.tar.xz
key: ${{ runner.os }}-gmp-${{ hashFiles('build_gmp.sh') }}
- name: build gmp android arm64
run: if [[ ! -d "depends/gmp/package_android_arm64" ]]; then ./build_gmp.sh android; fi
- name: build gmp android x86_64
run: if [[ ! -d "depends/gmp/package_android_x86_64" ]]; then ./build_gmp.sh android_x86_64; fi
- name: Build prover Android ARM64
run: |
pwd
mkdir build_prover_android && cd build_prover_android
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android
make -j4 && make install
- name: Build prover Android x86_64
run: |
pwd
mkdir build_prover_android_x86_64 && cd build_prover_android_x86_64
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_x86_64
make -j4 && make install
- name: upload Android ARM64 artifacts
uses: actions/upload-artifact@v3
with:
name: Android_ARM64
path: |
package_android
if-no-files-found: error
- name: upload Android x86_64 artifacts
uses: actions/upload-artifact@v3
with:
name: Android_x86_64
path: |
package_android_x86_64
if-no-files-found: error
build-ios:
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Cache gmp build
uses: actions/cache@v3
with:
path: |
depends/gmp
gmp-6.2.1.tar.xz
key: ${{ runner.os }}-gmp-${{ hashFiles('build_gmp.sh') }}
- name: build
run: |
if [[ ! -d "depends/gmp/package_ios_arm64" ]]; then ./build_gmp.sh ios; fi
if [[ ! -d "depends/gmp/package_iphone_simulator" ]]; then ./build_gmp.sh ios_simulator; fi
if [[ ! -d "depends/gmp/package_macos" ]]; then ./build_gmp.sh macos; fi
mkdir build_prover_ios && cd build_prover_ios
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj -configuration Release
cp ../depends/gmp/package_ios_arm64/lib/libgmp.a src/Release-iphoneos
cd ../
mkdir build_prover_ios_simulator && cd build_prover_ios_simulator
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios_simulator -DUSE_ASM=NO
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj
cp ../depends/gmp/package_iphone_simulator/lib/libgmp.a src/Debug-iphonesimulator
cd ../
mkdir build_prover_macos_arm64 && cd build_prover_macos_arm64
cmake .. -GXcode -DTARGET_PLATFORM=macos_arm64 -DCMAKE_INSTALL_PREFIX=../package_macos_arm64
xcodebuild -project rapidsnark.xcodeproj -scheme rapidsnarkStatic -configuration Release -arch arm64 -arch arm64e
cd ../
mkdir build_prover_macos_x86_64 && cd build_prover_macos_x86_64
cmake .. -GXcode -DTARGET_PLATFORM=macos_x86_64 -DCMAKE_INSTALL_PREFIX=../package_macos_x86_64
xcodebuild -project rapidsnark.xcodeproj -scheme rapidsnarkStatic -configuration Release -arch x86_64
cd ../
mkdir -p package_macos/lib package_macos/include
cp src/prover.h ./depends/gmp/package_macos/include/gmp.h ./package_macos/include/
cp depends/gmp/package_macos/lib/libgmp.a ./package_macos/lib/
lipo ./build_prover_macos_x86_64/src/Release/libfq.a ./build_prover_macos_arm64/src/Release/libfq.a -create -output "./package_macos/lib/libfq.a"
lipo ./build_prover_macos_x86_64/src/Release/libfr.a ./build_prover_macos_arm64/src/Release/libfr.a -create -output "./package_macos/lib/libfr.a"
lipo ./build_prover_macos_x86_64/src/Release/librapidsnark.a ./build_prover_macos_arm64/src/Release/librapidsnark.a -create -output "./package_macos/lib/librapidsnark.a"
- name: upload iOS artifacts
uses: actions/upload-artifact@v3
with:
name: iOS
path: |
build_prover_ios/src/Release-iphoneos
if-no-files-found: error
- name: upload iOS Simulator artifacts
uses: actions/upload-artifact@v3
with:
name: iOS Simulator
path: |
build_prover_ios_simulator/src/Debug-iphonesimulator
if-no-files-found: error
- name: upload macOS artifacts
uses: actions/upload-artifact@v3
with:
name: macOS
path: |
package_macos
if-no-files-found: error