diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09ecb68..2b68240 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,40 @@ env: RUST_TOOLCHAIN: "1.92" jobs: + linux-x64: + name: Linux x64 + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + # Free up disk space on Ubuntu runners + - name: Free Disk Space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN }} + profile: minimal + override: true + + - uses: swatinem/rust-cache@v2 + with: + shared-key: kingfisher-${{ runner.os }}-${{ runner.arch }} + cache-on-failure: true + + - name: Build (Makefile linux-x64) + run: make ubuntu-x64 + - name: Run tests + run: make tests + env: + CARGO_BUILD_JOBS: 1 + linux-arm64: name: Linux arm64 runs-on: ubuntu-24.04-arm diff --git a/Makefile b/Makefile index 748518a..3067d5c 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ SHELL := /usr/bin/env bash .SHELLFLAGS := -eu -o pipefail -c PROJECT_NAME := kingfisher +ZIG_VERSION ?= 0.15.1 # Determine OS and whether to use gtar on darwin OS := $(shell uname) @@ -74,7 +75,7 @@ create-dockerignore: .PHONY: setup-zig setup-zig: @command -v zig >/dev/null 2>&1 || { \ - echo "⬇️ Installing Zig 0.14.0 …"; \ + echo "⬇️ Installing Zig $(ZIG_VERSION) …"; \ if $(SUDO_CMD) apt-get update -qq && \ $(SUDO_CMD) apt-get install -y --no-install-recommends zig 2>/dev/null ; then \ echo "✓ Zig installed via apt"; \ @@ -82,13 +83,27 @@ setup-zig: echo "⚠️ Package 'zig' not in apt repos – falling back to manual install"; \ arch=$$(uname -m); \ case "$$arch" in \ - x86_64) pkg=zig-linux-x86_64-0.14.0 ;; \ - aarch64|arm64) pkg=zig-linux-aarch64-0.14.0 ;; \ + x86_64) arch_tag=x86_64 ;; \ + aarch64|arm64) arch_tag=aarch64 ;; \ *) echo "Unsupported architecture: $$arch"; exit 1 ;; \ esac; \ - curl -L -o /tmp/zig.tar.xz https://ziglang.org/download/0.14.0/$${pkg}.tar.xz; \ + url_new="https://ziglang.org/download/$(ZIG_VERSION)/zig-$${arch_tag}-linux-$(ZIG_VERSION).tar.xz"; \ + url_old="https://ziglang.org/download/$(ZIG_VERSION)/zig-linux-$${arch_tag}-$(ZIG_VERSION).tar.xz"; \ + if ! curl -fL --retry 3 --retry-delay 2 -o /tmp/zig.tar.xz "$$url_new"; then \ + echo "↩️ New Zig filename pattern failed, trying legacy pattern"; \ + curl -fL --retry 3 --retry-delay 2 -o /tmp/zig.tar.xz "$$url_old"; \ + fi; \ + xz -t /tmp/zig.tar.xz >/dev/null 2>&1 || { \ + echo "Downloaded Zig archive is invalid (not a tar.xz)."; \ + ls -lh /tmp/zig.tar.xz || true; \ + exit 1; \ + }; \ tar -C /tmp -xf /tmp/zig.tar.xz; \ - $(SUDO_CMD) mv /tmp/$${pkg} /opt/zig; \ + tar -tf /tmp/zig.tar.xz > /tmp/zig-contents.txt; \ + IFS=/ read -r zig_dir _ < /tmp/zig-contents.txt; \ + [ -n "$$zig_dir" ] || { echo "Could not determine Zig extract directory"; exit 1; }; \ + $(SUDO_CMD) rm -rf /opt/zig; \ + $(SUDO_CMD) mv "/tmp/$${zig_dir}" /opt/zig; \ $(SUDO_CMD) ln -sf /opt/zig/zig /usr/local/bin/zig; \ echo "✓ Zig installed to /usr/local/bin/zig"; \ fi; \ diff --git a/vendor/vectorscan-rs/vectorscan-rs-sys/build.rs b/vendor/vectorscan-rs/vectorscan-rs-sys/build.rs index 9708caf..24efe33 100644 --- a/vendor/vectorscan-rs/vectorscan-rs-sys/build.rs +++ b/vendor/vectorscan-rs/vectorscan-rs-sys/build.rs @@ -262,6 +262,16 @@ fn main() { .define("BUILD_SVE2_BITPERM", "OFF"); } + // Under cargo-zigbuild for x86_64-unknown-linux-musl, Vectorscan's + // configure-time probes can incorrectly miss posix_memalign/unistd. + // Scope this workaround to musl targets only to avoid impacting + // unrelated native dependencies. + let target = env("TARGET"); + if target.ends_with("-musl") { + cfg.define("HAVE_UNISTD_H", "1") + .define("HAVE_POSIX_MEMALIGN", "1"); + } + let dst = cfg.build(); println!("cargo:rustc-link-lib=static=hs"); println!("cargo:rustc-link-search={}", dst.join("lib").display());