Skip to content

Commit

Permalink
Merge branch 'main' into noa/cherry_pick_add_native_dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-pino committed Sep 23, 2024
2 parents 0b4eb09 + 5e2e6db commit 1748c1a
Show file tree
Hide file tree
Showing 181 changed files with 2,347 additions and 17,824 deletions.
25 changes: 1 addition & 24 deletions .github/actions/install_rust/action.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
# Installs rust toolchain with the version defined in .github/actions/install_rust/rust_version.txt.
inputs:
components:
description: "Optional: which additional components to install."
required: false
type: string
default: ''

runs:
using: "composite"
steps:
- name: Define toolchain
run: echo "DEFAULT_TOOLCHAIN=$(cat .github/actions/install_rust/rust_version.txt)" >> $GITHUB_ENV
shell: bash

- name: install rust toolchain with given components
if: "${{ inputs.components != '' }}"
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.DEFAULT_TOOLCHAIN }}
components: ${{ inputs.components }}

- name: install rust toolchain without given components
if: "${{ inputs.components == '' }}"
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.DEFAULT_TOOLCHAIN }}
- uses: moonrepo/setup-rust@v1
20 changes: 10 additions & 10 deletions .github/workflows/blockifier_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ on:
paths:
# Other than code-related changes, all changes related to the native-blockifier build-and-push
# process should trigger the build (e.g., changes to the Dockerfile, build scripts, etc.).
- '.github/workflows/blockifier_ci.yml'
- 'build_native_in_docker.sh'
- 'Cargo.lock'
- 'Cargo.toml'
- 'crates/blockifier/**'
- 'crates/native_blockifier/**'
- 'scripts/build_native_blockifier.sh'
- 'scripts/install_build_tools.sh'
- 'scripts/sequencer-ci.Dockerfile'
- ".github/workflows/blockifier_ci.yml"
- "build_native_in_docker.sh"
- "Cargo.lock"
- "Cargo.toml"
- "crates/blockifier/**"
- "crates/native_blockifier/**"
- "scripts/build_native_blockifier.sh"
- "scripts/install_build_tools.sh"
- "scripts/sequencer-ci.Dockerfile"

# On PR events, cancel existing CI runs on this same PR for this workflow.
concurrency:
Expand All @@ -56,7 +56,7 @@ jobs:
runs-on: starkware-ubuntu-latest-large
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- name: Build native blockifier
run: ./build_native_in_docker.sh scripts/build_native_blockifier.sh

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/blockifier_compiled_cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"

- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/blockifier_post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Noelware/setup-protoc@1.1.0
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"

- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/committer_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2

- id: auth
uses: "google-github-actions/auth@v2"
Expand All @@ -63,7 +62,6 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: Swatinem/rust-cache@v2

# Download the old benchmark inputs.
- id: auth
Expand Down Expand Up @@ -127,7 +125,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2

# Commit hash on pull request event would be the head commit of the branch.
- name: Get commit hash prefix for PR update
Expand Down
91 changes: 26 additions & 65 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,17 @@ jobs:
TITLE: ${{ github.event.pull_request.title }}
run: echo "$TITLE" | commitlint --verbose

format:
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master # TODO(Nimrod, 15/8/2024): Use stable toolchain.
with:
components: rustfmt
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:
code_style:
runs-on: starkware-ubuntu-20-04-medium
steps:
# Enviorment setup.
- uses: actions/checkout@v4
- uses: Noelware/setup-protoc@1.1.0
- uses: ./.github/actions/install_rust
- uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
version: "0.9.0"
locked: true
components: clippy

- name: Set up Native Dependencies
Expand All @@ -85,24 +76,36 @@ jobs:
LD_LIBRARY_PATH: ${{ steps.setup-pypy.outputs.pythonLocation }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV

- run: scripts/clippy.sh

doc:
runs-on: starkware-ubuntu-latest-small
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
# Install rust components.
- uses: ./.github/actions/install_rust

# Install LLVM and Native Runtime
- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
id: native-deps

- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo doc --workspace -r --document-private-items --no-deps

# Run tests.
- name: "Run rustfmt and clippy"
run: scripts/rust_fmt.sh --check
- name: "Run clippy"
run: scripts/clippy.sh
- name: "Run cargo doc"
run: cargo doc --workspace -r --document-private-items --no-deps
- name: "Run taplo"
run: scripts/taplo.sh
- name: "Run cargo check"
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo check --workspace -r --all-features
- name: Run Machete (detect unused dependencies)
uses: bnjbvr/cargo-machete@main

run-workspace-tests:
runs-on: starkware-ubuntu-latest-small
steps:
Expand All @@ -126,9 +129,6 @@ jobs:
uses: ./.github/actions/setup-native-deps
id: native-deps
- uses: Noelware/setup-protoc@1.1.0
- 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
Expand Down Expand Up @@ -158,42 +158,6 @@ jobs:
env:
SEED: 0

taplo:
runs-on: starkware-ubuntu-latest-small
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
version: "0.9.0"
locked: true
- run: scripts/taplo.sh

machete:
runs-on: starkware-ubuntu-latest-small
steps:
- uses: actions/checkout@v4
- name: Run Machete (detect unused dependencies)
uses: bnjbvr/cargo-machete@main

check:
runs-on: starkware-ubuntu-latest-small
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
id: native-deps
- run: cargo check --workspace -r --all-features

merge-gatekeeper:
runs-on: starkware-ubuntu-latest-small
# Restrict permissions of the GITHUB_TOKEN.
Expand Down Expand Up @@ -242,9 +206,6 @@ jobs:

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
- run: npm install -g ganache@7.4.3

# Setup pypy and link to the location expected by .cargo/config.toml.
Expand Down
69 changes: 18 additions & 51 deletions .github/workflows/papyrus_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Papyrus-CI

on:
push:
branches: [ main ]
branches: [main]
paths:
- '.github/workflows/papyrus_ci.yml'
- 'Dockerfile'
- 'papyrus_utilities.Dockerfile'
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/papyrus**/**'
- 'crates/sequencing/**'
- 'crates/starknet_client/**'
- ".github/workflows/papyrus_ci.yml"
- "Dockerfile"
- "papyrus_utilities.Dockerfile"
- "Cargo.toml"
- "Cargo.lock"
- "crates/papyrus**/**"
- "crates/sequencing/**"
- "crates/starknet_client/**"

pull_request:
types:
Expand All @@ -21,17 +21,17 @@ on:
- auto_merge_enabled
- edited # for when the PR title is edited
paths:
- '.github/workflows/papyrus_ci.yml'
- 'Dockerfile'
- 'papyrus_utilities.Dockerfile'
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/papyrus**/**'
- 'crates/sequencing/**'
- 'crates/starknet_client/**'
- ".github/workflows/papyrus_ci.yml"
- "Dockerfile"
- "papyrus_utilities.Dockerfile"
- "Cargo.toml"
- "Cargo.lock"
- "crates/papyrus**/**"
- "crates/sequencing/**"
- "crates/starknet_client/**"

merge_group:
types: [ checks_requested ]
types: [checks_requested]

# On PR events, cancel existing CI runs on this same PR for this workflow.
concurrency:
Expand Down Expand Up @@ -112,7 +112,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
Expand All @@ -132,7 +131,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
Expand All @@ -143,37 +141,6 @@ jobs:
env:
SEED: 0
codecov:
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- name: Set-Up
run: |
sudo apt-get update
sudo apt-get install -y clang llvm libudev-dev
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
id: native-deps
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- run: npm install -g ganache
- name: Coverage
run: cargo llvm-cov --codecov -r --output-path codecov.json
env:
SEED: 0
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: true
version: "v0.1.15"

check-starknet_api-dependency:
runs-on: starkware-ubuntu-latest-small
if: github.base_ref == 'main' # this step is only run if the pr is to the main branch
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/papyrus_nightly-tests-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
<<<<<<< HEAD
- name: Set up Native Dependencies
uses: ./.github/actions/setup-native-deps
id: native-deps
- uses: Swatinem/rust-cache@v2
=======
>>>>>>> main
- run: sudo apt update; sudo apt -y install libclang-dev
# Install libclang-dev that is not a part of the ubuntu vm in github actions.
if: runner.os == 'Linux'
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/papyrus_nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Papyrus-Nightly-Tests
# We run gateway_integration_test at different times, to avoid a nonce race between parallel runs.
on:
schedule:
- cron: '30 22 * * *' # Uses ubuntu runner.
- cron: '30 0 * * *' # Uses macos runner.
workflow_dispatch: # Uses ubuntu runner.
- cron: "30 22 * * *" # Uses ubuntu runner.
- cron: "30 0 * * *" # Uses macos runner.
workflow_dispatch: # Uses ubuntu runner.

env:
PROTOC_VERSION: 25 # homebrew doesn't support minor versions
Expand Down Expand Up @@ -38,7 +38,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2

- run: mkdir data

Expand Down
Loading

0 comments on commit 1748c1a

Please sign in to comment.