Skip to content

Commit c6be49a

Browse files
committed
ios specific cmake
1 parent 4cf8fa8 commit c6be49a

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

.github/workflows/cmake-ios.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Release Build CI - iOS Only
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
iOS:
7+
runs-on: macos-latest
8+
steps:
9+
- name: Get branch name
10+
id: branch-name
11+
uses: tj-actions/branch-names@v6
12+
13+
- name: Install GitHub CLI
14+
run: |
15+
brew install gh
16+
17+
- name: Authenticate GitHub CLI
18+
run: |
19+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
20+
21+
- name: Define Release Tag
22+
id: release-tag
23+
run: echo "RELEASE_TAG=iOS-develop-Release" >> $GITHUB_ENV
24+
25+
- name: Download Prebuilt Boost from Thirdparty
26+
shell: bash
27+
run: |
28+
gh release download \
29+
--repo GeniusVentures/thirdparty \
30+
iOS-develop-Release \
31+
--pattern Boost-lib.tar.gz
32+
33+
- name: Ensure Directory Exists
34+
run: |
35+
mkdir -p ${{github.workspace}}/thirdparty/build/iOS/Release
36+
37+
- name: Extract Prebuilt Boost
38+
run: |
39+
tar -xzvf Boost-lib.tar.gz -C ${{github.workspace}}/thirdparty/build/iOS/Release
40+
41+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
42+
- uses: actions/checkout@v3
43+
with:
44+
path: 'zkLLVM'
45+
submodules: "recursive"
46+
47+
- name: Install Ninja
48+
run: |
49+
brew install ccache ninja
50+
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
51+
52+
- name: Add iOS toolchain
53+
run: |
54+
rustup toolchain install nightly-aarch64-apple-darwin
55+
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
56+
rustup target add aarch64-apple-ios
57+
58+
- name: Create Build Directory
59+
run: cmake -E make_directory ${{github.workspace}}/zkLLVM/build/iOS/Release
60+
61+
- name: Configure CMake
62+
working-directory: ${{github.workspace}}/zkLLVM/build/iOS/Release
63+
run: cmake -S .. -DCMAKE_BUILD_TYPE=Release -DPLATFORM=OS64 -DTHIRDPARTY_DIR=${{github.workspace}}/thirdparty/
64+
65+
- name: Compile
66+
working-directory: ${{github.workspace}}/zkLLVM/build/iOS/Release
67+
run: cmake --build . -j --config Release
68+
69+
- name: Install
70+
working-directory: ${{github.workspace}}/zkLLVM/build/iOS/Release
71+
run: cmake --install .
72+
73+
- name: Compressing Build Artifacts
74+
working-directory: ${{github.workspace}}/zkLLVM
75+
if: ${{ github.event_name == 'workflow_dispatch' }}
76+
run: |
77+
shopt -s extglob
78+
rm -rf !(build) .[!.]* ..?*
79+
cd build
80+
rm -rf !(iOS) .[!.]* ..?*
81+
cd iOS
82+
rm -rf !(Release) .[!.]* ..?*
83+
cd Release
84+
rm -rf !(zkLLVM) .[!.]* ..?*
85+
cd ${{github.workspace}}
86+
tar --exclude='zkLLVM/build/iOS/Release/zkLLVM/src' \
87+
--exclude='zkLLVM/build/iOS/Release/zkLLVM/tmp' \
88+
--exclude='zkLLVM/build/iOS/Release/zkLLVM/Applications' \
89+
-czvf zkLLVM.tar.gz zkLLVM/
90+
91+
- name: Validate Artifact Size
92+
run: |
93+
if [ $(stat -c%s "zkLLVM.tar.gz") -ge $((2 * 1024 * 1024 * 1024)) ]; then
94+
echo "Artifact exceeds 2GB limit! Exiting."
95+
exit 1
96+
fi
97+
98+
- name: Set Release Variables
99+
id: vars
100+
if: ${{ github.event_name == 'workflow_dispatch' }}
101+
run: |
102+
OS_NAME=iOS
103+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
104+
BUILD_TYPE=Release
105+
FILE_NAME="${OS_NAME}-${BRANCH_NAME}-${BUILD_TYPE}.tar.gz"
106+
echo "RELEASE_TAG=${OS_NAME}-${BRANCH_NAME}-${BUILD_TYPE}-${GITHUB_SHA::7}" >> $GITHUB_ENV
107+
echo "RELEASE_NAME=${OS_NAME} ${BRANCH_NAME} ${BUILD_TYPE} (${GITHUB_SHA::7})" >> $GITHUB_ENV
108+
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
109+
110+
- name: Rename Artifact
111+
if: ${{ github.event_name == 'workflow_dispatch' }}
112+
run: mv zkLLVM.tar.gz ${{ env.FILE_NAME }}
113+
114+
- name: Create GitHub Release
115+
if: ${{ github.event_name == 'workflow_dispatch' }}
116+
id: create_release
117+
uses: actions/create-release@v1
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GNUS_TOKEN_1 }}
120+
with:
121+
tag_name: ${{ env.RELEASE_TAG }}
122+
release_name: ${{ env.RELEASE_NAME }}
123+
draft: false
124+
prerelease: false
125+
126+
- name: Upload Release Asset
127+
if: ${{ github.event_name == 'workflow_dispatch' }}
128+
uses: actions/upload-release-asset@v1
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GNUS_TOKEN_1 }}
131+
with:
132+
upload_url: ${{ steps.create_release.outputs.upload_url }}
133+
asset_path: ${{ env.FILE_NAME }}
134+
asset_name: ${{ env.FILE_NAME }}
135+
asset_content_type: application/gzip
136+

0 commit comments

Comments
 (0)