-
-
Notifications
You must be signed in to change notification settings - Fork 126
215 lines (180 loc) · 5.85 KB
/
build-mobile.yml
File metadata and controls
215 lines (180 loc) · 5.85 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
SCCACHE_GHA_ENABLED: 'true'
ANDROID_NDK_VERSION: r24
ANDROID_TARGET_SDK_VERSION: 24
permissions:
contents: read
jobs:
build-android:
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-22.04, target_arch: arm }
- { os: ubuntu-22.04, target_arch: arm64 }
- { os: ubuntu-22.04, target_arch: x86_64 }
runs-on: ${{ matrix.config.os }}
env:
TARGET_ARCH: ${{ matrix.config.target_arch }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Install build utils
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ env.ANDROID_NDK_VERSION }}
add-to-path: false
- name: Build
env:
MY_ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
LDFLAGS: '-Wl,-z,max-page-size=16384'
run: |
./tools/android_build.sh $MY_ANDROID_NDK_HOME $ANDROID_TARGET_SDK_VERSION $TARGET_ARCH
rm -rf ./out_android/libnode
- uses: actions/upload-artifact@v4
with:
name: node-android-${{ env.TARGET_ARCH }}
path: out_android
build-ios:
strategy:
fail-fast: false
matrix:
config:
- { os: macos-13, target_arch: arm64, xcode: 15.2 }
- { os: macos-14, target_arch: arm64-simulator, xcode: 15.4 }
- { os: macos-13, target_arch: x64-simulator, xcode: 15.2 }
runs-on: ${{ matrix.config.os }}
env:
TARGET_ARCH: ${{ matrix.config.target_arch }}
XCODE_VERSION: ${{ matrix.config.xcode }}
steps:
- name: Free Disk Space
run: |
sudo rm -rf /Library/Frameworks/Mono.framework
sudo rm -rf /Library/Frameworks/Xamarin.iOS.framework
sudo rm -rf /Library/Frameworks/Xamarin.Android.framework
sudo rm -rf /Users/runner/Library/Android
sudo rm -rf /usr/local/share/powershell
sudo find /Applications -type d -name "Xcode_*.app" ! -name "Xcode_$XCODE_VERSION.app" -prune -exec rm -rf "{}" \;
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Xcode Select Version
uses: mobiledevops/xcode-select-version-action@v1
with:
xcode-select-version: ${{ matrix.config.xcode }}
# Python 3.12 (chosen by configure.py) doesn't have support for distutils
# https://github.com/nodejs/node-gyp/issues/2869 workaround
- name: Build
run: |
python3.12 -m venv .
source bin/activate
python3.12 -m pip install setuptools
./tools/ios_framework_prepare.sh $TARGET_ARCH
- uses: actions/upload-artifact@v4
with:
name: node-ios-${{ env.TARGET_ARCH }}
path: out_ios_${{ env.TARGET_ARCH }}
combine-android:
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-22.04 }
runs-on: ${{ matrix.config.os }}
needs: build-android
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install build utils
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.ANDROID_NDK_VERSION }}
- uses: actions/download-artifact@v4
with:
pattern: node-android-*
merge-multiple: true
path: out_android
- run: rm -rf out_android/libnode
- name: Generate config.gypi
run: ./configure
- name: Combine
run: |
mkdir -p artifacts/bin
mkdir -p artifacts/include
cp -R out_android/* artifacts/bin
./tools/copy_libnode_headers.sh android
cp -R out_android/libnode/include/* artifacts/include
- uses: actions/upload-artifact@v4
with:
name: nodejs-mobile-android
path: artifacts
- uses: geekyeggo/delete-artifact@v5
with:
name: node-android-*
combine-ios:
strategy:
matrix:
config:
- { os: macos-14, xcode: 15.4 }
runs-on: ${{ matrix.config.os }}
needs: build-ios
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Xcode Select Version
uses: mobiledevops/xcode-select-version-action@v1
with:
xcode-select-version: ${{ matrix.config.xcode }}
- uses: actions/download-artifact@v4
with:
pattern: node-ios-*
merge-multiple: true
path: out_ios
# Python 3.12 (chosen by configure.py) doesn't have support for distutils
# https://github.com/nodejs/node-gyp/issues/2869 workaround
- name: Generate config.gypi
run: |
python3.12 -m venv .
source bin/activate
python3.12 -m pip install setuptools
./configure
- name: Combine
run: |
python3.12 -m venv .
source bin/activate
python3.12 -m pip install setuptools
./tools/ios_framework_prepare.sh combine_frameworks
mkdir -p artifacts/include
cp -R out_ios/NodeMobile.xcframework artifacts/
./tools/copy_libnode_headers.sh ios
cp -R out_ios/libnode/include/* artifacts/include
- uses: actions/upload-artifact@v4
with:
name: nodejs-mobile-ios
path: artifacts
- uses: geekyeggo/delete-artifact@v5
with:
name: node-ios-*