Files
oh-my-pi/.github/actions/ensure-cmake/action.yml
T
can1357 90e0a8af28 fix(ci): repaired native builds broken by native audio stack deps
- Added ensure-cmake action installing pinned cmake/ninja on omp-kata pods; audiopus_sys builds bundled libopus via CMake (Ninja for MSVC cross).
- Set CMAKE_POLICY_VERSION_MINIMUM=3.5 globally and in build-native.ts: the bundled opus tree declares cmake_minimum_required below 3.5, which CMake 4.x refuses.
- Dropped the -C target-cpu=native fallback for non-x64 native builds: it baked build-host CPU features into shipped darwin arm64 addons and trips ring 0.17's aarch64-apple const assertion.
2026-07-24 09:36:31 +02:00

81 lines
3.2 KiB
YAML

name: "ensure cmake"
description: >-
Ensure cmake (and ninja on Linux) are on PATH for native builds that compile
bundled C libraries (audiopus_sys builds libopus via CMake; MSVC cross builds
generate with Ninja). No-op when the runner image already ships them
(GitHub-hosted images do); self-heals on the omp-kata pods by installing
pinned binaries into ~/.local.
inputs:
cmake-version:
required: false
default: "4.1.2"
description: CMake release version installed when cmake is missing
ninja-version:
required: false
default: "1.13.1"
description: Ninja release version installed when ninja is missing (Linux only)
runs:
using: composite
steps:
- shell: bash
env:
CMAKE_VERSION: ${{ inputs.cmake-version }}
NINJA_VERSION: ${{ inputs.ninja-version }}
run: |
set -euo pipefail
destdir="${HOME}/.local"
mkdir -p "$destdir"
if command -v cmake >/dev/null 2>&1 && cmake --version >/dev/null 2>&1; then
echo "Using preinstalled $(cmake --version | head -n1)"
else
case "$(uname -s)-$(uname -m)" in
Linux-x86_64) archive="cmake-${CMAKE_VERSION}-linux-x86_64" ;;
Linux-aarch64) archive="cmake-${CMAKE_VERSION}-linux-aarch64" ;;
Darwin-*) archive="cmake-${CMAKE_VERSION}-macos-universal" ;;
*)
echo "Unsupported cmake host: $(uname -s)-$(uname -m)" >&2
exit 1
;;
esac
rm -rf "${destdir:?}/${archive}"
curl -fsSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${archive}.tar.gz" -o "${destdir}/cmake.tar.gz"
tar -xzf "${destdir}/cmake.tar.gz" -C "$destdir"
rm -f "${destdir}/cmake.tar.gz"
case "$archive" in
*macos*) bindir="${destdir}/${archive}/CMake.app/Contents/bin" ;;
*) bindir="${destdir}/${archive}/bin" ;;
esac
echo "$bindir" >> "$GITHUB_PATH"
echo "Installed $("${bindir}/cmake" --version | head -n1)"
fi
# Ninja is only needed on Linux hosts: cmake-rs generates MSVC cross
# builds (cargo-xwin) with the Ninja generator. macOS images ship it.
if [ "$(uname -s)" = "Linux" ] && ! command -v ninja >/dev/null 2>&1; then
case "$(uname -m)" in
x86_64) zip="ninja-linux.zip" ;;
aarch64) zip="ninja-linux-aarch64.zip" ;;
*)
echo "Unsupported ninja host: $(uname -m)" >&2
exit 1
;;
esac
bindir="${destdir}/ninja-${NINJA_VERSION}"
mkdir -p "$bindir"
curl -fsSL "https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/${zip}" -o "${bindir}/ninja.zip"
if command -v unzip >/dev/null 2>&1; then
unzip -oq "${bindir}/ninja.zip" -d "$bindir"
elif command -v bsdtar >/dev/null 2>&1; then
bsdtar -xf "${bindir}/ninja.zip" -C "$bindir"
else
python3 -m zipfile -e "${bindir}/ninja.zip" "$bindir"
fi
rm -f "${bindir}/ninja.zip"
chmod +x "${bindir}/ninja"
echo "$bindir" >> "$GITHUB_PATH"
echo "Installed ninja $("${bindir}/ninja" --version)"
fi