Skip to content

Commit c493131

Browse files
committed
ci: use uname -m to download CMake in install-deps-debian
The action determines the host's architecture using `uname` to download the proper CMake distribution. `uname -i` is not portable [1] and gives `unknown` on Ubuntu 26.04. `uname -m` gives `x86_64` and `aarch64` everywhere, matching the archive names. Ubuntu 26.04 runners offered by GitHub have CMake 4.4.3 preinstalled, so we don't hit this problem: the version check skips the CMake 3.26.0 installation. Also, while we're here, let the `curl`+`tar` sequence fail the step on a failed download: add the `-f` flag to `curl` and split the `&&` command sequence (`bash -e` ignores a failure of any command but the last in a `&&` sequence [2]). [1]: https://www.gnu.org/software/coreutils/manual/html_node/uname-invocation.html [2]: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html Drafted by an LLM, conducted and corrected by the commit author. NO_DOC=ci NO_TEST=ci NO_CHANGELOG=ci
1 parent 394694e commit c493131

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎.github/actions/install-deps-debian/action.yml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ runs:
2424
util-linux
2525
# Install cmake 3.26.0 if cmake was missing or the cmake version was
2626
# less than 3.26.0.
27+
CMAKE_VERSION=3.26.0
2728
version_gt() {
2829
[ "$1" != "$2" ] && [ "$2" = "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" ]
2930
}
3031
CURRENT_VERSION="0.0.0"
3132
if command -v cmake >/dev/null 2>&1; then
3233
CURRENT_VERSION=$(cmake --version | head -n 1 | awk '{print $3}')
3334
fi
34-
if version_gt "3.26.0" "$CURRENT_VERSION"; then
35+
if version_gt "$CMAKE_VERSION" "$CURRENT_VERSION"; then
3536
${SUDO} apt-get purge --auto-remove cmake -y
36-
curl -O -L https://github.com/Kitware/CMake/releases/download/v3.26.0/cmake-3.26.0-linux-$(uname -i).tar.gz \
37-
&& ${SUDO} tar -xvf cmake-3.26.0-linux-$(uname -i).tar.gz -C /usr/local --strip-components=1 \
38-
&& rm cmake-3.26.0-linux-$(uname -i).tar.gz
37+
ARCH=$(uname -m)
38+
curl -f -O -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz
39+
${SUDO} tar -xvf cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz -C /usr/local --strip-components=1
40+
rm cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz
3941
fi
4042
# (Re)install luacheck only if it is not installed (or if another
4143
# version is installed).

0 commit comments

Comments
 (0)