From 2df7a43e2fd1731da3f7206500e7d421db6d46e9 Mon Sep 17 00:00:00 2001 From: enitrat Date: Fri, 6 Dec 2024 19:59:25 +0800 Subject: [PATCH] ci: add an explicit, absolute CAIRO_NATIVE_RUNTIME_PATH --- .cargo/config.toml | 9 +++++-- Makefile | 4 +-- scripts/dependencies.sh | 60 ----------------------------------------- 3 files changed, 9 insertions(+), 64 deletions(-) delete mode 100644 scripts/dependencies.sh diff --git a/.cargo/config.toml b/.cargo/config.toml index c06c6e3e..bcd6d927 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,13 @@ # Required to have the proper environment variables set to # build the starkware-libs/sequencer dependencies with Native mode. -[env] -CAIRO_NATIVE_RUNTIME_LIBRARY = "./libcairo_native_runtime.a" +# The `CAIRO_NATIVE_RUNTIME_LIBRARY` env variable must point to an _ABSOLUTE_ path where +# the `libcairo_native_runtime.a` file will be stored and found. +# +# Since the runtime is built by the blockifier crate's build script, it will be stored +# in blockifier's build directory, unless an absolute path is provided through this env variable. +# This variable must be set before running `cargo build` or `cargo test`, +# to overwrite what might be defined in a `config.toml` file. # Use `lld` for linking instead of `ld`, since we run out of memory while linking with `ld` on # 16-cores linux machines, see: diff --git a/Makefile b/Makefile index bb5445d5..a8e842a1 100644 --- a/Makefile +++ b/Makefile @@ -84,11 +84,11 @@ ef-test-v1: build # Runs ef-tests with cairo-native mode ef-test-v1-native: build - cargo test --test tests --no-fail-fast --features "v1,native,ci" -- --nocapture + CAIRO_NATIVE_RUNTIME_LIBRARY=~/.cargo/libcairo_native_runtime.a cargo test --test tests --no-fail-fast --features "v1,native,ci" -- --nocapture # Build the rust crates build: - cargo build --release + CAIRO_NATIVE_RUNTIME_LIBRARY=~/.cargo/libcairo_native_runtime.a cargo build --release # Generates a `blockchain-tests-skip.yml` at the project root, by consuming a `data.txt` file containing logs of the ran tests generate-skip-file: diff --git a/scripts/dependencies.sh b/scripts/dependencies.sh deleted file mode 100644 index 5dac7648..00000000 --- a/scripts/dependencies.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -set -e - -[[ ${UID} == "0" ]] || SUDO="sudo" - -function install_essential_deps_linux() { - $SUDO bash -c ' - apt update && apt install -y \ - ca-certificates \ - curl \ - git \ - gnupg \ - jq \ - libssl-dev \ - lsb-release \ - pkg-config \ - ripgrep \ - software-properties-common \ - zstd \ - wget \ - lld - ' -} - -function setup_llvm_deps() { - case "$(uname)" in - Darwin) - brew update - brew install llvm@19 - ;; - Linux) - $SUDO bash -c 'apt update && apt-get install -y \ - libgmp3-dev \ - llvm-19 \ - libmlir-19-dev \ - libpolly-19-dev \ - libzstd-dev \ - mlir-19-tools - ' - # Add LLVM to PATH by creating a file in profile.d - echo 'export PATH=/usr/lib/llvm-19/bin:$PATH' | $SUDO tee /etc/profile.d/llvm19.sh - $SUDO chmod +x /etc/profile.d/llvm19.sh - # Source the file immediately - source /etc/profile.d/llvm19.sh - ;; - *) - echo "Error: Unsupported operating system" - exit 1 - ;; - esac -} - -function main() { - [ "$(uname)" = "Linux" ] && install_essential_deps_linux - setup_llvm_deps - echo "LLVM dependencies installed successfully." -} - -main "$@"