This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
Get block hash syscall #4053
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rust-tests | |
on: | |
merge_group: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ '*' ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_TOOLCHAIN: 1.70.0 | |
CAIRO_PROGRAMS_PATH: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.sierra | |
cairo_programs/**/*.json | |
starknet_programs/**/*.casm | |
starknet_programs/**/*.sierra | |
starknet_programs/**/*.json | |
!starknet_programs/raw_contract_classes/* | |
jobs: | |
build-programs: | |
strategy: | |
matrix: | |
program-target: [ | |
compile-cairo, | |
compile-starknet, | |
compile-cairo-1-casm, | |
compile-cairo-1-sierra, | |
compile-cairo-2-casm, | |
compile-cairo-2-sierra, | |
] | |
name: Build Cairo programs | |
runs-on: ubuntu-22.04 | |
env: | |
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch from cache | |
uses: actions/cache@v3 | |
id: cache-programs | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
restore-keys: ${{ matrix.program-target }}-cache- | |
# This is not pretty, but we need `make` to see the compiled programs are | |
# actually newer than the sources, otherwise it will try to rebuild them | |
- name: Restore timestamps | |
uses: chetan/git-restore-mtime-action@v1 | |
- name: Python3 Build | |
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install deps | |
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} | |
run: make deps | |
- name: Build programs | |
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} | |
run: make -j ${{ matrix.program-target }} | |
# NOTE: used to reduce the amount of cache steps we need in later jobs | |
# TODO: remove this cache once the workflow finishes | |
merge-caches: | |
name: Merge Cairo programs cache | |
runs-on: ubuntu-22.04 | |
needs: build-programs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch from cache (compile-cairo) | |
uses: actions/cache/restore@v3 | |
id: cache-programs | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-cairo-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch from cache (compile-starknet) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-starknet-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch from cache (compile-cairo-1-casm) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-cairo-1-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch from cache (compile-cairo-1-sierra) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-cairo-1-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch from cache (compile-cairo-2-casm) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-cairo-2-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch from cache (compile-cairo-2-sierra) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch from cache (compile-cairo-2-sierra) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Merge caches | |
uses: actions/cache/save@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
build: | |
name: Build with release profile | |
needs: merge-caches | |
runs-on: ubuntu-22.04 | |
env: | |
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/ | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: add llvm deb repository | |
uses: myci-actions/add-deb-repo@10 | |
with: | |
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | |
repo-name: llvm-repo | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: Install LLVM | |
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Build | |
run: cargo build --release --workspace | |
lint: | |
name: Lint with fmt and clippy | |
needs: merge-caches | |
runs-on: ubuntu-22.04 | |
env: | |
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/ | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: add llvm deb repository | |
uses: myci-actions/add-deb-repo@10 | |
with: | |
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | |
repo-name: llvm-repo | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: Install LLVM | |
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Format | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --workspace --all-targets -- -D warnings | |
tests: | |
env: | |
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} | |
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/ | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [ test-cairo-1, test-cairo-2, test-doctests ] | |
name: Run tests | |
needs: merge-caches | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: add llvm deb repository | |
uses: myci-actions/add-deb-repo@10 | |
with: | |
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | |
repo-name: llvm-repo | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: Install LLVM | |
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Install testing tools | |
# TODO: remove `if` when nextest adds doctests support | |
if: ${{ matrix.target != 'test-doctests' }} | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- name: Run tests (${{ matrix.target }}) | |
run: make ${{ matrix.target }} | |
coverage: | |
needs: merge-caches | |
name: Generate and upload coverage report | |
runs-on: ubuntu-22.04 | |
env: | |
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: ${{ env.RUST_TOOLCHAIN }} | |
- name: add llvm deb repository | |
uses: myci-actions/add-deb-repo@10 | |
with: | |
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | |
repo-name: llvm-repo | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: Install LLVM | |
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools | |
- name: Set nightly as default | |
run: rustup default nightly | |
- name: Install testing tools | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected],cargo-llvm-cov | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Cache coverage report | |
id: restore-report | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov.info | |
key: coverage-cache-${{ github.sha }} | |
- name: Fetch programs | |
if: steps.restore-report.outputs.cache-hit != 'true' | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }} | |
fail-on-cache-miss: true | |
- name: Generate coverage report | |
if: steps.restore-report.outputs.cache-hit != 'true' | |
run: make coverage-report | |
- name: Save coverage report | |
if: steps.restore-report.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: lcov.info | |
key: coverage-cache-${{ github.sha }} | |
- name: Upload coverage to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: lcov.info |