Skip to content

feat(blockifier): recompile Cairo1 in the CI #17

feat(blockifier): recompile Cairo1 in the CI

feat(blockifier): recompile Cairo1 in the CI #17

name: Blockifier-Compiled-Cairo
on:
push:
branches:
- main
- main-v[0-9].**
tags:
- v[0-9].**
paths:
- 'crates/blockifier/feature_contracts/**'
- 'crates/blockifier/tests/**'
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- 'crates/blockifier/feature_contracts/**'
- 'crates/blockifier/tests/**'
jobs:
verify_cairo_file_dependencies:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: 'pypy3.9'
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ env.Python3_ROOT_DIR }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
# Checkout sequencer into a dedicated directory - technical requirement in order to be able to checkout `cairo` in a sibling directory.
- name: checkout sequencer into `sequencer` directory.
uses: actions/checkout@v4
with:
repository: 'starkware-libs/sequencer'
path: 'sequencer'
- name: Read Cairo1 Tag to compile contracts with from Blockifier.
id: read-tag
run: echo "TAG=$(cat sequencer/crates/blockifier/tests/cairo1_compiler_tag.txt)" >> $GITHUB_ENV
- name: Read legacy Cairo1 Tag to compile the legacy contract with.
id: read-legacy-tag
run: echo "LEGACY_TAG=$(cat sequencer/crates/blockifier/tests/legacy_cairo1_compiler_tag.txt)" >> $GITHUB_ENV
- name: checkout cairo1 repo in order to compile cairo1 contracts.
uses: actions/checkout@v4
with:
repository: 'starkware-libs/cairo'
fetch-tags: tags
ref: ${{ env.TAG }}
path: 'cairo'
- run:
cd sequencer &&
pip install -r crates/blockifier/tests/requirements.txt &&
cargo test -p blockifier --test feature_contracts_compatibility_test --features testing -- --include-ignored
# Legacy contract verification.
- name: checkout legacy tag of cairo1 repo in order to compile the legacy contract.
uses: actions/checkout@v4
with:
repository: 'starkware-libs/cairo'
fetch-tags: tags
ref: ${{ env.LEGACY_TAG }}
path: 'cairo'
- name: Verify the legacy contract.
uses: actions-rs/toolchain@master
with:
toolchain: nightly-2023-07-05
- uses: Swatinem/rust-cache@v2
- run:
cd sequencer &&
LEGACY=1 cargo test -p blockifier --test feature_contracts_compatibility_test --features testing -- --include-ignored