-
-
Notifications
You must be signed in to change notification settings - Fork 71
247 lines (207 loc) · 7.73 KB
/
android_node_build.yml
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: Android Node Build
concurrency:
group: android_node_build_${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
env:
JAVET_NODE_VERSION: 22.11.0
JAVET_VERSION: 4.1.0
ROOT: /home/runner/work/Javet
jobs:
build_javet_lib:
strategy:
matrix:
include:
- android_arch: arm
android_abi: armeabi-v7a
i18n_name: non-i18n
cmake_flag:
config_patch:
- android_arch: arm64
android_abi: arm64-v8a
i18n_name: non-i18n
cmake_flag:
config_patch:
- android_arch: x86
android_abi: x86
i18n_name: non-i18n
cmake_flag:
config_patch:
- android_arch: x86_64
android_abi: x86_64
i18n_name: non-i18n
cmake_flag:
config_patch:
- android_arch: arm64
android_abi: arm64-v8a
i18n_name: i18n
cmake_flag: -DENABLE_I18N=1
config_patch: sed -i 's/--with-intl=none/--with-intl=full-icu/g' android_configure.py
- android_arch: x86_64
android_abi: x86_64
i18n_name: i18n
cmake_flag: -DENABLE_I18N=1
config_patch: sed -i 's/--with-intl=none/--with-intl=full-icu/g' android_configure.py
name: Build Javet ${{ matrix.android_arch }} ${{ matrix.i18n_name }}
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup Ubuntu
run: |
sudo apt-get install -y execstack gcc-multilib g++-multilib
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r27
local-cache: false
- name: Setup Path
run: |
echo "${{ env.ROOT }}/google/depot_tools" >> $GITHUB_PATH
- name: Build Node.js
run: |
cd ${{ env.ROOT }}
git clone https://github.com/nodejs/node.git
cd node
git checkout v${{ env.JAVET_NODE_VERSION }}
git apply < ../Javet/scripts/patches/android/node/android_configure.py.patch
git apply < ../Javet/scripts/patches/android/node/common.gypi.patch
git apply < ../Javet/scripts/patches/android/node/configure.py.patch
git apply < ../Javet/scripts/patches/android/node/constants-arm.h.patch
git apply < ../Javet/scripts/patches/android/node/push_registers_asm.cc.patch
git apply < ../Javet/scripts/patches/android/node/trap-handler.h.patch
git apply < ../Javet/scripts/patches/android/node/test_crypto_clienthello.cc.patch
${{ matrix.config_patch }}
./android-configure ${{ steps.setup-ndk.outputs.ndk-path }} 24 ${{ matrix.android_arch }}
make -j4
mv out out.${{ matrix.android_arch }}.${{ matrix.i18n_name }}
- name: Copy the i18n
if: matrix.i18n_name == 'i18n' && matrix.android_arch == 'arm64'
run: |
mkdir icu-node
cp ../node/deps/icu-tmp/*.dat icu-node
- name: Setup JDK 11
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 11
- name: Setup Cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.23.x'
- name: Build Javet JNI
run: |
cd ${{ env.ROOT }}/Javet/cpp
sh ./build-android.sh -DNODE_DIR=${{ env.ROOT }}/node -DCMAKE_ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} -DCMAKE_ANDROID_ARCH=${{ matrix.android_arch }} ${{ matrix.cmake_flag }}
- name: Upload the Artifact
uses: actions/upload-artifact@v4
with:
name: javet-android-node-${{ matrix.android_arch }}-${{ env.JAVET_VERSION }}-${{ matrix.i18n_name }}
path: android/javet-android/src/main/jniLibs/${{ matrix.android_abi }}/*.so
- name: Upload the i18n
uses: actions/upload-artifact@v4
if: matrix.i18n_name == 'i18n' && matrix.android_arch == 'arm64'
with:
name: icu-node
path: icu-node/*.dat
build_javet_aar:
needs: [build_javet_lib]
name: Build Javet AAR
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10.2
- name: Prepare JNI Libs i18n
run: |
mkdir -p android/javet-android/src/main/jniLibs/arm64-v8a
mkdir -p android/javet-android/src/main/jniLibs/x86_64
- name: Prepare JNI Libs non-i18n
run: |
mkdir -p android/javet-android/src/main/jniLibs/armeabi-v7a
mkdir -p android/javet-android/src/main/jniLibs/arm64-v8a
mkdir -p android/javet-android/src/main/jniLibs/x86
mkdir -p android/javet-android/src/main/jniLibs/x86_64
- name: Download Javet arm64 i18n
uses: actions/download-artifact@v4
with:
name: javet-android-node-arm64-${{ env.JAVET_VERSION }}-i18n
path: android/javet-android/src/main/jniLibs/arm64-v8a
- name: Download Javet x86_64 i18n
uses: actions/download-artifact@v4
with:
name: javet-android-node-x86_64-${{ env.JAVET_VERSION }}-i18n
path: android/javet-android/src/main/jniLibs/x86_64
- name: Download Javet arm non-i18n
uses: actions/download-artifact@v4
with:
name: javet-android-node-arm-${{ env.JAVET_VERSION }}-non-i18n
path: android/javet-android/src/main/jniLibs/armeabi-v7a
- name: Download Javet arm64 non-i18n
uses: actions/download-artifact@v4
with:
name: javet-android-node-arm64-${{ env.JAVET_VERSION }}-non-i18n
path: android/javet-android/src/main/jniLibs/arm64-v8a
- name: Download Javet x86 non-i18n
uses: actions/download-artifact@v4
with:
name: javet-android-node-x86-${{ env.JAVET_VERSION }}-non-i18n
path: android/javet-android/src/main/jniLibs/x86
- name: Download Javet x86_64 non-i18n
uses: actions/download-artifact@v4
with:
name: javet-android-node-x86_64-${{ env.JAVET_VERSION }}-non-i18n
path: android/javet-android/src/main/jniLibs/x86_64
- name: Build the Artifact
run: |
cd ${{ env.ROOT }}/Javet/scripts/python
python3 patch_android_build.py
cd ${{ env.ROOT }}/Javet/android
gradle build --debug
- name: Upload the Artifact
uses: actions/upload-artifact@v4
with:
name: javet-android-node-${{ env.JAVET_VERSION }}
path: android/javet-android/build/outputs/aar/javet*release.aar
- name: Delete Javet arm64 i18n
uses: geekyeggo/delete-artifact@v4
with:
name: javet-android-node-arm64-${{ env.JAVET_VERSION }}-i18n
- name: Delete Javet x86_64 i18n
uses: geekyeggo/delete-artifact@v4
with:
name: javet-android-node-x86_64-${{ env.JAVET_VERSION }}-i18n
- name: Delete Javet arm non-i18n
uses: geekyeggo/delete-artifact@v4
with:
name: javet-android-node-arm-${{ env.JAVET_VERSION }}-non-i18n
- name: Delete Javet arm64 non-i18n
uses: geekyeggo/delete-artifact@v4
with:
name: javet-android-node-arm64-${{ env.JAVET_VERSION }}-non-i18n
- name: Delete Javet x86 non-i18n
uses: geekyeggo/delete-artifact@v4
with:
name: javet-android-node-x86-${{ env.JAVET_VERSION }}-non-i18n
- name: Delete Javet x86_64 non-i18n
uses: geekyeggo/delete-artifact@v4
with:
name: javet-android-node-x86_64-${{ env.JAVET_VERSION }}-non-i18n