forked from zingolabs/zingo-mobile
-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (111 loc) · 4.18 KB
/
ios-build.yaml
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
name: Build
on:
workflow_call:
inputs:
cache-key:
required: true
type: string
env:
CACHE-KEY: ${{ inputs.cache-key }}
REPO-OWNER: ${{ github.repository_owner }}
jobs:
ios-check-build-cache:
name: Check build cache
runs-on: macos-13
outputs:
ios-cache-found: ${{ steps.ios-set-cache-found.outputs.ios-cache-found }}
steps:
- name: Set envs for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: echo "REPO-OWNER=zingolabs" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ env.REPO-OWNER }}/zingo-mobile
- name: Check if native rust cache exists
id: ios-check-build-cache
uses: actions/cache/restore@v4
with:
path: rust/lib/Generated
key: native-ios-uniffi-universal-${{ env.CACHE-KEY }}
lookup-only: true
- name: Set cache-found
id: ios-set-cache-found
run: echo "ios-cache-found=${{ steps.ios-check-build-cache.outputs.cache-hit }}" >> $GITHUB_OUTPUT
ios-build:
name: Build native rust & swift uniffi
needs: ios-check-build-cache
if: ${{ needs.ios-check-build-cache.outputs.ios-cache-found != 'true' }}
runs-on: macos-14
env:
RUSTUP_HOME: /root/.rustup
steps:
- name: Set envs for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: echo "REPO-OWNER=zingolabs" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ env.REPO-OWNER }}/zingo-mobile
- name: Cargo update for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: |
echo "zingolib_ref=$(echo ${GITHUB_REF} | sed 's/\//\\\//g')" >> $GITHUB_ENV
sudo sed -i '' "/^zingolib/ s/branch = \"dev\"/rev = \"${{ env.zingolib_ref }}\"/" "rust/lib/Cargo.toml"
if cat rust/lib/Cargo.toml | grep "^zingolib" | grep -q "branch"; then exit 1; fi
cd rust
sudo cargo update -p zingolib --aggressive
- name: Cargo default nightly
run: |
sudo rustup update
sudo rustup upgrade
sudo rustup default nightly
- name: AWS libcrypto rust building
run: sudo cargo install --force --locked bindgen-cli
- name: rustup show
run: sudo rustup show
- name: Cargo uniffi swift
working-directory: rust/lib
run: |
sudo cargo run --release --bin uniffi-bindgen \
generate ./src/zingo.udl --language swift \
--out-dir ./Generated
- name: Install Cargo Lipo
run: sudo cargo install cargo-lipo
- name: Install rust Target
run: sudo rustup target add aarch64-apple-ios-sim x86_64-apple-ios
- name: Cargo lipo universal library
working-directory: rust/lib
run: |
sudo cargo lipo --release --targets aarch64-apple-ios-sim x86_64-apple-ios
- name: Copy libraries to ios folder
working-directory: rust/lib
run: |
sudo cp ../target/universal/release/libzingo.a ./Generated/libuniffi_zingo.a
- name: Upload native rust
uses: actions/upload-artifact@v4
with:
name: native-ios-uniffi-universal-${{ env.CACHE-KEY }}
path: rust/lib/Generated
cache-native-ios-uniffi:
name: Cache native rust
needs: ios-build
runs-on: macos-13
steps:
- name: Set envs for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: echo "REPO-OWNER=zingolabs" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ env.REPO-OWNER }}/zingo-mobile
- name: Download native rust
uses: actions/download-artifact@v4
with:
name: native-ios-uniffi-universal-${{ env.CACHE-KEY }}
path: rust/lib/Generated
- name: Cache native rust
uses: actions/cache/save@v4
with:
path: rust/lib/Generated
key: native-ios-uniffi-universal-${{ env.CACHE-KEY }}