11stages :
2+   - test_build 
23  - upstream_sync 
34
45image : ${CI_DOCKER_REGISTRY}/llvm-build:5 
@@ -7,6 +8,13 @@ default:
78  interruptible : true 
89
910variables :
11+   ESP_LLVM_EMBEDDED_TOOLCHAIN_REF : " llvm_release_19" 
12+   ESP_GNU_TOOLCHAIN_VER : " 14.2.0_20241119" 
13+   CROSS_ARM_IMAGE : $CI_DOCKER_REGISTRY/llvm-build-cross-arm:2 
14+   CROSS_WIN_IMAGE : $CI_DOCKER_REGISTRY/llvm-build-cross-win:3 
15+   DIST_DIR : " dist" 
16+   BUILD_DIR : " build" 
17+   GITLAB_SERVER_URL : https://gitlab-ci-token:${CI_JOB_TOKEN}@${GITLAB_HTTPS_SERVER} 
1018  REBASE_PUSH_REMOTE : " https://gitlab-ci-token:${ESP_MAIN_MAINT_TOKEN}@${GITLAB_HTTPS_SERVER}/${CI_PROJECT_PATH}.git" 
1119
1220workflow :
@@ -24,6 +32,9 @@ workflow:
2432.add_gitlab_key : &add_gitlab_key | 
2533  cit_add_ssh_key "${GITLAB_KEY}" 
2634
35+ .get_toolchain_build_scripts : &get_toolchain_build_scripts | 
36+   git clone -b ${ESP_LLVM_EMBEDDED_TOOLCHAIN_REF} ${GITLAB_SERVER_URL}/${ESP_LLVM_EMBEDDED_TOOLCHAIN_REPO_PATH}.git 
37+ 
2738.rules:scheduled-rebase-on-main :
2839  rules :
2940    - if : $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "rebase_on_main" 
@@ -80,3 +91,56 @@ rebase_on_main:
8091      fi 
8192      git status 
8293      exit $rc 
94+ 
95+ #  some Clang/LLVM unit tests fail if we build Clang for RISCV+Xtensa only
96+ #  this job is intended to run unit tests only, so it builds Clang with all backends
97+ #  TODO: LLVM-326 and LLVM-401
98+ build_and_test :
99+   tags : [ "amd64", "build" ] 
100+   stage : test_build 
101+   artifacts :
102+     paths :
103+       - ${BUILD_DIR}/*.log 
104+     when : always 
105+     expire_in : 1 day 
106+   retry : 2 
107+   before_script :
108+     - git config --global --add safe.directory $CI_PROJECT_DIR 
109+   after_script :
110+     #  help to identify that build failed due to OOM
111+     - > 
112+       if [ $CI_JOB_STATUS == 'failed' ]; then 
113+         [ ! -f "${BUILD_DIR}/build.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/build.log || true  
114+         [ ! -f "${BUILD_DIR}/tests.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/tests.log || true  
115+         [ ! -f "${BUILD_DIR}/lld-tests.log" ] || grep -i "internal compiler error\|Killed" ${BUILD_DIR}/lld-tests.log || true  
116+       fi 
117+ script :
118+     - BUILD_PATH=$PWD/${BUILD_DIR} 
119+     - LLVM_PROJECT_PATH=$PWD 
120+     - mkdir -p ${BUILD_PATH} 
121+     - cmake -G Ninja 
122+       -S llvm 
123+       -DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" 
124+       -DCMAKE_BUILD_TYPE=Release 
125+       -DLLVM_ENABLE_ASSERTIONS=ON 
126+       -DLLVM_APPEND_VC_REV=OFF 
127+       -DLLDB_INCLUDE_TESTS=OFF 
128+       -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=Xtensa 
129+       -DLLVM_USE_LINKER="gold" 
130+       -DLLVM_PARALLEL_LINK_JOBS=${ESP_LLVM_PARALLEL_LINK_JOBS} 
131+       -DLLVM_PARALLEL_COMPILE_JOBS=${ESP_LLVM_PARALLEL_COMPILE_JOBS} 
132+       -DLLVM_FORCE_VC_REPOSITORY="${GH_REPO_HTTPS}" 
133+       -B ${BUILD_PATH} 2>&1 > ${BUILD_PATH}/build.log 
134+     - export CUR_USER=$(whoami); 
135+     - useradd -m test_runner; 
136+     - chown -R test_runner ${BUILD_PATH}; 
137+     - runuser -u test_runner -- git config --global --add safe.directory $CI_PROJECT_DIR 
138+     - echo "Run LLVM/Clang unit tests"; 
139+     - touch ${BUILD_PATH}/tests.log; 
140+     - chmod o+w ${BUILD_PATH}/tests.log; 
141+     - runuser -u test_runner -- ninja -C ${BUILD_PATH} check-all 2>&1 | tee ${BUILD_PATH}/tests.log; 
142+     - echo "Run LLD unit tests"; 
143+     - touch ${BUILD_PATH}/lld-tests.log; 
144+     - chmod o+w ${BUILD_PATH}/lld-tests.log; 
145+     - runuser -u test_runner -- ninja -C ${BUILD_PATH} check-lld 2>&1 | tee ${BUILD_PATH}/lld-tests.log; 
146+     - chown -R ${CUR_USER} ${BUILD_PATH}; 
0 commit comments