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 5, 2024
1 parent ff11dd7 commit 8044734
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 26 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/blockifier_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,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: ubuntu-20.04
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: ubuntu-20.04
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
14 changes: 13 additions & 1 deletion .github/workflows/blockifier_compiled_cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,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: ubuntu-20.04
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_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,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: ubuntu-20.04
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 @@ -7,12 +7,24 @@ on:
paths:
- '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: ubuntu-20.04
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
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: ubuntu-latest
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: ubuntu-20.04
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
33 changes: 28 additions & 5 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: ubuntu-latest
steps:
Expand Down Expand Up @@ -54,12 +63,14 @@ jobs:
- run: scripts/rust_fmt.sh --check

clippy:
needs: set_rust_version
runs-on: ubuntu-20.04
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: ubuntu-latest
# 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: ubuntu-20.04
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: ubuntu-latest
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: ubuntu-latest
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: ubuntu-latest
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: ubuntu-latest
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: ubuntu-latest
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: ubuntu-latest
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: ubuntu-latest
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: ubuntu-latest
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
14 changes: 13 additions & 1 deletion .github/workflows/papyrus_nightly-tests-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ on:
required: true

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 }}

GW-integration-test-call:
needs: set_rust_version
runs-on: ${{ inputs.os }}
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
- 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.
Expand Down
Loading

0 comments on commit 8044734

Please sign in to comment.