name: test-suite on: push: branches: - stable - staging - trying - 'pr/*' pull_request: merge_group: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: # Deny warnings in CI # Disable debug info (see https://github.com/sigp/lighthouse/issues/4005) RUSTFLAGS: "-D warnings -C debuginfo=0" # Prevent Github API rate limiting. # NOTE: this token is a personal access token on Jimmy's account due to the default GITHUB_TOKEN # not having access to other repositories. We should eventually devise a better solution here. LIGHTHOUSE_GITHUB_TOKEN: ${{ secrets.LIGHTHOUSE_GITHUB_TOKEN }} # Enable self-hosted runners for the sigp repo only. SELF_HOSTED_RUNNERS: ${{ github.repository == 'sigp/lighthouse' }} # Disable incremental compilation CARGO_INCREMENTAL: 0 # Enable portable to prevent issues with caching `blst` for the wrong CPU type TEST_FEATURES: portable jobs: check-labels: runs-on: ubuntu-latest name: Check for 'skip-ci' label outputs: skip_ci: ${{ steps.set-output.outputs.SKIP_CI }} steps: - name: check for skip-ci label id: set-output env: LABELS: ${{ toJson(github.event.pull_request.labels) }} run: | SKIP_CI="false" if [ -z "${LABELS}" ] || [ "${LABELS}" = "null" ]; then LABELS="none"; else LABELS=$(echo ${LABELS} | jq -r '.[].name') fi for label in ${LABELS}; do if [ "$label" = "skip-ci" ]; then SKIP_CI="true" break fi done echo "skip_ci=$SKIP_CI" >> $GITHUB_OUTPUT lockbud: name: lockbud runs-on: ubuntu-latest container: image: sigmaprime/lockbud:latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install dependencies run: apt update && apt install -y cmake libclang-dev - name: Check for deadlocks run: ./scripts/ci/check-lockbud.sh target-branch-check: name: target-branch-check runs-on: ubuntu-latest if: github.event_name == 'pull_request' || github.event_name == 'merge_group' steps: - name: Check that the pull request is not targeting the stable branch run: test ${{ github.base_ref }} != "stable" release-tests-ubuntu: name: release-tests-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' # Use self-hosted runners only on the sigp repo. runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }} steps: - uses: actions/checkout@v5 # Set Java version to 21. (required since Web3Signer 24.12.0). - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install Foundry (anvil) if: env.SELF_HOSTED_RUNNERS == 'false' uses: foundry-rs/foundry-toolchain@v1 with: version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d - name: Run tests in release run: make test-release - name: Show cache stats if: env.SELF_HOSTED_RUNNERS == 'true' continue-on-error: true run: sccache --show-stats release-tests-windows: name: release-tests-windows needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "windows", "CI"]') || 'windows-2019' }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install Foundry (anvil) if: env.SELF_HOSTED_RUNNERS == 'false' uses: foundry-rs/foundry-toolchain@v1 with: version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d - name: Install make if: env.SELF_HOSTED_RUNNERS == 'false' run: choco install -y make - name: Set LIBCLANG_PATH run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - name: Run tests in release run: make test-release - name: Show cache stats if: env.SELF_HOSTED_RUNNERS == 'true' continue-on-error: true run: sccache --show-stats beacon-chain-tests: name: beacon-chain-tests needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' # Use self-hosted runners only on the sigp repo. runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest - name: Run beacon_chain tests for all known forks run: make test-beacon-chain - name: Show cache stats if: env.SELF_HOSTED_RUNNERS == 'true' continue-on-error: true run: sccache --show-stats http-api-tests: name: http-api-tests needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' # Use self-hosted runners only on the sigp repo. runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest - name: Run http_api tests for all recent forks run: make test-http-api - name: Show cache stats if: env.SELF_HOSTED_RUNNERS == 'true' continue-on-error: true run: sccache --show-stats op-pool-tests: name: op-pool-tests needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest - name: Run operation_pool tests for all known forks run: make test-op-pool network-tests: name: network-tests needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest - name: Create CI logger dir run: mkdir ${{ runner.temp }}/network_test_logs - name: Run network tests for all known forks run: make test-network env: TEST_FEATURES: portable CI_LOGGER_DIR: ${{ runner.temp }}/network_test_logs - name: Upload logs uses: actions/upload-artifact@v4 with: name: network_test_logs path: ${{ runner.temp }}/network_test_logs slasher-tests: name: slasher-tests needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest - name: Run slasher tests for all supported backends run: make test-slasher debug-tests-ubuntu: name: debug-tests-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' # Use self-hosted runners only on the sigp repo. runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable bins: cargo-nextest - name: Install Foundry (anvil) if: env.SELF_HOSTED_RUNNERS == 'false' uses: foundry-rs/foundry-toolchain@v1 with: version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d - name: Run tests in debug run: make test-debug - name: Show cache stats if: env.SELF_HOSTED_RUNNERS == 'true' continue-on-error: true run: sccache --show-stats state-transition-vectors-ubuntu: name: state-transition-vectors-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release - name: Run state_transition_vectors in release. run: make run-state-transition-tests ef-tests-ubuntu: name: ef-tests-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' # Use self-hosted runners only on the sigp repo. runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "small"]') || 'ubuntu-latest' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-nextest - name: Run consensus-spec-tests with blst and fake_crypto run: make test-ef - name: Show cache stats if: env.SELF_HOSTED_RUNNERS == 'true' continue-on-error: true run: sccache --show-stats basic-simulator-ubuntu: name: basic-simulator-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release - name: Create log dir run: mkdir ${{ runner.temp }}/basic_simulator_logs - name: Run a basic beacon chain sim that starts from Deneb run: cargo run --release --bin simulator basic-sim --disable-stdout-logging --log-dir ${{ runner.temp }}/basic_simulator_logs - name: Upload logs uses: actions/upload-artifact@v4 with: name: basic_simulator_logs path: ${{ runner.temp }}/basic_simulator_logs fallback-simulator-ubuntu: name: fallback-simulator-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release - name: Create log dir run: mkdir ${{ runner.temp }}/fallback_simulator_logs - name: Run a beacon chain sim which tests VC fallback behaviour run: cargo run --release --bin simulator fallback-sim --disable-stdout-logging --log-dir ${{ runner.temp }}/fallback_simulator_logs - name: Upload logs uses: actions/upload-artifact@v4 with: name: fallback_simulator_logs path: ${{ runner.temp }}/fallback_simulator_logs execution-engine-integration-ubuntu: name: execution-engine-integration-ubuntu needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "small"]') || 'ubuntu-latest' }} steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust if: env.SELF_HOSTED_RUNNERS == 'false' uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release cache: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Add go compiler to $PATH if: env.SELF_HOSTED_RUNNERS == 'true' run: echo "/usr/local/go/bin" >> $GITHUB_PATH - name: Run exec engine integration tests in release run: make test-exec-engine check-code: name: check-code runs-on: ubuntu-latest env: CARGO_INCREMENTAL: 1 steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release components: rustfmt,clippy bins: cargo-audit - name: Check formatting with cargo fmt run: make cargo-fmt - name: Lint code for quality and style with Clippy run: make lint-full - name: Certify Cargo.lock freshness run: git diff --exit-code Cargo.lock - name: Typecheck benchmark code without running it run: make check-benches - name: Validate state_processing feature arbitrary-fuzz run: make arbitrary-fuzz - name: Run cargo audit run: make audit-CI - name: Run cargo vendor to make sure dependencies can be vendored for packaging, reproducibility and archival purpose run: CARGO_HOME=$(readlink -f $HOME) make vendor - name: Markdown-linter run: make mdlint - name: Spell-check uses: rojopolis/spellcheck-github-actions@v0 check-msrv: name: check-msrv runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install Rust at Minimum Supported Rust Version (MSRV) run: | metadata=$(cargo metadata --no-deps --format-version 1) msrv=$(echo $metadata | jq -r '.packages | map(select(.name == "lighthouse")) | .[0].rust_version') rustup override set $msrv - name: Run cargo check run: cargo check --workspace cargo-udeps: name: cargo-udeps needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Get latest version of nightly Rust uses: moonrepo/setup-rust@v1 with: channel: nightly bins: cargo-udeps cache: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Fetch libssl1.1 run: wget https://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb - name: Install libssl1.1 run: sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb - name: Create Cargo config dir run: mkdir -p .cargo - name: Install custom Cargo config run: cp -f .github/custom/config.toml .cargo/config.toml - name: Run cargo udeps to identify unused crates in the dependency graph run: make udeps env: # Allow warnings on Nightly RUSTFLAGS: "" compile-with-beta-compiler: name: compile-with-beta-compiler needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install dependencies run: sudo apt update && sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang - name: Use Rust beta run: rustup override set beta - name: Run make run: make cli-check: name: cli-check needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release - name: Run Makefile to trigger the bash script run: make cli-local cargo-sort: name: cargo-sort needs: [check-labels] if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Get latest version of stable Rust uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release bins: cargo-sort - name: Run cargo sort to check if Cargo.toml files are sorted run: cargo sort --check --workspace # This job succeeds ONLY IF all others succeed. It is used by the merge queue to determine whether # a PR is safe to merge. New jobs should be added here. test-suite-success: name: test-suite-success if: needs.check-labels.outputs.skip_ci != 'true' runs-on: ubuntu-latest needs: [ 'check-labels', 'target-branch-check', 'release-tests-ubuntu', 'release-tests-windows', 'beacon-chain-tests', 'op-pool-tests', 'network-tests', 'slasher-tests', 'http-api-tests', 'debug-tests-ubuntu', 'state-transition-vectors-ubuntu', 'ef-tests-ubuntu', 'basic-simulator-ubuntu', 'fallback-simulator-ubuntu', 'execution-engine-integration-ubuntu', 'check-code', 'check-msrv', 'cargo-udeps', 'compile-with-beta-compiler', 'cli-check', 'lockbud', 'cargo-sort', ] steps: - uses: actions/checkout@v5 - name: Check that success job is dependent on all others run: ./scripts/ci/check-success-job.sh ./.github/workflows/test-suite.yml test-suite-success