From 53f388c22f13f29d799f91174cc52ac4bb630b43 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Mon, 5 Aug 2024 18:15:21 -0700 Subject: [PATCH] Add Zig to CI for ubuntu-rolling --- .github/workflows/os_comp.yml | 2 ++ ci/ciimage/ubuntu-rolling/install.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/os_comp.yml b/.github/workflows/os_comp.yml index 05e4f072deb6..7df3f40b1319 100644 --- a/.github/workflows/os_comp.yml +++ b/.github/workflows/os_comp.yml @@ -120,6 +120,8 @@ jobs: MESON_ARGS: '--unity=on' CC: 'gcc' CXX: 'g++' + - CC: 'zig cc' + CXX: 'zig c++' env: MESON_CI_JOBNAME_UPDATE: linux-${{ github.job }}-${{ matrix.cfg.CC }} diff --git a/ci/ciimage/ubuntu-rolling/install.sh b/ci/ciimage/ubuntu-rolling/install.sh index e1747034fe36..40044008638c 100755 --- a/ci/ciimage/ubuntu-rolling/install.sh +++ b/ci/ciimage/ubuntu-rolling/install.sh @@ -27,6 +27,7 @@ pkgs=( bindgen itstool openjdk-11-jre + jq ) sed -i '/^Types: deb/s/deb/deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources @@ -50,6 +51,20 @@ dub_fetch dubtestproject dub build dubtestproject:test1 --compiler=ldc2 dub build dubtestproject:test2 --compiler=ldc2 +# zig + +ZIG_DOWNLOAD_INDEX=$(wget -qO- https://ziglang.org/download/index.json) +ZIG_VERSION=$(echo "$ZIG_DOWNLOAD_INDEX" | jq -r ". | keys_unsorted | .[1]") +ZIG_ARCHIVE=$(echo "$ZIG_DOWNLOAD_INDEX" | jq -r ".[\"$ZIG_VERSION\"][\"$(uname -m)-linux\"].tarball") +ZIG_DIR=$(basename "$ZIG_ARCHIVE" | sed 's/.tar.xz//') +wget -O zig.tar.xz "$ZIG_ARCHIVE" + +tar xf zig.tar.xz +rm zig.tar.xz + +mv "$ZIG_DIR" /opt/zig +ln -s /opt/zig/zig /usr/bin/zig + # Remove debian version of Rust and install latest with rustup. # This is needed to get the cross toolchain as well. apt-get -y remove rustc || true