Skip to content

Commit

Permalink
Merge branch 'main' into fix-circuits-2
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon authored Feb 5, 2025
2 parents ee50940 + c4cde60 commit f701253
Show file tree
Hide file tree
Showing 31 changed files with 532 additions and 501 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/check-git-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ latest_release=$(
)

current_release=$(
rg 'cairo-lang-sierra\s*=\s*(?:\{\s*git\s*=\s*"https://github.com/starkware-libs/cairo",\s*tag = "(.*?)"\s*\}|"(.*?)")' sierra2mlir/Cargo.toml -r '$1$2'
rg 'cairo-lang-sierra\s*=\s*(?:\{\s*git\s*=\s*"https://github.com/starkware-libs/cairo",\s*tag = "(.*?)"\s*\}|"(.*?)")' Cargo.toml -r '$1$2'
)

current_release_line=$(echo $current_release | cut -d':' -f1)
current_release_str=$(echo $current_release | cut -d':' -f2)

# Strip `v` prefix.
$current_release_str=$(echo $current_release_str | tr -d v)
$latest_release=$(echo $latest_release | tr -d v)
current_release_str=$(echo $current_release_str | tr -d v)
latest_release=$(echo $latest_release | tr -d v)

if [ "$current_release_str" != "$latest_release" && "v$current_release_str" != "$latest_release" ]; then
echo "::warning file=sierra2mlir/Cargo.toml,line=$current_release_line,endLine=$current_release_line,title=Outdated cairo dependency::Current release = $current_release_str, Upstream release = $latest_release"
echo "::warning file=Cargo.toml,line=$current_release_line,endLine=$current_release_line,title=Outdated cairo dependency::Current release = $current_release_str, Upstream release = $latest_release"
fi
20 changes: 3 additions & 17 deletions .github/workflows/bench-hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- uses: dtolnay/[email protected].0
- uses: dtolnay/[email protected].1
with:
components: clippy
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -102,13 +102,6 @@ jobs:
path: bin/cairo-native-run-${{ matrix.branch }}
key: binary-${{ github.event.pull_request[matrix.branch].sha }}

- name: Cache runtime-library
uses: actions/cache@v3
id: cache-library
with:
path: lib/libcairo-native-runtime-${{ matrix.branch }}.a
key: library-${{ github.event.pull_request[matrix.branch].sha }}

- name: check and free hdd space left
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' }}
run: |
Expand All @@ -131,7 +124,7 @@ jobs:
df -h
- name: Install Rust
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: add llvm deb repository
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: myci-actions/add-deb-repo@11
Expand Down Expand Up @@ -159,7 +152,6 @@ jobs:
make build
mkdir lib bin
cp target/release/cairo-native-run bin/cairo-native-run-${{ matrix.branch }}
cp target/release/libcairo_native_runtime.a lib/libcairo-native-runtime-${{ matrix.branch }}.a
run-bench:
env:
Expand Down Expand Up @@ -190,12 +182,6 @@ jobs:
path: bin/cairo-native-run-${{ matrix.branch }}
key: binary-${{ github.event.pull_request[matrix.branch].sha }}

- name: Fetch ${{ matrix.branch }} runtime-library
uses: actions/cache/restore@v3
with:
path: lib/libcairo-native-runtime-${{ matrix.branch }}.a
key: library-${{ github.event.pull_request[matrix.branch].sha }}

- name: Run Program
run: |
make deps
Expand All @@ -208,7 +194,7 @@ jobs:
--export-json "${f%.*}.json" \
--warmup 3 \
-n "${{matrix.branch}} $(basename $f) (JIT)" "./bin/cairo-native-run-${{ matrix.branch }} --run-mode=jit -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "${{matrix.branch}} $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-${{ matrix.branch }}.a ./bin/cairo-native-run-${{ matrix.branch }} --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "${{matrix.branch}} $(basename $f) (AOT)" "./bin/cairo-native-run-${{ matrix.branch }} --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
>> /dev/stderr
done
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected].0
- uses: dtolnay/[email protected].1
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected].0
- uses: dtolnay/[email protected].1
with:
components: rustfmt
- run: cargo fmt --all -- --check
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
sudo rm -rf /usr/local/lib/android
df -h
- name: Setup rust env
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Rustup toolchain install
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
with:
components: clippy
- name: Rust `$PATH` workaround.
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
sudo rm -rf /usr/local/lib/android
df -h
- name: Setup rust env
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
Expand All @@ -246,8 +246,8 @@ jobs:
scarb-version: "2.9.2"
- name: Install deps
run: make deps
- name: Build runtime and alexandria
run: make runtime-ci && make check-llvm && make needs-cairo2 && make build-alexandria
- name: Build alexandria
run: make check-llvm && make needs-cairo2 && make build-alexandria

- name: Run tests and generate coverage partition ${{ matrix.partition }}
run: cargo llvm-cov nextest --verbose --features=scarb --workspace --lcov --output-path ${{ matrix.output }} --partition count:${{ matrix.partition }}/4
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
needs: [coverage]
steps:
- name: Setup rust env
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: Retreive cached dependencies
uses: Swatinem/rust-cache@v2
- name: Install testing tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
# Install dependencies
- uses: ./cairo_native/.github/actions/install-linux-deps
- name: Setup rust env
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
with:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
- name: Setup rust env
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
Expand All @@ -37,7 +37,5 @@ jobs:
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools
- name: publish the runtime
run: cargo publish --token ${CRATES_TOKEN} --all-features -p cairo-native-runtime
- name: publish the crate
run: cargo publish --token ${CRATES_TOKEN} --all-features -p cairo-native
124 changes: 46 additions & 78 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,93 +7,61 @@ permissions:
on:
push:
tags:
- "v*.*.*"
- v[0-9]+.*

jobs:
release-linux:
create-release:
runs-on: ubuntu-24.04
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- name: Checkout
uses: actions/checkout@v4
- name: free HDD space
run: |
# deleting space
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
- name: Setup rust env
uses: dtolnay/[email protected]
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@11
- uses: taiki-e/create-gh-release-action@v1
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools
- name: Install deps
run: make deps
- name: build release
run: make build
- name: Compress into a tar file
run: cd target/release && tar -cJvf ../cairo-native-x86_64.tar.xz cairo-native-test \
cairo-native-compile cairo-native-dump cairo-native-run libcairo_native_runtime.a && cd ..
- uses: actions/upload-artifact@v4
with:
name: linux-build
path: cairo-native-x86_64.tar.xz
# (Required) GitHub token for creating GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}

release-macos:
runs-on: macos-14
env:
CARGO_TERM_COLOR: always
LIBRARY_PATH: /opt/homebrew/lib
MLIR_SYS_190_PREFIX: /opt/homebrew/opt/llvm@19
LLVM_SYS_191_PREFIX: /opt/homebrew/opt/llvm@19
TABLEGEN_190_PREFIX: /opt/homebrew/opt/llvm@19
RUST_LOG: cairo_native=debug,cairo_native_test=debug
upload-assets:
needs: create-release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
- target: x86_64-apple-darwin
os: macos-14
env:
MLIR_SYS_190_PREFIX: /opt/homebrew/opt/llvm@19
LLVM_SYS_191_PREFIX: /opt/homebrew/opt/llvm@19
TABLEGEN_190_PREFIX: /opt/homebrew/opt/llvm@19
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Rustup toolchain install
uses: dtolnay/[email protected]
with:
components: clippy
- name: Rust `$PATH` workaround.
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install deps
run: make deps
- name: Build release
run: make build
- name: Compress into a tar file
run: cd target/release && tar -cJvf ../cairo-native-aarch64.tar.xz cairo-native-test \
cairo-native-compile cairo-native-dump cairo-native-run libcairo_native_runtime.a && cd ..
- uses: actions/upload-artifact@v4
with:
name: macos-build
path: cairo-native-aarch64.tar.xz

release:
runs-on: ubuntu-24.04
needs: [release-macos, release-linux]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download linux
uses: actions/download-artifact@v4
with:
name: linux-build
- name: Download macos
uses: actions/download-artifact@v4
with:
name: macos-build
- name: Release on GitHub
uses: softprops/action-gh-release@v2
# deps-ci-linux does nothing on macos so it works
run: make deps && make deps-ci-linux
- uses: taiki-e/upload-rust-binary-action@v1
with:
files: |
cairo-native-aarch64.tar.xz
cairo-native-x86_64.tar.xz
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# Note that glob pattern is not supported yet.
bin: cairo-native-compile,cairo-native-dump,cairo-native-run,cairo-native-stress,cairo-native-test
# (optional) Target triple, default is host triple.
# This is optional but it is recommended that this always be set to
# clarify which target you are building for if macOS is included in
# the matrix because GitHub Actions changed the default architecture
# of macos-latest since macos-14.
target: ${{ matrix.target }}
# (optional) On which platform to distribute the `.tar.gz` file.
# [default value: unix]
# [possible values: all, unix, windows, none]
tar: unix
# (optional) On which platform to distribute the `.zip` file.
# [default value: windows]
# [possible values: all, unix, windows, none]
zip: windows
archive: cairo-native-$target
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/rustdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected].0
- uses: dtolnay/[email protected].1
- uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@11
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/starknet-blocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
with:
repository: lambdaclass/starknet-replay
path: starknet-replay
ref: 546457d800fd02f080888331aebecc15824bed91
# We need native to build the runtime
ref: b4b7dbf1bb5313301515882d7e228616f3f70e48
# We need native to use the linux deps ci action
- name: Checkout Native
uses: actions/checkout@v4
with:
Expand All @@ -43,7 +43,7 @@ jobs:
with:
repository: lambdaclass/sequencer
path: sequencer
ref: 15d6452d162ad5e3538e673d1e4df5abcff9452f
ref: 9487df3ada00d03bbd9fc39331c4ec1ac0994954

- name: Cache RPC Calls
uses: actions/cache@v4
Expand All @@ -54,21 +54,14 @@ jobs:
# Install dependencies
- uses: ./cairo_native/.github/actions/install-linux-deps
- name: Setup rust env
uses: dtolnay/[email protected].0
uses: dtolnay/[email protected].1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
starknet-replay
cairo_native
- name: Build Cairo Native Runtime Library
shell: bash
run: |
cd ../cairo_native
make runtime
echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV
- name: Patch replay dependencies
run: |
# Updates sequencer dependency to local path
Expand Down
Loading

0 comments on commit f701253

Please sign in to comment.