Skip to content

Commit

Permalink
feat(ci): make rust version in ci configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-starkware committed Aug 7, 2024
1 parent 3c970fd commit c2defd3
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 28 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/blockifier_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,37 @@ on:
- 'scripts/build_native_blockifier.sh'

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

featureless-build:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
- run: cargo build -p blockifier
- run: cargo test -p blockifier

native-blockifier-artifacts-push:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust-ubuntu-20.04"
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/blockifier_compiled_cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@ on:
- 'crates/blockifier/feature_contracts/cairo0/**'

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

verify_cairo_file_dependencies:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Noelware/[email protected]
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
Expand All @@ -41,4 +52,4 @@ jobs:

- run:
pip install -r crates/blockifier/tests/requirements.txt;
cargo test verify_feature_contracts -- --include-ignored
cargo test -p blockifier --test feature_contracts_compatibility_test --features testing -- --include-ignored
14 changes: 13 additions & 1 deletion .github/workflows/blockifier_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,25 @@ on:
- 'crates/blockifier/**'

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

coverage:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/blockifier_post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ on:
- '.github/workflows/blockifier_post-merge.yml'
- 'crates/blockifier/**'
jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

if_merged:
needs: set_rust_version
if: github.event.pull_request.merged == true
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Noelware/[email protected]
- uses: Swatinem/rust-cache@v2
with:
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/committer_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@ on:
- 'crates/committer_cli/**'

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

run-regression-tests:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-small
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2

- id: auth
Expand Down Expand Up @@ -112,10 +124,13 @@ jobs:
})
gcs-push:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2

# Commit hash on pull request event would be the head commit of the branch.
Expand Down
35 changes: 29 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ on:
- edited

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

commitlint:
runs-on: starkware-ubuntu-latest-small
steps:
Expand Down Expand Up @@ -44,7 +53,7 @@ jobs:
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
- uses: dtolnay/rust-toolchain@master # TODO(Nimrod, 15/8/2024): Use stable toolchain.
with:
components: rustfmt
toolchain: nightly-2024-04-29
Expand All @@ -54,12 +63,14 @@ jobs:
- run: scripts/rust_fmt.sh --check

clippy:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
- uses: Noelware/[email protected]
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -78,26 +89,32 @@ jobs:
- run: scripts/clippy.sh

doc:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-small
# env:
# RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo doc --workspace -r --document-private-items --no-deps

run-tests:
needs: set_rust_version
runs-on: starkware-ubuntu-20-04-medium
steps:
- uses: actions/checkout@v4
with:
# Fetch the entire history.
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Noelware/[email protected]
- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -134,10 +151,13 @@ jobs:
SEED: 0

taplo:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-small
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v3
with:
Expand All @@ -154,12 +174,15 @@ jobs:
uses: bnjbvr/cargo-machete@main

check:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-small
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
Expand Down
39 changes: 33 additions & 6 deletions .github/workflows/papyrus_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,23 @@ env:
PROTOC_VERSION: v25.1

jobs:
set_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: echo "RUST_VERSION=$(cat .github/workflows/rust_version.txt)" >> $GITHUB_OUTPUT
outputs:
rust_version: ${{ steps.version.outputs.RUST_VERSION }}

executable-run:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
Expand All @@ -57,10 +69,13 @@ jobs:
& sleep 30 ; kill $!
executable-run-no-rpc:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
Expand All @@ -76,10 +91,13 @@ jobs:
& sleep 30 ; kill $!
integration-test:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]
with:
Expand All @@ -93,10 +111,13 @@ jobs:
cargo run -r -p papyrus_node --bin central_source_integration_test --features="futures-util tokio-stream"
test-no-rpc:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
- uses: Noelware/[email protected]

Expand All @@ -106,10 +127,13 @@ jobs:
SEED: 0
codecov:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- name: Set-Up
run: |
sudo apt-get update
Expand Down Expand Up @@ -159,6 +183,7 @@ jobs:
cache-to: type=gha,mode=max,scope=buildkit-ci

random-table-test:
needs: set_rust_version
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
Expand All @@ -173,7 +198,9 @@ jobs:
filters: |
target_directory:
- 'crates/papyrus_storage/src/db/**'
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.set_rust_version.outputs.rust_version }}
- uses: Swatinem/rust-cache@v2
# repeat this job 32 times. this is a random test for part of the code that may cause a corrupted database.
- run: for run in {1..32}; do cargo test -r -p papyrus_storage -- --include-ignored common_prefix_compare_with_simple_table_random; done
Expand Down
Loading

0 comments on commit c2defd3

Please sign in to comment.