Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Sep 29, 2024
1 parent aff6d96 commit ba4297c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 24 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
with:
repository: kkrt-labs/ef-tests
ref: feat/cairo-native
path: ef-tests # Check out to a subdirectory to avoid cleaning the kakarot-ssj directory

- name: Checkout local skip file
uses: actions/checkout@v4
Expand All @@ -99,11 +100,10 @@ jobs:
sparse-checkout-cone-mode: false
path: skip-file

- name: Replace the skip files
run: mv skip-file/blockchain-tests-skip.yml blockchain-tests-skip.yml

- name: Setup
- name: Setup ef-tests
run: |
mv skip-file/blockchain-tests-skip.yml ef-tests/blockchain-tests-skip.yml
cd ef-tests
mkdir -p build/common
make setup setup-kakarot-v0
Expand All @@ -114,44 +114,53 @@ jobs:
uses: actions/download-artifact@v3
with:
name: kakarot-ssj-build
path: ./build/v1
path: ef-tests/build/v1

- name: Move Cairo1Helpers
run: |
mv build/v1/contracts_Cairo1Helpers.compiled_contract_class.json \
build/common/cairo1_helpers.json
mv ef-tests/build/v1/contracts_Cairo1Helpers.compiled_contract_class.json \
ef-tests/build/common/cairo1_helpers.json
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10.14

# Add this step to verify the file exists
- name: Verify libcairo_native_runtime.a
run: |
echo $CAIRO_NATIVE_RUNTIME_LIBRARY
ls -l $CAIRO_NATIVE_RUNTIME_LIBRARY
- name: Run tests
working-directory: ef-tests
run: |
set -o pipefail
make ef-test-v1-native | tee data.txt
RUST_MIN_STACK=1342177280 make ef-test-v1-native | tee data.txt
set +o pipefail
- name: Retrieve ef-tests execution resources
working-directory: ef-tests
run: python scripts/compute_resources.py
env:
KAKAROT_VERSION: v1

- name: Upload resources
uses: actions/upload-artifact@v3
with:
path: resources
path: ef-tests/resources
name: resources

- name: Generate blockchain-tests-skip.yml file
if: github.event_name == 'workflow_dispatch'
working-directory: ef-tests
run: make generate-skip-file

- name: Upload skip file
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v3
with:
path: blockchain-tests-skip.yml
path: ef-tests/blockchain-tests-skip.yml
name: blockchain-tests-skip

resources:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
with:
repository: kkrt-labs/ef-tests
ref: feat/cairo-native
path: ef-tests # Check out to a subdirectory to avoid cleaning the kakarot-ssj directory
path: ef-tests # Check out to a subdirectory to avoid cleaning the kakarot-ssj directory

- name: Checkout local skip file
uses: actions/checkout@v4
Expand Down
54 changes: 41 additions & 13 deletions scripts/setup_cairo_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,30 @@ setup_llvm_deps() {
export DEBIAN_FRONTEND=noninteractive
export TZ=America/New_York

# shellcheck disable=SC2312
CODENAME=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)
[[ -z ${CODENAME} ]] && {
if [[ -z ${CODENAME} ]]; then
echo "Error: Unable to determine OS codename"
exit 1
}
fi

# shellcheck disable=SC2312
echo "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-19 main" >/etc/apt/sources.list.d/llvm-19.list
echo "deb-src http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-19 main" >>/etc/apt/sources.list.d/llvm-19.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
# shellcheck disable=SC2312
if ! wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -; then
echo "Error: Failed to add LLVM GPG key"
exit 1
fi

apt-get update && apt-get upgrade -y
apt-get install -y llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools
if ! apt-get update && apt-get upgrade -y; then
echo "Error: Failed to update and upgrade packages"
exit 1
fi
if ! apt-get install -y llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools; then
echo "Error: Failed to install LLVM packages"
exit 1
fi

MLIR_SYS_190_PREFIX=/usr/lib/llvm-19/
LLVM_SYS_191_PREFIX=/usr/lib/llvm-19/
Expand All @@ -52,6 +64,12 @@ setup_llvm_deps() {
export MLIR_SYS_190_PREFIX
export LLVM_SYS_191_PREFIX
export TABLEGEN_190_PREFIX

{
echo "MLIR_SYS_190_PREFIX=${MLIR_SYS_190_PREFIX}"
echo "LLVM_SYS_191_PREFIX=${LLVM_SYS_191_PREFIX}"
echo "TABLEGEN_190_PREFIX=${TABLEGEN_190_PREFIX}"
} >>"${GITHUB_ENV}"
;;
*)
echo "Error: Unsupported operating system"
Expand All @@ -61,9 +79,11 @@ setup_llvm_deps() {

# GitHub Actions specific
[[ -n ${GITHUB_ACTIONS} ]] && {
echo "MLIR_SYS_190_PREFIX=${MLIR_SYS_190_PREFIX}" >>"${GITHUB_ENV}"
echo "LLVM_SYS_191_PREFIX=${LLVM_SYS_191_PREFIX}" >>"${GITHUB_ENV}"
echo "TABLEGEN_190_PREFIX=${TABLEGEN_190_PREFIX}" >>"${GITHUB_ENV}"
{
echo "MLIR_SYS_190_PREFIX=${MLIR_SYS_190_PREFIX}"
echo "LLVM_SYS_191_PREFIX=${LLVM_SYS_191_PREFIX}"
echo "TABLEGEN_190_PREFIX=${TABLEGEN_190_PREFIX}"
} >>"${GITHUB_ENV}"
}
}

Expand All @@ -74,16 +94,19 @@ install_rust() {
fi

echo "cargo not found. Installing Rust..."
# shellcheck disable=SC2312
if ! curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.81.0 --no-modify-path; then
echo >&2 "Failed to install Rust. Aborting."
return 1
fi

# shellcheck disable=SC1090
source "${HOME}/.cargo/env" || {
echo >&2 "Failed to source Rust environment. Aborting."
# shellcheck disable=SC1091
if [[ -f "${HOME}/.cargo/env" ]]; then
. "${HOME}/.cargo/env"
else
echo >&2 "Failed to find Rust environment file. Aborting."
return 1
}
fi

echo "Rust installed successfully."
}
Expand All @@ -103,7 +126,11 @@ install_cairo_native_runtime() {

rm -rf ./cairo_native

CAIRO_NATIVE_RUNTIME_LIBRARY="$(pwd)/libcairo_native_runtime.a"
CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a
if [[ -z ${CAIRO_NATIVE_RUNTIME_LIBRARY} ]]; then
echo "Error: Failed to set CAIRO_NATIVE_RUNTIME_LIBRARY"
exit 1
fi
export CAIRO_NATIVE_RUNTIME_LIBRARY

echo "CAIRO_NATIVE_RUNTIME_LIBRARY=${CAIRO_NATIVE_RUNTIME_LIBRARY}"
Expand All @@ -112,6 +139,7 @@ install_cairo_native_runtime() {
}

main() {
# shellcheck disable=SC2312
[[ "$(uname)" == "Linux" ]] && install_essential_deps_linux

setup_llvm_deps
Expand Down

0 comments on commit ba4297c

Please sign in to comment.