Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

chore(network): move functionality into behaviour trait for testing #8550

chore(network): move functionality into behaviour trait for testing

chore(network): move functionality into behaviour trait for testing #8550

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled
- edited # for when the PR title is edited
merge_group:
types: [checks_requested]
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install commitlint
run: npm install --global @commitlint/cli @commitlint/config-conventional
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: Validate PR title with commitlint
if: github.event_name != 'merge_group' && github.event_name != 'push'
run: echo "${{ github.event.pull_request.title }}" | commitlint --verbose
executable-run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: mkdir data
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- name: Build node
run: cargo build -r
- name: Run executable
run: >
target/release/papyrus_node --base_layer.node_url ${{ secrets.CI_BASE_LAYER_NODE_URL }}
& sleep 30 ; kill $!
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: npm install -g [email protected]
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- run: |
cargo test -r
env:
SEED: 0
build-load-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build -r -p papyrus_load_test
integration-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: >
cargo test -r --test '*' -- --include-ignored --skip test_gw_integration_testnet;
cargo run -r -p papyrus_node --bin central_source_integration_test
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2023-10-19
- uses: Swatinem/rust-cache@v2
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- run: cargo +nightly-2023-10-19 fmt --all -- --check
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
name: "Rust Toolchain Setup"
with:
toolchain: nightly-2023-10-19
- uses: Swatinem/rust-cache@v2
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- name: "Download and run cargo-udeps"
run: |
wget -O - -c https://github.com/est31/cargo-udeps/releases/download/v0.1.35/cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz
cargo-udeps-*/cargo-udeps udeps
env:
RUSTUP_TOOLCHAIN: nightly-2023-10-19
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- run: >
cargo clippy --all-targets --all-features -- -D warnings -D future-incompatible
-D nonstandard-style -D rust-2018-idioms -D unused -D clippy::unwrap_used
doc:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- run: cargo doc -r --document-private-items --no-deps
check:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- run: cargo check -r --all-features
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Set-Up
run: |
sudo apt-get update
sudo apt-get install -y clang llvm libudev-dev
- run: echo "PB_REL=https://github.com/protocolbuffers/protobuf/releases" >> $GITHUB_ENV
- run: echo "PROTOC_VERSION=25.1" >> $GITHUB_ENV
- run: echo "OS=`[ "$(uname -s)" = "Darwin" ] && echo "osx" || (echo $(uname -s | tr '[:upper:]' '[:lower:]'))`" >> $GITHUB_ENV
- run: echo "ARCH=`[ "$(uname -m)" = "x86_64" ] && echo "x86_64" || ([ "$(uname -m)" = "arm64" ] && echo "aarch64")`" >> $GITHUB_ENV
- run: curl -L "$PB_REL/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-$OS-$ARCH.zip" -o protoc.zip && unzip ./protoc.zip -d $HOME/.local && rm ./protoc.zip
- run: echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- run: npm install -g [email protected]
- name: Coverage
run: cargo llvm-cov --codecov -r --output-path codecov.json
env:
SEED: 0
- name: Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
fail_ci_if_error: true
version: "v0.1.15"
check-starknet_api-dependency:
runs-on: ubuntu-latest
if: github.base_ref == 'main' # this step is only run if the pr is to the main branch
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install jq
- run: ./check_starknet_api_version_dependency.sh # this script checks that if the starknet_api dependency is by git rev then this rev (commit) is on main