Skip to content

Commit

Permalink
fix conflicts and update
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Jul 16, 2024
2 parents 6003d36 + 9bfb3d4 commit 3cb0634
Show file tree
Hide file tree
Showing 123 changed files with 93,838 additions and 10,976 deletions.
4 changes: 3 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[env]
# Enforce native_blockifier linking with pypy3.9.
PYO3_PYTHON = "/usr/local/bin/pypy3.9"
# Increase Rust stack size.
# This should be large enough for `MAX_ENTRY_POINT_RECURSION_DEPTH` recursive entry point calls.
RUST_MIN_STACK = "4194304" # 4 MiB
Expand All @@ -7,7 +9,7 @@ RUST_MIN_STACK = "4194304" # 4 MiB
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
]

[target.aarch64-apple-darwin]
rustflags = [
Expand Down
112 changes: 94 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,54 @@ jobs:
run: echo "$TITLE" | commitlint --verbose

format:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
toolchain: nightly-2024-04-29
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
- run: scripts/rust_fmt.sh --check

clippy:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- 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: ${{ steps.setup-pypy.outputs.pythonLocation }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV

- run: scripts/clippy.sh

featureless-build:
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"
- run: cargo build -p blockifier
- run: cargo test -p blockifier

run-python-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -74,28 +100,78 @@ jobs:
- run: pytest scripts/merge_paths_test.py

run-tests:
runs-on: ubuntu-latest
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

- run: cargo test
- run: cargo test --features concurrency

udeps:
runs-on: ubuntu-latest
native-blockifier-artifacts-push:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
name: "Rust Toolchain Setup"
with:
toolchain: nightly-2024-01-12
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
id: "cache-cargo"
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
name: "Download and run cargo-udeps"
run: |
wget -O - -c https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar -xz
cargo-udeps-*/cargo-udeps udeps
with:
prefix-key: "v0-rust-ubuntu-20.04"

- name: Build native blockifier
run: ./build_native_blockifier.sh

# Commit hash on pull request event would be the head commit of the branch.
- name: Get commit hash prefix for PR update
if: ${{ github.event_name == 'pull_request' }}
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
run: echo "SHORT_HASH=${COMMIT_SHA:0:7}" >> $GITHUB_ENV

# On push event (to main, for example) we should take the commit post-push.
- name: Get commit hash prefix for merge
if: ${{ github.event_name != 'pull_request' }}
env:
RUSTUP_TOOLCHAIN: nightly-2024-01-12
COMMIT_SHA: ${{ github.event.after }}
run: echo "SHORT_HASH=${COMMIT_SHA:0:7}" >> $GITHUB_ENV

# Rename is required; see https://pyo3.rs/v0.19.2/building_and_distribution#manual-builds.
- name: Rename shared object
run: |
mv \
target/release/libnative_blockifier.so \
target/release/native_blockifier.pypy39-pp73-x86_64-linux-gnu.so
- name: Authenticate with GCS
uses: "google-github-actions/auth@v2"
with:
credentials_json: ${{ secrets.SA_NATIVE_BLOCKIFIER_ARTIFACTS_BUCKET_WRITER_ACCESS_KEY }}

- name: Upload binary to GCP
id: upload_file
uses: "google-github-actions/upload-cloud-storage@v2"
with:
path: "target/release/native_blockifier.pypy39-pp73-x86_64-linux-gnu.so"
destination: "native_blockifier_artifacts/${{ env.SHORT_HASH }}/release/"

# Keep the name 'udeps' to match original action name, so we don't need to define specific branch
# rules on Github for specific version branches.
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Machete (detect unused dependencies)
uses: bnjbvr/cargo-machete@main
22 changes: 14 additions & 8 deletions .github/workflows/compiled_cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,24 @@ on:

jobs:
verify_cairo_file_dependencies:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
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

- run:
pip install -r crates/blockifier/tests/requirements.txt;
cargo test verify_feature_contracts -- --include-ignored
35 changes: 24 additions & 11 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,35 @@ on: [pull_request, push]

jobs:
coverage:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
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: ${{ steps.setup-pypy.outputs.pythonLocation }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --codecov --output-path codecov.json
env:
SEED: 0
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
# - name: Generate code coverage
# run: cargo llvm-cov --codecov --output-path codecov.json
# env:
# SEED: 0
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# verbose: true
# fail_ci_if_error: true
26 changes: 16 additions & 10 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ on:
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-12
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- run:
pip install -r crates/blockifier/tests/requirements.txt;
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

- run: |
pip install -r crates/blockifier/tests/requirements.txt
cargo test -- --include-ignored
2 changes: 1 addition & 1 deletion .github/workflows/verify-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
latest_deps:
name: Latest Dependencies
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
continue-on-error: true
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Export the built artifact to allow local builds.
exports_files(["target/release/libnative_blockifier.so"])
Loading

0 comments on commit 3cb0634

Please sign in to comment.