forked from espressif/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
609 lines (550 loc) · 20.5 KB
/
.gitlab-ci.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
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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
stages:
- build
- pack
- private_deploy
- test
- public_deploy
image: ${CI_DOCKER_REGISTRY}/llvm-build:4
variables:
# move all these to CI/CD settings
REL_SFX: "llvm14_0_0"
CLANG_VER: "14.0.0"
GCC_REL_NAME: "esp-2022r1"
GCC_REL_VER: "gcc11_2_0"
NEWLIB_REPO: "newlib-cygwin"
NEWLIB_REF: "esp-2022r1"
BINUTILS_REPO: "binutils-gdb"
BINUTILS_REF: "esp-2022r1-binutils"
XTENSA_OVERLAYS_REPO: "xtensa-overlays"
XTENSA_OVERLAYS_REF: "master"
LLVM_GCC_TESTSUITE_REF: "release_universal_clang_toolchain"
XTENSA_CLANG_TOOLCHAIN_REF: "release_universal_clang_toolchain"
CROSS_ARM_IMAGE: $CI_DOCKER_REGISTRY/llvm-build-cross-arm:1
PLATFORM_NAME_LINUX: "linux-amd64"
PLATFORM_NAME_LINUX_ARMHF: "linux-armhf"
PLATFORM_NAME_LINUX_ARM64: "linux-arm64"
PLATFORM_NAME_WIN: "win64"
PLATFORM_NAME_MACOS: "macos"
PLATFORM_NAME_MACOS_ARM64: "macos-arm64"
ARCHIVE_TOOL_LINUX: "tar -cJf"
UNARCHIVE_TOOL_LINUX: "tar -xf"
ARCHIVE_EXT_LINUX: "tar.xz"
ARCHIVE_TOOL_WIN: "zip -9 -r"
UNARCHIVE_TOOL_WIN: "unzip"
ARCHIVE_EXT_WIN: "zip"
ARCHIVE_TOOL_MACOS: "tar -cJf"
UNARCHIVE_TOOL_MACOS: "tar -xf"
ARCHIVE_EXT_MACOS: "tar.xz"
ARCHIVE_TOOL_NEWLIB: ${ARCHIVE_TOOL_LINUX}
UNARCHIVE_TOOL_NEWLIB: ${UNARCHIVE_TOOL_LINUX}
ARCHIVE_EXT_NEWLIB: ${ARCHIVE_EXT_LINUX}
DIST_NEW_DIR: "_dist_new"
DIST_DIR: "dist"
BUILD_DIR: "_build"
DOWNLOADS_DIR: "_downloads"
###########################################################################
#################### START OF TEMPORARY LEGACY CODE #######################
# TODO: the code below is to be removed after migration to new build script
CONF_TARGET: "xtensa-esp32-elf"
XTENSA_CLANG_TOOLCHAIN: "${CONF_TARGET}-clang"
##################### END OF TEMPORARY LEGACY CODE ########################
###########################################################################
.use_ci_tools: &use_ci_tools |
curl -sSL ${CIT_LOADER_URL} -o cit_loader.sh && sh cit_loader.sh
source citools/import_functions
.add_gitlab_key: &add_gitlab_key |
cit_add_ssh_key "${GITLAB_KEY}"
before_script:
- *use_ci_tools
- *add_gitlab_key
# Prepare release name/number
.get_release_name: &get_release_name |
# using annotated tags
REL_NUM=$(git describe --abbrev=7)
REL_NAME=${REL_SFX}-${REL_NUM}-${PLATFORM_NAME}
ARCHIVE_NAME=${REL_NAME}.${ARCHIVE_EXT}
LIBS_ARCHIVE_NAME=libs_${REL_NAME}.${ARCHIVE_EXT}
echo "PLATFORM_NAME: $PLATFORM_NAME"
echo "REL_NUM: $REL_NUM"
echo "REL_NAME: $REL_NAME"
echo "ARCHIVE_NAME: $ARCHIVE_NAME"
# Get an existing crosstool-ng builds for all chips
.get_gcc_toolchain: &get_gcc_toolchain |
declare -a XTENSA_CPUS=("esp32"
"esp32s2"
"esp32s3")
for ((i = 0; i < ${#XTENSA_CPUS[@]}; i++)); do
XTENSA_CPU=${XTENSA_CPUS[$i]}
GCC_TOOLCHAIN_ARCH=xtensa-${XTENSA_CPU}-elf-${GCC_REL_VER}-${GCC_REL_NAME}-${PLATFORM_NAME}.${ARCHIVE_EXT}
wget --no-verbose https://dl.espressif.com/github_assets/espressif/crosstool-NG/releases/download/${GCC_REL_NAME}/${GCC_TOOLCHAIN_ARCH}
${UNARCHIVE_TOOL} ${GCC_TOOLCHAIN_ARCH}
done;
GCC_TOOLCHAIN_ARCH=riscv32-esp-elf-${GCC_REL_VER}-${GCC_REL_NAME}-${PLATFORM_NAME}.${ARCHIVE_EXT}
wget --no-verbose https://dl.espressif.com/github_assets/espressif/crosstool-NG/releases/download/${GCC_REL_NAME}/${GCC_TOOLCHAIN_ARCH}
${UNARCHIVE_TOOL} ${GCC_TOOLCHAIN_ARCH}
.get_clang_toolchain_build_scripts: &get_clang_toolchain_build_scripts |
git clone -b ${XTENSA_CLANG_TOOLCHAIN_REF} ${GITLAB_SSH_SERVER}/${XTENSA_CLANG_TOOLCHAIN_REPO}
cp -r xtensa-clang-toolchain/* .
# LLVM Build System used the remote address to show detailed version info, we'll change it to the public repository
.fix_origin_remote_for_public: &fix_origin_remote_for_public |
git remote set-url origin "${GH_REPO_HTTPS}"
# Pack the toolchain
.package_toolchain: &package_toolchain |
${ARCHIVE_TOOL} ${ARCHIVE_NAME} esp-clang/
mkdir -p ${DISTRO_DIR}
mv ${ARCHIVE_NAME} ${DISTRO_DIR}/
echo "${ARCHIVE_NAME}" > ${DISTRO_DIR}/file_${PLATFORM_NAME}
# Pack libs to be used for Rust, Go etc.
.package_libs: &package_libs |
${ARCHIVE_TOOL} ${LIBS_ARCHIVE_NAME} esp-clang/lib/libclang* esp-clang/lib/clang/${CLANG_VER}/include
mkdir -p ${DISTRO_DIR}
mv ${LIBS_ARCHIVE_NAME} ${DISTRO_DIR}/
echo "${LIBS_ARCHIVE_NAME}" > ${DISTRO_DIR}/file_libs-${PLATFORM_NAME}
.get_binutils: &get_binutils |
git clone -b ${BINUTILS_REF} --single-branch ${GITLAB_SSH_SERVER}/idf/${BINUTILS_REPO}.git
BINUTILS_PATH=$PWD/${BINUTILS_REPO}
.get_xtensa_overlays: &get_xtensa_overlays |
git clone -b ${XTENSA_OVERLAYS_REF} --single-branch ${GITLAB_SSH_SERVER}/idf/${XTENSA_OVERLAYS_REPO}.git
XTENSA_OVERLAYS_PATH=$PWD/${XTENSA_OVERLAYS_REPO}
.get_newlib: &get_newlib |
git clone -b ${NEWLIB_REF} --single-branch ${GITLAB_SSH_SERVER}/idf/${NEWLIB_REPO}.git
NEWLIB_PATH=$PWD/${NEWLIB_REPO}
.build_template:
stage: build
tags: [ "amd64", "build" ]
allow_failure: true
artifacts:
paths:
- ${DIST_DIR}/
- ${BUILD_DIR}/tests.log
- ${BUILD_DIR}/build.log
when: always
expire_in: 1 day
variables:
BUILD_TOOLCHAIN_CMD_EXTRA_ARGS: ""
# use separate dist dir for universal toolchain
# TODO: remove this var after switching to universal toolchain builds
DIST_DIR: ${DIST_NEW_DIR}
script:
- *get_release_name
- mkdir ${DOWNLOADS_DIR}
- pushd ${DOWNLOADS_DIR}
- ESP_GCC_TOOLCHAIN_DIST_BASE=$PWD
- *get_gcc_toolchain
- *get_binutils
- *get_xtensa_overlays
- popd
- *get_clang_toolchain_build_scripts
- *fix_origin_remote_for_public
- LLVM_PROJECT_PATH=$PWD
- BUILD_PATH=$PWD/${BUILD_DIR}
- mkdir -p ${BUILD_PATH}
- export USE_PARALLEL_LINK_JOBS=2
# build Clang toolchain w/o newlib
- ${BUILD_TOOLCHAIN_CMD} --llvm-path=${LLVM_PROJECT_PATH}
--gcc-toolchains-path=${ESP_GCC_TOOLCHAIN_DIST_BASE} --binutils-path=${BINUTILS_PATH}
--xtensa-overlays-path=${XTENSA_OVERLAYS_PATH} --host=${CONF_HOST} ${BUILD_TOOLCHAIN_CMD_EXTRA_ARGS} ${BUILD_PATH} 2>&1 > ${BUILD_PATH}/build.log
- BUILD_HOST=$(gcc -dumpmachine)
# Do not run unit tests for cross-builds.
# Run as non-root user because permission tests fail when run by root.
- if [ "${CONF_HOST}" == "${BUILD_HOST}" ]; then
export LLVM_BUILD_PATH=${LLVM_PROJECT_PATH}/llvm/build-${CONF_HOST}-Release;
echo "Run unit tests for native build in ${LLVM_BUILD_PATH}";
useradd -m test_runner;
chown -R test_runner ${LLVM_BUILD_PATH};
touch ${BUILD_PATH}/tests.log;
chmod o+w ${BUILD_PATH}/tests.log;
runuser -l test_runner -c 'cmake --build '${LLVM_BUILD_PATH}' --target check-all 2>&1 > '${BUILD_PATH}'/tests.log';
fi
- export DISTRO_DIR=$PWD/$DIST_DIR
- pushd ${BUILD_PATH}
- *package_toolchain
- popd
.build_linux-gnu_template:
extends: .build_template
variables:
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
BUILD_TOOLCHAIN_CMD: "./build-toolchain.sh"
build_x86_64-linux-gnu:
extends: .build_linux-gnu_template
variables:
CONF_HOST: "x86_64-linux-gnu"
PLATFORM_NAME: "${PLATFORM_NAME_LINUX}"
build_arm-linux-gnueabihf:
extends: .build_linux-gnu_template
image: ${CROSS_ARM_IMAGE}
variables:
CONF_HOST: "arm-linux-gnueabihf"
PLATFORM_NAME: "${PLATFORM_NAME_LINUX_ARMHF}"
build_aarch64-linux-gnu:
extends: .build_linux-gnu_template
image: ${CROSS_ARM_IMAGE}
variables:
CONF_HOST: "aarch64-linux-gnu"
PLATFORM_NAME: "${PLATFORM_NAME_LINUX_ARM64}"
build_x86_64-w64-mingw32:
extends: .build_template
needs:
# needs native toolchain and newlib from this job
- job: build_x86_64-linux-gnu
before_script:
- *use_ci_tools
- *add_gitlab_key
# get ARCHIVE_NAME for Linux release. Modify vars to make get_release_name working properly
- CLANG_LINUX_ARCHIVE=$(cat ${DIST_DIR}/file_${PLATFORM_NAME_LINUX})
# unpack x86_64-linux-gnu toolchain to re-use it as native Clang for Windows build
- mkdir -p esp-clang-${PLATFORM_NAME_LINUX}
- ${UNARCHIVE_TOOL_LINUX} ${DIST_DIR}/${CLANG_LINUX_ARCHIVE} -C esp-clang-${PLATFORM_NAME_LINUX}
# we do not want to keep artifacts from 'x86_64-linux-gnu' job
- rm -rf ${DIST_DIR}
- rm -rf ${BUILD_DIR}
# add build command args speciifc for Windows build
- export BUILD_TOOLCHAIN_CMD_EXTRA_ARGS="--native-esp-clang-path=$PWD/esp-clang-${PLATFORM_NAME_LINUX}"
variables:
CONF_HOST: "x86_64-w64-mingw32"
PLATFORM_NAME: "${PLATFORM_NAME_WIN}"
# Use Linux compressor to minimize artifact size.
# Toolchain is not fully stripped yet, so may exceed max artifact size.
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_WIN}"
ARCHIVE_EXT: "${ARCHIVE_EXT_WIN}"
BUILD_TOOLCHAIN_CMD: "./build-toolchain-win.sh"
.build_apple-darwin_template:
extends: .build_template
variables:
ARCHIVE_TOOL: "${ARCHIVE_TOOL_MACOS}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_MACOS}"
ARCHIVE_EXT: "${ARCHIVE_EXT_MACOS}"
BUILD_TOOLCHAIN_CMD: "./build-toolchain.sh"
build_x86_64-apple-darwin:
extends: .build_apple-darwin_template
variables:
CONF_HOST: "x86_64-apple-darwin21.1"
PLATFORM_NAME: "${PLATFORM_NAME_MACOS}"
build_aarch64-apple-darwin:
extends: .build_apple-darwin_template
variables:
CONF_HOST: "aarch64-apple-darwin21.1"
PLATFORM_NAME: "${PLATFORM_NAME_MACOS_ARM64}"
build_newlib:
stage: build
tags: [ "amd64", "build" ]
allow_failure: true
needs:
# needs native toolchainfrom this job
- job: build_x86_64-linux-gnu
artifacts:
paths:
- ${DIST_DIR}/
- ${BUILD_DIR}/build.log
when: always
expire_in: 1 day
variables:
PLATFORM_NAME: "${PLATFORM_NAME_LINUX}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
# use separate dist dir for universal toolchain
# TODO: remove this var after switching to universal toolchain builds
DIST_DIR: ${DIST_NEW_DIR}
script:
# get ARCHIVE_NAME for Linux release.
- CLANG_ARCHIVE=$PWD/${DIST_DIR}/$(cat ${DIST_DIR}/file_${PLATFORM_NAME_LINUX})
- mkdir -p ${DOWNLOADS_DIR}
- pushd ${DOWNLOADS_DIR}
- *get_xtensa_overlays
- *get_newlib
# unpack clang
- ${UNARCHIVE_TOOL} ${CLANG_ARCHIVE}
- export PATH=$PWD/esp-clang/bin:$PATH
- popd
- rm -rf $PWD/${DIST_DIR}
- *get_clang_toolchain_build_scripts
# build newlib overlay using ESP native (Linux) clang toolchain only
# it will be re-used for cross-buit toolchains (win and mac).
- NEWLIB_OVERLAY_DISTRO_PATH=$PWD/${DIST_DIR}
- mkdir -p ${NEWLIB_OVERLAY_DISTRO_PATH}
- BUILD_PATH=$PWD/${BUILD_DIR}
- mkdir -p ${BUILD_PATH}
- ./build-toolchain.sh --newlib-path=${NEWLIB_PATH} --xtensa-overlays-path=${XTENSA_OVERLAYS_PATH} ${BUILD_PATH} 2>&1 > ${BUILD_PATH}/build.log
- pushd ${BUILD_PATH}
- ${ARCHIVE_TOOL_NEWLIB} ${NEWLIB_OVERLAY_DISTRO_PATH}/esp-clang-newlib-overlay.${ARCHIVE_EXT_NEWLIB} esp-clang/
- popd
.pack_template:
stage: pack
tags: [ "amd64", "build" ]
allow_failure: true
artifacts:
paths:
- ${DIST_DIR}/
when: always
expire_in: 3 day
variables:
# use separate dist dir for universal toolchain
# TODO: remove this var after switching to universal toolchain builds
DIST_DIR: ${DIST_NEW_DIR}
script:
- *get_release_name
- export BUILD_PATH=$PWD/${BUILD_DIR}
- mkdir -p ${BUILD_PATH}
# unpack clang
- ${UNARCHIVE_TOOL} ${DIST_DIR}/${ARCHIVE_NAME} -C ${BUILD_PATH}
# unpack newlib
- ${UNARCHIVE_TOOL_NEWLIB} ${DIST_DIR}/esp-clang-newlib-overlay.${ARCHIVE_EXT_NEWLIB} -C ${BUILD_PATH}
- rm -rf ${DIST_DIR}
- *get_clang_toolchain_build_scripts
# strip binutils afer newlib is built
- STRIP_BINUTILS=YES ./build-toolchain.sh --host=${CONF_HOST} ${BUILD_PATH}
- DISTRO_DIR=$PWD/${DIST_DIR}
- pushd ${BUILD_PATH}
- *package_toolchain
- *package_libs
- popd
.pack_linux-gnu_template:
extends: .pack_template
variables:
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
pack_x86_64-linux-gnu:
extends: .pack_linux-gnu_template
needs:
- job: build_x86_64-linux-gnu
- job: build_newlib
variables:
CONF_HOST: "x86_64-linux-gnu"
PLATFORM_NAME: "${PLATFORM_NAME_LINUX}"
pack_arm-linux-gnueabihf:
extends: .pack_linux-gnu_template
image: ${CROSS_ARM_IMAGE}
needs:
- job: build_arm-linux-gnueabihf
- job: build_newlib
variables:
CONF_HOST: "arm-linux-gnueabihf"
PLATFORM_NAME: "${PLATFORM_NAME_LINUX_ARMHF}"
pack_aarch64-linux-gnu:
extends: .pack_linux-gnu_template
image: ${CROSS_ARM_IMAGE}
needs:
- job: build_aarch64-linux-gnu
- job: build_newlib
variables:
CONF_HOST: "aarch64-linux-gnu"
PLATFORM_NAME: "${PLATFORM_NAME_LINUX_ARM64}"
pack_x86_64-w64-mingw32:
extends: .pack_template
needs:
- job: build_x86_64-w64-mingw32
- job: build_newlib
variables:
CONF_HOST: "x86_64-w64-mingw32"
PLATFORM_NAME: "${PLATFORM_NAME_WIN}"
# use Linux compressor to save space.
# upon release archive will be re-packed into zip format for uploading to GH
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_WIN}"
.pack_apple-darwin_template:
extends: .pack_template
variables:
ARCHIVE_TOOL: "${ARCHIVE_TOOL_MACOS}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_MACOS}"
ARCHIVE_EXT: "${ARCHIVE_EXT_MACOS}"
pack_x86_64-apple-darwin:
extends: .pack_apple-darwin_template
needs:
- job: build_x86_64-apple-darwin
- job: build_newlib
variables:
CONF_HOST: "x86_64-apple-darwin21.1"
PLATFORM_NAME: "${PLATFORM_NAME_MACOS}"
pack_aarch64-apple-darwin:
extends: .pack_apple-darwin_template
needs:
- job: build_aarch64-apple-darwin
- job: build_newlib
variables:
CONF_HOST: "aarch64-apple-darwin21.1"
PLATFORM_NAME: "${PLATFORM_NAME_MACOS_ARM64}"
test_x86_64-linux-gnu:
stage: test
tags: [ "amd64", "build" ]
allow_failure: true
needs:
- job: pack_x86_64-linux-gnu
variables:
PLATFORM_NAME: "${PLATFORM_NAME_LINUX}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
# use separate dist dir for universal toolchain
# TODO: remove this var after switching to universal toolchain builds
DIST_DIR: ${DIST_NEW_DIR}
script:
- *get_release_name
- ${UNARCHIVE_TOOL} ${DIST_DIR}/${ARCHIVE_NAME}
# getting testsuite
- git clone -b ${LLVM_GCC_TESTSUITE_REF} --depth 1 $GITLAB_SSH_SERVER/idf/llvm-xtensa-testsuite.git
# preparing testsuite
- export PATH=${PWD}/esp-clang/bin:$PATH
- cd llvm-xtensa-testsuite
# qemu
- ./qemu_esp32_install.sh
# run testsuite for esp32
- ./run_esp32_tests.sh
###########################################################################
#################### START OF TEMPORARY LEGACY CODE #######################
# TODO: the code below is to be removed after migration to new build script
.get_release_name_old: &get_release_name_old |
# using annotated tags
REL_NUM=$(git describe --abbrev=7)
REL_SFX="llvm14_0_0"
REL_NAME=${CONF_TARGET}-${REL_SFX}-${REL_NUM}-${PLATFORM_NAME}
ARCHIVE_NAME=${REL_NAME}.${ARCHIVE_EXT}
echo "PLATFORM_NAME: $PLATFORM_NAME"
echo "REL_NUM: $REL_NUM"
echo "REL_NAME: $REL_NAME"
echo "ARCHIVE_NAME: $ARCHIVE_NAME"
.get_gcc_toolchain_old: &get_gcc_toolchain_old |
wget --no-verbose https://dl.espressif.com/github_assets/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/${XTENSA_GCC_TOOLCHAIN}
${UNARCHIVE_TOOL} ${XTENSA_GCC_TOOLCHAIN}
if [[ "$XTENSA_GCC_TOOLCHAIN" == *"linux-amd64"* ]]; then
cp -r xtensa-esp32-elf ${XTENSA_CLANG_TOOLCHAIN}
else
mv xtensa-esp32-elf ${XTENSA_CLANG_TOOLCHAIN}
wget --no-verbose https://dl.espressif.com/github_assets/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32-elf-${GCC_REL_NAME}-linux-amd64.tar.gz
tar -xf xtensa-esp32-elf-${GCC_REL_NAME}-linux-amd64.tar.gz
fi
export GCC_ESP32_LINUX_TOOLCHAIN="xtensa-esp32-elf"
.package_toolchain_old: &package_toolchain_old |
${ARCHIVE_TOOL} ${ARCHIVE_NAME} ${XTENSA_CLANG_TOOLCHAIN}/
mkdir -p ${DIST_DIR}
mv ${ARCHIVE_NAME} ${DIST_DIR}/
echo "${ARCHIVE_NAME}" > ${DIST_DIR}/file_${PLATFORM_NAME}_${CONF_TARGET}
.build_template_old:
stage: build
tags: [ "amd64", "build" ]
artifacts:
paths:
- ${DIST_DIR}/
when: always
expire_in: 10 day
variables:
XTENSA_CLANG_TOOLCHAIN_REF: "esp-20220721-r14.0.0"
GCC_REL_NAME: "gcc8_4_0-esp-2021r2-patch3"
script:
- *get_release_name_old
- *get_gcc_toolchain_old
- *fix_origin_remote_for_public
- *get_clang_toolchain_build_scripts
- ${BUILD_TOOLCHAIN_CMD} "${XTENSA_CLANG_TOOLCHAIN}"
- *package_toolchain_old
linux_amd64_build:
extends: .build_template_old
variables:
PLATFORM_NAME: "${PLATFORM_NAME_LINUX}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
XTENSA_GCC_TOOLCHAIN: "xtensa-esp32-elf-${GCC_REL_NAME}-linux-amd64.tar.gz"
BUILD_TOOLCHAIN_CMD: "./build-toolchain-linux.sh"
linux_arm64_build:
extends: .build_template_old
image: ${CROSS_ARM_IMAGE}
variables:
PLATFORM_NAME: "${PLATFORM_NAME_LINUX_ARM64}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
XTENSA_GCC_TOOLCHAIN: "xtensa-esp32-elf-${GCC_REL_NAME}-linux-arm64.tar.gz"
BUILD_TOOLCHAIN_CMD: "./build-toolchain-linux-arm64.sh"
win64_build:
extends: .build_template_old
variables:
PLATFORM_NAME: "${PLATFORM_NAME_WIN}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_WIN}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_WIN}"
ARCHIVE_EXT: "${ARCHIVE_EXT_WIN}"
XTENSA_GCC_TOOLCHAIN: "xtensa-esp32-elf-${GCC_REL_NAME}-win64.zip"
BUILD_TOOLCHAIN_CMD: "./build-toolchain-win.sh"
macos_amd64_build:
extends: .build_template_old
variables:
PLATFORM_NAME: "${PLATFORM_NAME_MACOS}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_MACOS}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_MACOS}"
ARCHIVE_EXT: "${ARCHIVE_EXT_MACOS}"
XTENSA_GCC_TOOLCHAIN: "xtensa-esp32-elf-${GCC_REL_NAME}-macos.tar.gz"
BUILD_TOOLCHAIN_CMD: "./build-toolchain-macos.sh"
linux_amd64_testsuite:
stage: test
tags: [ "amd64", "build" ]
needs:
- job: linux_amd64_build
variables:
PLATFORM_NAME: "${PLATFORM_NAME_LINUX}"
ARCHIVE_TOOL: "${ARCHIVE_TOOL_LINUX}"
UNARCHIVE_TOOL: "${UNARCHIVE_TOOL_LINUX}"
ARCHIVE_EXT: "${ARCHIVE_EXT_LINUX}"
LLVM_GCC_TESTSUITE_REF: "feature/ci_llvm_multitarget_crt_tests_fixed"
script:
- *get_release_name_old
- ${UNARCHIVE_TOOL} ${DIST_DIR}/${ARCHIVE_NAME}
# getting testsuite
- git clone -b ${LLVM_GCC_TESTSUITE_REF} --depth 1 $GITLAB_SSH_SERVER/idf/llvm-xtensa-testsuite.git
# preparing testsuite
- export PATH=${PWD}/${XTENSA_CLANG_TOOLCHAIN}/bin/:$PATH
- cd llvm-xtensa-testsuite
# qemu
- ./qemu_esp32_install.sh
# run testsuite for esp32
- ./run_esp32_tests.sh
# run testsuite for compiler_rt library
- ./run_esp32_crt_tests.sh ../$XTENSA_CLANG_TOOLCHAIN
##################### END OF TEMPORARY LEGACY CODE ########################
###########################################################################
upload_to_http:
stage: private_deploy
when: manual
allow_failure: true
tags: [ "deploy", "shiny" ]
variables:
# force the fetch strategy to clean old archives up in dist/ dir
GIT_STRATEGY: fetch
before_script:
- *use_ci_tools
script:
- cit_add_ssh_key "${HTTP_UPLOAD_KEY}"
# List of archives
- FILES=$(find ${DIST_DIR} -name file_\* -exec cat {} \+)
- cd ${DIST_DIR}
- scp ${FILES} ${HTTP_UPLOAD_DIR}/ct-ng/llvm-builds
# Show info
- echo -e "\nArchives were published there:\n\n$(for n in ${FILES}; do echo "${HTTP_PUBLIC_DIR}/ct-ng/llvm-builds/${n}"; done)\n"
upload_to_github:
stage: public_deploy
when: manual
allow_failure: true
only:
- tags
tags: [ "amd64", "internet" ]
image: espressif/github-hub:2
variables:
GIT_STRATEGY: fetch
GITHUB_TOKEN: "${GH_TOKEN}"
GITHUB_REPO: "${GH_REPO_HTTPS}"
TAG: "${CI_COMMIT_TAG}"
before_script: []
script:
- ls -l dist*/
- git remote add github ${GH_REPO_HTTPS}
- hub release show ${TAG} || { echo "Please create a release on GitHub with ${TAG} tag at first"; exit 1; }
# List of archives
- FILES=$(find ${DIST_DIR} -name file_\* -exec cat {} \+)
- cd ${DIST_DIR}
- ls -l $FILES
# Upload archives
- for n in ${FILES}; do hub release edit -m "" -a "${n}" "${TAG}"; done