Skip to content

Commit 46ba2aa

Browse files
mabrarovedsiper
authored andcommitted
ci: configurable and recent (same as used by GitHub Actions) version of CMake in code analysis shell script to match minimal CMake version requirement after upgrade of libs in #10195.
Signed-off-by: Marat Abrarov <[email protected]>
1 parent 313f049 commit 46ba2aa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

run_code_analysis.sh

+16
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ fi
3434
machine_id_file="$(mktemp)"
3535
< /dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 > "${machine_id_file}"
3636

37+
cmake_version="${CMAKE_VERSION:-"3.31.6"}"
38+
cmake_url="${CMAKE_URL:-"https://github.com/Kitware/CMake/releases/download"}"
39+
cmake_home="/opt/cmake"
40+
3741
exit_code=0
3842
# Run the action we want on it but using an in-container build directory to prevent various permissions errors and files locally
3943
"$CONTAINER_RUNTIME" run --rm -t -w "/tmp/source" -v "${SOURCE_DIR}:/source:ro" \
@@ -44,6 +48,18 @@ exit_code=0
4448
-e INPUT_PRE_COMMAND="cp -R /source /tmp" \
4549
-e INPUT_WORKING-DIRECTORY="/tmp/source" \
4650
lpenz/ghaction-cmake:0.19 \
51+
sh -c "\
52+
cmake_install_script=\"\$(mktemp --suffix '.sh')\" && \
53+
cmake_download_url=$(printf "%q" "${cmake_url}/v${cmake_version}/cmake-${cmake_version}")\"-linux-\$(uname -m).sh\" && \
54+
echo \"Downloading CMake: \${cmake_download_url} -> \${cmake_install_script}\" && \
55+
curl -jksSL -o \"\${cmake_install_script}\" \"\${cmake_download_url}\" && \
56+
mkdir -p $(printf "%q" "${cmake_home}") && \
57+
echo \"Installing CMake: \${cmake_install_script} -> \"$(printf "%q" "${cmake_home}") && \
58+
sh \"\${cmake_install_script}\" --skip-license --exclude-subdir --prefix=$(printf "%q" "${cmake_home}") && \
59+
rm -f \"\${cmake_install_script}\" && \
60+
export PATH=\"$(printf "%q" "${cmake_home}/bin"):\${PATH}\" && \
61+
cmake --version && \
62+
entrypoint" \
4763
|| exit_code=$?
4864

4965
rm -f "${machine_id_file}"

0 commit comments

Comments
 (0)