forked from bromite/bromite
-
Notifications
You must be signed in to change notification settings - Fork 83
425 lines (364 loc) · 19.1 KB
/
build_cromite.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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
name: Build Cromite
permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
on:
workflow_dispatch:
inputs:
sha:
description: 'uazo/cromite SHA'
required: true
default: ''
target_os:
description: 'targetos [android/win/linux/all]'
required: true
default: 'all'
build:
description: 'android arch [arm/arm64/x64/all]'
required: true
default: 'all'
type:
description: 'runner? [dev/ci]'
required: true
default: 'ci'
debug:
description: 'debug? [true/false]'
required: true
default: 'false'
clangd:
description: 'clangd? [true/false]'
required: true
default: 'false'
env:
CROMITE_SHA: ${{ github.event.inputs.sha }}
REMOVEDOCKERSUPPORT: true
USELOCALIMAGE: true
jobs:
check_images:
runs-on: ${{ github.event.inputs.type }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
path: cromite
ref: ${{ github.event.inputs.sha }}
fetch-depth: 1
- name: Enable proxy on container
shell: bash
run: |
if ! [[ -z "${HTTP_PROXY}" ]]; then
PROXY_ADDR=http://$(hostname -I | cut -d' ' -f1 | xargs):8118
echo "PROXY_ADDR=$PROXY_ADDR" >> $GITHUB_ENV
sudo iptables -D INPUT -p tcp -s localhost --dport 8118 -j ACCEPT
sudo iptables -D INPUT -p tcp --dport 8118 -j DROP
fi
- name: Get current chromium version
shell: bash
run: |
export VERSION=$( cat ./cromite/build/RELEASE )
echo Current version is $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
cd cromite/tools
- name: Building build-deps container ${{ env.VERSION }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/build-deps:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/build-deps:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/build-deps:$VERSION \
--progress plain \
--build-arg VERSION=$VERSION \
--build-arg HTTP_PROXY="$PROXY_ADDR" \
--no-cache \
cromite/tools/images/build-deps/.
fi
fi
- name: Building chromium container ${{ env.VERSION }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/chromium:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/chromium:$VERSION > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/chromium:$VERSION \
--progress plain \
--build-arg VERSION=$VERSION \
--build-arg HTTP_PROXY="$PROXY_ADDR" \
cromite/tools/images/chr-source/.
fi
fi
- name: Building cromite container ${{ env.VERSION }}-${{ env.CROMITE_SHA }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/cromite:$VERSION-$CROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/cromite:$VERSION-$CROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/cromite:$VERSION-$CROMITE_SHA --progress plain \
--build-arg CROMITE_SHA=$CROMITE_SHA \
--build-arg VERSION=$VERSION \
--build-arg HTTP_PROXY="$PROXY_ADDR" \
cromite/tools/images/cromite-source/.
fi
fi
- name: Building cromite-build container ${{ env.VERSION }}-${{ env.CROMITE_SHA }}
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/cromite-build:$VERSION-$CROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
IS_PRESENT=$(docker manifest inspect uazo/cromite-build:$VERSION-$CROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -ne "0" ]; then
DOCKER_BUILDKIT=1 docker build -t uazo/cromite-build:$VERSION-$CROMITE_SHA --progress plain \
--build-arg CROMITE_SHA=$CROMITE_SHA \
--build-arg VERSION=$VERSION \
--build-arg HTTP_PROXY="$PROXY_ADDR" \
--no-cache \
cromite/tools/images/cromite-build/.
fi
fi
- name: Get uazo/cromite-build from docker hub if present
shell: bash
run: |
IS_PRESENT=$(docker manifest inspect uazo/cromite-build:$VERSION-$CROMITE_SHA > /dev/null ; echo $?)
if [ $IS_PRESENT -eq "0" ]; then
docker pull uazo/cromite-build:$VERSION-$CROMITE_SHA
fi
- name: Mark image to build
shell: bash
run: |
IS_PRESENT=$(docker inspect --type=image uazo/cromite-build:build > /dev/null ; echo $?)
if [ $IS_PRESENT -eq "0" ]; then
docker rmi uazo/cromite-build:build
fi
docker tag uazo/cromite-build:$VERSION-$CROMITE_SHA uazo/cromite-build:build
build:
runs-on: ${{ github.event.inputs.type }}
needs: check_images
if: success()
timeout-minutes: 1440
container:
image: uazo/cromite-build:build
env:
REMOVEDOCKERSUPPORT: true # CUSTOM RUNNER: remove sharing of docker socket
USELOCALIMAGE: true # CUSTOM RUNNER: permit use of local images
USEINTERNALNETWORK: true # CUSTOM RUNNER: create the docker network as internal
WORKSPACE: /home/lg/working_dir
# kythe
KYTHE_CORPUS: chromium.googlesource.com/chromium/src
KYTHE_ROOT_DIRECTORY: /home/lg/working_dir/chromium/src
KYTHE_OUTPUT_DIRECTORY: /home/lg/working_dir/chromium/src/out/arm64/kythe
# cross build
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: /win_sdk/sdks/Win11SDK_10.0.22621.2428/
WINDOWSSDKDIR: "/win_sdk/sdks/Win11SDK_10.0.22621.2428/Windows Kits/10/"
GYP_MSVS_OVERRIDE_PATH: /win_sdk/sdks/Win11SDK_10.0.22621.2428/
# compile in debug mode
TARGET_ISDEBUG: ${{ github.event.inputs.debug }}
TARGET_OS: ${{ github.event.inputs.target_os }}
USE_KEYSTORE: true
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
CROMITE_PREF_HASH_SEED_BIN: ${{ secrets.CROMITE_PREF_HASH_SEED_BIN }}
volumes:
- /storage/images/${{ github.event.inputs.sha }}/android/${{ github.event.inputs.debug }}/arm:/home/lg/working_dir/chromium/src/out/arm
- /storage/images/${{ github.event.inputs.sha }}/android/${{ github.event.inputs.debug }}/arm64:/home/lg/working_dir/chromium/src/out/arm64
- /storage/images/${{ github.event.inputs.sha }}/android/${{ github.event.inputs.debug }}/x64:/home/lg/working_dir/chromium/src/out/x64
- /storage/images/${{ github.event.inputs.sha }}/linux/${{ github.event.inputs.debug }}/lin64:/home/lg/working_dir/chromium/src/out/lin64
- /storage/images/${{ github.event.inputs.sha }}/win/x64:/home/lg/working_dir/chromium/src/out/win64
- /tmp/proxy:/tmp/proxy
- /win_sdk:/win_sdk
steps:
- name: Prepare Build Container
shell: bash
run: |
# set workspace paths
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE
# reset proxy env
HTTP_PROXY=
HTTPS_PROXY=
http_proxy=
https_proxy=
# set out folder permissions
test -d chromium/src/out/arm || sudo mkdir -p chromium/src/out/arm && \
sudo chown lg chromium/src/out &&
sudo chown lg chromium/src/out/arm
test -d chromium/src/out/arm64 || sudo mkdir -p chromium/src/out/arm64 && \
sudo chown lg chromium/src/out &&
sudo chown lg chromium/src/out/arm64
test -d chromium/src/out/win64 || sudo mkdir -p chromium/src/out/win64 && \
sudo chown lg chromium/src/out &&
sudo chown lg chromium/src/out/win64
test -d chromium/src/out/x64 || sudo mkdir -p chromium/src/out/x64 && \
sudo chown lg chromium/src/out &&
sudo chown lg chromium/src/out/x64
test -d chromium/src/out/lin64 || sudo mkdir -p chromium/src/out/lin64 && \
sudo chown lg chromium/src/out &&
sudo chown lg chromium/src/out/lin64
# make kythe output directory
test -d $KYTHE_OUTPUT_DIRECTORY || mkdir -p $KYTHE_OUTPUT_DIRECTORY
sudo mkdir -p /run/user/1000/
sudo chown lg /run/user/1000/
sudo chmod g-rxw /run/user/1000/
sudo chmod o-rxw /run/user/1000/
# prepare keystore
echo "::group::-------- prepare keystore"
cd $WORKSPACE
echo "${{ secrets.KEYSTORE }}" > cromite.keystore.asc
gpg --homedir ./ -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch cromite.keystore.asc > cromite.keystore
echo "::endgroup::"
- name: Build Cromite Android x64
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'x64' || github.event.inputs.build == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- gn gen"
gn gen --args="target_os = \"android\" $(cat /home/lg/working_dir/cromite/build/cromite.gn_args) target_cpu = \"x64\" " out/x64
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/x64/ --list --short
gn args out/x64/ --list >out/x64/gn_list
echo "::endgroup::"
ninja -C out/x64 chrome_public_bundle
ninja -C out/x64 chrome_public_apk
cp ../../cromite/build/RELEASE out/x64
- name: Get ninja logs Android x64
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'x64' || github.event.inputs.build == 'all') }}
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing -a $WORKSPACE/chromium/src/out/x64/.ninja_log >$WORKSPACE/chromium/src/out/x64/ninja_log_trace.json
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/x64/ninja_log_trace.json
- name: Build Cromite Windows x64
if: ${{ github.event.inputs.target_os == 'win' || github.event.inputs.target_os == 'all' }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- gn gen"
gn gen --args="target_os = \"win\" $(cat /home/lg/working_dir/cromite/build/cromite.gn_args) target_cpu = \"x64\" " out/win64
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/win64/ --list --short
gn args out/win64/ --list >out/win64/gn_list
echo "::endgroup::"
ninja -C out/win64 chrome
cp ../../cromite/build/RELEASE out/win64
- name: Get ninja logs Windows x64
if: ${{ github.event.inputs.target_os == 'win' || github.event.inputs.target_os == 'all' }}
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing -a $WORKSPACE/chromium/src/out/win64/.ninja_log >$WORKSPACE/chromium/src/out/win64/ninja_log_trace.json
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/win64/ninja_log_trace.json
- name: Build Cromite Android arm64
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm64' || github.event.inputs.build == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- gn gen"
gn gen --args="target_os = \"android\" $(cat /home/lg/working_dir/cromite/build/cromite.gn_args) target_cpu = \"arm64\" " out/arm64
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/arm64/ --list --short
gn args out/arm64/ --list >out/arm64/gn_list
echo "::endgroup::"
ninja -C out/arm64 chrome_public_bundle
ninja -C out/arm64 chrome_public_apk
cp ../../cromite/build/RELEASE out/arm64
- name: Get ninja logs Android arm64
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm64' || github.event.inputs.build == 'all') }}
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing -a $WORKSPACE/chromium/src/out/arm64/.ninja_log >$WORKSPACE/chromium/src/out/arm64/ninja_log_trace.json
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/arm64/ninja_log_trace.json
- name: Generate breakpad symbols for Android arm64
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm64' || github.event.inputs.build == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- generating breakpad symbols"
ninja -C out/arm64 minidump_stackwalk dump_syms
components/crash/content/tools/generate_breakpad_symbols.py --build-dir=out/arm64 \
--symbols-dir=out/arm64/symbols/ --binary=out/arm64/lib.unstripped/libchrome.so \
--platform=android --clear --verbose
cp out/arm64/lib.unstripped/libchrome.so out/arm64/symbols/libchrome.lib.so
cp out/arm64/minidump_stackwalk out/arm64/symbols
cp out/arm64/dump_syms out/arm64/symbols
echo "::endgroup::"
- name: Generate Supersize data for Android arm64
if: ${{ github.event.inputs.debug == 'false' && (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm64' || github.event.inputs.build == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
tools/binary_size/supersize archive out/arm64/chrome.size --apk-file out/arm64/apks/ChromePublic.apk -v
- name: Build Cromite Android arm
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm' || github.event.inputs.build == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- gn gen"
gn gen --args="target_os = \"android\" $(cat /home/lg/working_dir/cromite/build/cromite.gn_args) target_cpu = \"arm\" " out/arm
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/arm/ --list --short
gn args out/arm/ --list >out/arm/gn_list
echo "::endgroup::"
ninja -C out/arm chrome_public_bundle
ninja -C out/arm chrome_public_apk
cp ../../cromite/build/RELEASE out/arm
- name: Get ninja logs Android arm
if: ${{ (github.event.inputs.target_os == 'android' || github.event.inputs.target_os == 'all') && (github.event.inputs.build == 'arm' || github.event.inputs.build == 'all') }}
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing -a $WORKSPACE/chromium/src/out/arm/.ninja_log >$WORKSPACE/chromium/src/out/arm/ninja_log_trace.json
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/arm/ninja_log_trace.json
- name: Build Cromite Linux 64
if: ${{ (github.event.inputs.target_os == 'linux' || github.event.inputs.target_os == 'all') }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
echo "::group::-------- gn gen"
gn gen --args="target_os = \"linux\" $(cat /home/lg/working_dir/cromite/build/cromite.gn_args) target_cpu = \"x64\" " out/lin64
echo "::endgroup::"
echo "::group::-------- gn args"
gn args out/lin64/ --list --short
gn args out/lin64/ --list >out/lin64/gn_list
echo "::endgroup::"
ninja -C out/lin64 chrome chrome_sandbox
cp ../../cromite/build/RELEASE out/lin64
- name: Get ninja logs Linux 64
if: ${{ (github.event.inputs.target_os == 'linux' || github.event.inputs.target_os == 'all') }}
shell: bash
run: |
cd $WORKSPACE
$WORKSPACE/ninjatracing/ninjatracing -a $WORKSPACE/chromium/src/out/lin64/.ninja_log >$WORKSPACE/chromium/src/out/lin64/ninja_log_trace.json
python3 $WORKSPACE/chromium/src/third_party/catapult/tracing/bin/trace2html $WORKSPACE/chromium/src/out/lin64/ninja_log_trace.json
- name: Generate clangd index for Android arm64
if: ${{ github.event.inputs.clangd == 'true' }}
shell: bash
run: |
PATH=$WORKSPACE/chromium/src/third_party/llvm-build/Release+Asserts/bin:$WORKSPACE/depot_tools/:/usr/local/go/bin:$WORKSPACE/mtool/bin:$PATH
cd $WORKSPACE/chromium/src
test -f out/arm64/cromite.idx || \
cp -r out/arm64 out/clangd && \
gn gen --args="import(\"/home/lg/working_dir/cromite/build/cromite.gn_args\") $(cat ../../build_args.gni) skip_clangd_unsupported_options = true" out/clangd && \
$WORKSPACE/ninja/ninja -C $WORKSPACE/chromium/src/out/clangd -a chrome_public_apk \
-t compdb cc cxx objc objcxx >$WORKSPACE/chromium/src/out/clangd/compile_commands.json && \
/home/lg/working_dir/clangd_snapshot_20211205/bin/clangd-indexer --executor=all-TUs out/clangd/compile_commands.json >out/arm64/cromite.idx && \
rm -rf out/clangd