Skip to content

Feature/consensus/ breaking #5671

Feature/consensus/ breaking

Feature/consensus/ breaking #5671

Workflow file for this run

name: CI
on:
push:
branches:
- master
merge_group:
pull_request:
branches:
- "**"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CC: /usr/bin/clang
CXX: /usr/bin/clang++
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
shell: ${{ steps.filter.outputs.shell }}
proto: ${{ steps.filter.outputs.proto }}
contracts: ${{ steps.filter.outputs.contracts }}
python: ${{ steps.filter.outputs.python }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
with:
filters: |
rust:
- 'Cargo.toml'
- 'Cargo.lock'
- '**.rs'
shell:
- '**.sh'
proto:
- '**.proto'
contracts:
- 'contracts/**'
python:
- '**.py'
python-format:
name: Python Format
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2
- name: Check Python formatting
run: just check_format_py
rustfmt:
name: Rustfmt
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
with:
toolchain: nightly
components: rustfmt
install-clang: false
setup-cache: false
- name: Check formatting
run: just check_format
clippy:
name: Clippy
needs: [rustfmt, changes]
if: ${{ needs.changes.outputs.rust == 'true' }} # we duplicate it so gh actions will skip the job and mark it as success
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
with:
components: "clippy,rustfmt"
- name: Clippy check
run: just lint
test:
name: Test with codecov
runs-on: [self-hosted, linux]
needs: [rustfmt, changes]
if: ${{ needs.changes.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
with:
components: llvm-tools-preview
fake-procfs: true
- uses: taiki-e/install-action@9185c192a96ba09167ad8663015b3fbbf007ec79 # v2.56.2
with:
tool: cargo-llvm-cov,cargo-nextest
- name: Run tests
env:
RUSTC_WRAPPER: scripts/coverage.py
RUST_LOG: warn
run: just test_cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3
with:
# Dear h4xx0rz reading this,
# Feel free to use this token to upload arbitrary coverage information to codecov.
# We do not care. The best you can do is make us facepalm.
# Best,
token: 0c64952e-3aeb-4b26-8f34-22784e8149cd
files: codecov.json
fail_ci_if_error: true
test-docs:
name: Test Documentation
runs-on: [self-hosted, linux]
needs: [rustfmt, changes]
if: ${{ needs.changes.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
- name: Test documentation
run: just test_docs
integration-test:
name: Integration Test Suite
runs-on: [self-hosted, linux]
if: ${{ needs.changes.outputs.rust == 'true' }}
needs: [rustfmt, changes]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
with:
fake-procfs: true
- name: Run integration tests
env:
RUST_LOG: warn
run: just run_integration_tests
contracts-tests:
name: Contracts Tests
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.contracts == 'true' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: contracts/yarn.lock
- name: Install contracts dependencies
run: yarn install --frozen-lockfile
working-directory: contracts
- name: Run contracts tests
run: yarn test
working-directory: contracts
metrics:
name: Metrics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2
- name: Check dashboard
run: just check_dashboard
msrv:
name: Check minimum supported Rust version
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: self-hosted
needs: [changes]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
with:
install-clang: true
- uses: taiki-e/install-action@9185c192a96ba09167ad8663015b3fbbf007ec79 # v2.56.2
with:
tool: cargo-msrv
- name: Check semver
run: cargo msrv verify --manifest-path cli/Cargo.toml
check-protos:
name: Check protos
needs: [changes]
if: ${{ needs.changes.outputs.proto == 'true' }}
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
with:
install-clang: false
setup-cache: false
- name: Install protobuf
run: sudo apt update && sudo apt-get -y install protobuf-compiler
- name: Update RPC proto
run: |
just update_rpc_proto
git diff --exit-code
check-cli-reference:
name: Check CLI Reference
needs: [changes]
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/init
- name: Update CLI reference
run: |
just update_cli_reference
git diff --exit-code
ci-failure-comment:
name: CI Failure Comment
needs:
- python-format
- check-protos
- check-cli-reference
if: ${{ always() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Post combined failure comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
messages=()
if [ "${{ needs.python-format.result }}" = "failure" ]; then
messages+=($'❌ Python formatting check failed in CI.\n\nPlease run `just fmt_py` locally and push the updated files.')
fi
if [ "${{ needs.check-protos.result }}" = "failure" ]; then
messages+=($'❌ RPC proto check failed in CI.\n\nPlease run `just update_rpc_proto`, ensure `protoc` is installed, then commit the generated changes.')
fi
if [ "${{ needs.check-cli-reference.result }}" = "failure" ]; then
messages+=($'❌ CLI reference check failed in CI.\n\nPlease run `just update_cli_reference`, add the updated docs/cli-reference.md, and push the changes.')
fi
if [ ${#messages[@]} -eq 0 ]; then
echo "No tracked failures; skipping comment."
exit 0
fi
body=$(printf '%s\n\n' "${messages[@]}")
gh pr comment "$PR_NUMBER" --body "$body"