forked from tidev/titanium-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
297 lines (250 loc) · 7.86 KB
/
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
name: Build
on:
push:
branches:
- master
- "[0-9]+_[0-9]+_X"
pull_request:
jobs:
android:
# Use Ubuntu 18.04 as later versions do not maintain i386 repositories.
# This is required to run 32-bit mksnapshot binaries for snapshot generation.
runs-on: ubuntu-18.04
name: Android
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
steps:
- uses: actions/checkout@v2
- name: Dependencies including 32-bit support
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -y -qq
sudo apt-get install -y -qq gperf libatomic1:i386 libc6:i386 libncurses5:i386 libstdc++6:i386
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Use JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Node.js modules
id: node-cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-modules-
${{ runner.OS }}-
- run: npm ci
name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: npm run lint:android
name: Lint
- name: Install ccache
run: brew install ccache
- name: Retrieve ccache
uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-
- name: Cache V8
uses: actions/cache@v2
with:
path: dist/android/libv8
key: libv8-${{ hashFiles('dist/android/libv8/**') }}
restore-keys: |
libv8-
- run: npm run build:android
name: Build
- name: Show summary of ccache configuration and statistics counters
run: ccache --show-stats
- name: 'Package build output'
run: >
tar -czvf android-build.tar.gz
android/kroll-apt/build/libs/kroll-apt.jar
android/runtime/v8/generated/
android/titanium/build/outputs/
dist/android/libv8/
dist/android/titanium.bindings.json
dist/tmp/common
- uses: actions/upload-artifact@v2
with:
name: android-build
retention-days: 1
path: android-build.tar.gz
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
ios:
runs-on: macos-11
name: iOS
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Cache Node.js modules
id: node-cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-modules-
${{ runner.OS }}-
- run: npm ci
name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
- run: npm run lint:ios
name: Lint
- run: npm run build:ios
name: Build
- name: 'Package build output'
run: >
tar -czvf ios-build.tar.gz
dist/tmp/common
iphone/TitaniumKit/build/TitaniumKit.xcframework
- uses: actions/upload-artifact@v2
with:
name: ios-build
retention-days: 1
path: ios-build.tar.gz
js:
runs-on: ubuntu-latest
name: JavaScript
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Cache Node.js modules
id: node-cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-modules-
${{ runner.OS }}-
- run: npm ci
name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
- run: npm run lint:js
name: Lint
package:
runs-on: macos-11
name: Package
env:
SDK_BUILD_CACHE_DIR: ${{ github.workspace }}/.native-modules
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
needs: [android, ios, js]
steps:
- uses: actions/checkout@v2
- name: Create version tag
run: |
PACKAGE_VERSION=$(sed -n 's/^ *"version": *"//p' package.json | tr -d '"' | tr -d ',' | tr -d '[[:space:]]')
TIMESTAMP=`date +'%Y%m%d%H%M%S'`
VTAG="${PACKAGE_VERSION}.v${TIMESTAMP}"
echo "vtag=${VTAG}" >> $GITHUB_ENV
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Use JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Node.js modules
id: node-cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-modules-
${{ runner.OS }}-
- run: npm ci
name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/download-artifact@v2
with:
name: android-build
- name: 'Extract Android build output'
run: tar -xzvf android-build.tar.gz
- uses: actions/download-artifact@v2
with:
name: ios-build
- name: 'Extract iOS build output'
run: tar -xzvf ios-build.tar.gz
- name: Cache Native Modules
uses: actions/cache@v2
with:
path: ${{ env.SDK_BUILD_CACHE_DIR }}
key: native-modules-${{ github.sha }}
restore-keys: |
native-modules-
- run: npm run package -- --version-tag ${{ env.vtag }} --all
name: Package
- name: Archive OSX artifact
uses: actions/upload-artifact@v2
with:
name: mobilesdk-${{ env.vtag }}-osx
path: |
dist/mobilesdk-*-osx.zip
- name: Archive win32 artifact
uses: actions/upload-artifact@v2
with:
name: mobilesdk-${{ env.vtag }}-win32
path: |
dist/mobilesdk-*-win32.zip
# - name: Archive Linux artifact
# uses: actions/upload-artifact@v2
# with:
# name: mobilesdk-linux.zip
# path: |
# dist/mobilesdk-*-linux.zip
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- uses: geekyeggo/delete-artifact@v1
with:
name: |
android-build
ios-build