mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 04:18:53 +00:00
ci: build genpolicy on darwin
genpolicy is a developer tool that should be usable on MacOS. Adding it to the darwin CI job ensures that it can still be built after changes. On an Apple M2, the output of `uname -m` is `arm64`, which is why a new case is needed in the arch_to_* functions. We're not going to cross-compile binaries on darwin, so don't install any additional Rust targets. Fixes: #11635 Signed-off-by: Markus Rudy <mr@edgeless.systems>
This commit is contained in:
11
.github/workflows/darwin-tests.yaml
vendored
11
.github/workflows/darwin-tests.yaml
vendored
@@ -18,6 +18,14 @@ jobs:
|
||||
name: test
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Install Protoc
|
||||
run: |
|
||||
f=$(mktemp)
|
||||
curl -sSLo "$f" https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protoc-28.2-osx-aarch_64.zip
|
||||
mkdir -p "$HOME/.local"
|
||||
unzip -d "$HOME/.local" "$f"
|
||||
echo "$HOME/.local/bin" >> "${GITHUB_PATH}"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
@@ -28,5 +36,8 @@ jobs:
|
||||
./tests/install_go.sh -f -p
|
||||
echo "/usr/local/go/bin" >> "${GITHUB_PATH}"
|
||||
|
||||
- name: Install Rust
|
||||
run: ./tests/install_rust.sh
|
||||
|
||||
- name: Build utils
|
||||
run: ./ci/darwin-test.sh
|
||||
|
@@ -8,6 +8,7 @@ set -e
|
||||
|
||||
cidir=$(dirname "$0")
|
||||
runtimedir=${cidir}/../src/runtime
|
||||
genpolicydir=${cidir}/../src/tools/genpolicy
|
||||
|
||||
build_working_packages() {
|
||||
# working packages:
|
||||
@@ -40,3 +41,11 @@ build_working_packages() {
|
||||
}
|
||||
|
||||
build_working_packages
|
||||
|
||||
build_genpolicy() {
|
||||
echo "building genpolicy"
|
||||
pushd "${genpolicydir}" &>/dev/null
|
||||
make TRIPLE=aarch64-apple-darwin build
|
||||
}
|
||||
|
||||
build_genpolicy
|
||||
|
@@ -822,7 +822,7 @@ function install_docker() {
|
||||
|
||||
# Convert architecture to the name used by golang
|
||||
function arch_to_golang() {
|
||||
local arch="$(uname -m)"
|
||||
local -r arch="$(uname -m)"
|
||||
|
||||
case "${arch}" in
|
||||
aarch64|arm64) echo "arm64";;
|
||||
@@ -839,7 +839,7 @@ function arch_to_rust() {
|
||||
local -r arch="$(uname -m)"
|
||||
|
||||
case "${arch}" in
|
||||
aarch64) echo "${arch}";;
|
||||
aarch64|arm64) echo "aarch64";;
|
||||
ppc64le) echo "powerpc64le";;
|
||||
riscv64) echo "riscv64gc";;
|
||||
x86_64) echo "${arch}";;
|
||||
@@ -853,7 +853,7 @@ function arch_to_kernel() {
|
||||
local -r arch="$(uname -m)"
|
||||
|
||||
case "${arch}" in
|
||||
aarch64) echo "arm64";;
|
||||
aarch64|arm64) echo "arm64";;
|
||||
ppc64le) echo "powerpc";;
|
||||
x86_64) echo "${arch}";;
|
||||
s390x) echo "s390x";;
|
||||
|
@@ -35,8 +35,10 @@ export PATH="${PATH}:${HOME}/.cargo/bin"
|
||||
rustup toolchain install "${version}"
|
||||
rustup default "${version}"
|
||||
if [[ "${rustarch}" == "x86_64" || "${rustarch}" == "aarch64" ]] ; then
|
||||
rustup target add "${rustarch}-unknown-linux-musl"
|
||||
$([[ "$(whoami)" != "root" ]] && echo sudo) ln -sf /usr/bin/g++ /bin/musl-g++
|
||||
if [[ "$(uname -s)" != "Darwin" ]]; then
|
||||
rustup target add "${rustarch}-unknown-linux-musl"
|
||||
$([[ "$(whoami)" != "root" ]] && echo sudo) ln -sf /usr/bin/g++ /bin/musl-g++
|
||||
fi
|
||||
else
|
||||
rustup target add "${rustarch}-unknown-linux-gnu"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user