Skip to content

Commit

Permalink
chore(infra): re-enable cairo native build
Browse files Browse the repository at this point in the history
  • Loading branch information
alon-dotan-starkware committed Sep 24, 2024
1 parent 7ab65e4 commit e492e26
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 41 deletions.
4 changes: 4 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[env]
LLVM_SYS_181_PREFIX="/usr/lib/llvm-18/"
MLIR_SYS_180_PREFIX="/usr/lib/llvm-18/"
TABLEGEN_180_PREFIX="/usr/lib/llvm-18/"
2 changes: 2 additions & 0 deletions .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ runs:
steps:
- name: Install rust.
uses: ./.github/actions/install_rust
- name: Install cairo native.
uses: ./.github/actions/setup_native_deps
1 change: 0 additions & 1 deletion .github/actions/install_rust/rust_version.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,8 @@ outputs:
runs:
using: "composite"
steps:
- name: Make script executable
shell: bash
run: chmod +x ./scripts/setup_native_deps.sh

- name: Install Cairo Native Runtime Dependencies
id: set-runtime-deps
shell: bash
run: |
sudo ./scripts/setup_native_deps.sh
- name: Set Environment Variables
id: set-env-vars
shell: bash
run: |
echo "MLIR_SYS_180_PREFIX=/usr/lib/llvm-18/" >> $GITHUB_ENV &&
echo "LLVM_SYS_181_PREFIX=/usr/lib/llvm-18/" >> $GITHUB_ENV &&
echo "TABLEGEN_180_PREFIX=/usr/lib/llvm-18/" >> $GITHUB_ENV
48 changes: 20 additions & 28 deletions scripts/setup_native_deps.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash

install_essential_deps_linux() {
apt-get update -y
apt-get install -y \
apt update && apt install -y \
ca-certificates \
curl \
git \
gnupg \
jq \
ripgrep \
wget \
ca-certificates \
gnupg \
git
wget
}

setup_llvm_deps() {
Expand All @@ -29,8 +28,8 @@ setup_llvm_deps() {
export TABLEGEN_180_PREFIX
;;
Linux)
export DEBIAN_FRONTEND=noninteractive
export TZ=America/New_York
export DEBIAN_FRONTEND=noninteractive
export TZ=America/New_York

CODENAME=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)
[ -z "$CODENAME" ] && { echo "Error: Unable to determine OS codename"; exit 1; }
Expand All @@ -39,31 +38,24 @@ setup_llvm_deps() {
echo "deb-src http://apt.llvm.org/$CODENAME/ llvm-toolchain-$CODENAME-18 main" >> /etc/apt/sources.list.d/llvm-18.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -

apt-get update && apt-get upgrade -y
apt-get install -y zstd
apt-get install -y llvm-18 llvm-18-dev llvm-18-runtime clang-18 clang-tools-18 lld-18 libpolly-18-dev libmlir-18-dev mlir-18-tools
apt-get install -y libgmp3-dev

MLIR_SYS_180_PREFIX=/usr/lib/llvm-18/
LLVM_SYS_181_PREFIX=/usr/lib/llvm-18/
TABLEGEN_180_PREFIX=/usr/lib/llvm-18/

export MLIR_SYS_180_PREFIX
export LLVM_SYS_181_PREFIX
export TABLEGEN_180_PREFIX
apt update && apt install -y \
clang-18 \
clang-tools-18 \
libgmp3-dev
libmlir-18-dev \
libpolly-18-dev \
lld-18 \
llvm-18 \
llvm-18-dev \
llvm-18-runtime \
mlir-18-tools \
zstd
;;
*)
echo "Error: Unsupported operating system"
exit 1
;;
esac

# GitHub Actions specific
[ -n "$GITHUB_ACTIONS" ] && {
echo "MLIR_SYS_180_PREFIX=$MLIR_SYS_180_PREFIX" >> $GITHUB_ENV
echo "LLVM_SYS_181_PREFIX=$LLVM_SYS_181_PREFIX" >> $GITHUB_ENV
echo "TABLEGEN_180_PREFIX=$TABLEGEN_180_PREFIX" >> $GITHUB_ENV
}
}

install_rust() {
Expand Down Expand Up @@ -112,4 +104,4 @@ main() {
echo "LLVM and Cairo native runtime dependencies installed successfully."
}

main "$@"
main "$@"

0 comments on commit e492e26

Please sign in to comment.