Skip to content

chore(consensus): fix clippy issue #21418

chore(consensus): fix clippy issue

chore(consensus): fix clippy issue #21418

Workflow file for this run

name: Main-CI-Flow
on:
push:
branches:
- main
- main-v[0-9].**
tags:
- v[0-9].**
pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled
- edited
env:
CI: 1
RUSTFLAGS: "-D warnings -C link-arg=-fuse-ld=lld"
# On PR events, cancel existing CI runs on this same PR for this workflow.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
code_style:
runs-on: starkware-ubuntu-20-04-medium
steps:
# Environment setup.
- uses: actions/checkout@v4
with:
# Fetch the entire history. Required to checkout the merge target commit, so the diff can
# be computed.
fetch-depth: 0
# 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
# Install rust components.
- uses: ./.github/actions/bootstrap
- name: Setup Python venv
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
# Check Cargo.lock is up to date.
- name: "Check Cargo.lock"
run: |
cargo update -w --locked
git diff --exit-code Cargo.lock
# Run code style on PR.
- name: "Run rustfmt pull request"
if: github.event_name == 'pull_request'
run: ci/bin/python scripts/run_tests.py --command rustfmt --changes_only --commit_id ${{ github.event.pull_request.base.sha }}
- name: "Run clippy pull request"
if: github.event_name == 'pull_request'
run: ci/bin/python scripts/run_tests.py --command clippy --changes_only --commit_id ${{ github.event.pull_request.base.sha }}
- name: "Run cargo doc pull request"
if: github.event_name == 'pull_request'
run: ci/bin/python scripts/run_tests.py --command doc --changes_only --commit_id ${{ github.event.pull_request.base.sha }}
# Run code style on push.
- name: "Run rustfmt on push"
if: github.event_name == 'push'
run: ci/bin/python scripts/run_tests.py --command rustfmt
- name: "Run clippy on push"
if: github.event_name == 'push'
run: ci/bin/python scripts/run_tests.py --command clippy
- name: "Run cargo doc on push"
if: github.event_name == 'push'
run: ci/bin/python scripts/run_tests.py --command doc
- name: "Run taplo"
run: scripts/taplo.sh
- name: Run Machete (detect unused dependencies)
uses: bnjbvr/cargo-machete@main
run-workspace-tests:
runs-on: starkware-ubuntu-latest-medium
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap
- run: cargo test -p workspace_tests
run-tests:
runs-on: starkware-ubuntu-latest-large
steps:
- uses: actions/checkout@v4
with:
# Fetch the entire history.
fetch-depth: 0
- uses: ./.github/actions/bootstrap
# 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: npm install -g ganache@7.4.3
- name: "Run tests pull request"
if: github.event_name == 'pull_request'
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
ci/bin/python scripts/run_tests.py --command test --changes_only --include_dependencies --commit_id ${{ github.event.pull_request.base.sha }}
env:
SEED: 0
- name: "Run tests on push"
if: github.event_name == 'push'
# TODO: Better support for running tests on push.
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
ci/bin/python scripts/run_tests.py --command test
env:
SEED: 0