From 6e0cf0f33a03ef8066abb6f2a8effc549b05ecf1 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sun, 5 Nov 2023 00:22:27 +0100 Subject: [PATCH] ci: chores (#5280) --- .github/SANITY_DEPS_ISSUE_TEMPLATE.md | 11 --- .github/scripts/compare_iai.sh | 11 ++- .github/scripts/fuzz.sh | 20 ----- .github/scripts/install_geth.sh | 23 +++++ .github/workflows/bench.yml | 30 ++----- .github/workflows/book.yml | 11 +-- .github/workflows/deny.yml | 5 +- .github/workflows/dependencies.yml | 4 +- .github/workflows/docker.yml | 16 ++-- .github/workflows/fuzz.yml | 61 ------------- .github/workflows/hive.yml | 48 +++++++--- .github/workflows/integration.yml | 60 ++++--------- .github/workflows/{ci.yml => lint.yml} | 21 ++--- .github/workflows/release.yml | 116 ++++++++----------------- .github/workflows/sanity.yml | 79 +++-------------- .github/workflows/stale.yml | 3 + .github/workflows/unit.yml | 71 +++++++-------- 17 files changed, 199 insertions(+), 391 deletions(-) delete mode 100644 .github/SANITY_DEPS_ISSUE_TEMPLATE.md delete mode 100755 .github/scripts/fuzz.sh create mode 100755 .github/scripts/install_geth.sh delete mode 100644 .github/workflows/fuzz.yml rename .github/workflows/{ci.yml => lint.yml} (84%) diff --git a/.github/SANITY_DEPS_ISSUE_TEMPLATE.md b/.github/SANITY_DEPS_ISSUE_TEMPLATE.md deleted file mode 100644 index 016b010f4be7..000000000000 --- a/.github/SANITY_DEPS_ISSUE_TEMPLATE.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "bug: deps sanity check failed" -labels: P-high, C-bug, A-dependencies ---- - -Something broke our version constraints in a `Cargo.toml`. - -Check the [dependencies sanity check]({{env.WORKFLOW_URL}}) workflow for details. - -This issue was raised by the workflow at `.github/workflows/sanity.yml` - diff --git a/.github/scripts/compare_iai.sh b/.github/scripts/compare_iai.sh index 733453d73f11..7e0d7139ec87 100755 --- a/.github/scripts/compare_iai.sh +++ b/.github/scripts/compare_iai.sh @@ -1,6 +1,11 @@ -#!/bin/bash +#!/usr/bin/env bash # This script should be run on the main branch, after running the iai benchmarks on the target branch. +# If the main branch has a better iai performance, exits in error. +# It ignores L2 differences, since they seem hard to stabilize across runs. -# If the main branch has a better iai performance, exits in error. It ignores L2 differences, since they seem hard to stabilize across runs. -cargo bench --package reth-db --bench iai --manifest-path pr/Cargo.toml | tee /dev/tty | awk '/((L1)|(Ins)|(RAM)|(Est))+.*\(\+[1-9]+[0-9]*\..*%\)/{f=1} END{exit f}' \ No newline at end of file +set -eo pipefail + +cargo bench --package reth-db --bench iai --manifest-path pr/Cargo.toml \ + | tee /dev/tty \ + | awk '/((L1)|(Ins)|(RAM)|(Est))+.*\(\+[1-9]+[0-9]*\..*%\)/{f=1} END{exit f}' diff --git a/.github/scripts/fuzz.sh b/.github/scripts/fuzz.sh deleted file mode 100755 index a53095652569..000000000000 --- a/.github/scripts/fuzz.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -e -# Runs fuzz tests using `cargo test-fuzz`. - -PACKAGE=$1 -TEST_TIME=${2:-5} - -echo Building corpus. -cargo test -p $PACKAGE - -# Gets the list of tests present in the package. -TESTS=$(cargo test-fuzz --list -p $PACKAGE | head -n -3 | tail -n+9 | cat - <(echo \"--list\"]) | cat - | jq -r ".[]") - -for test in $TESTS -do - echo Running test: $test - set -x - cargo test-fuzz --no-ui --exact -p "$PACKAGE" $test -- -V $TEST_TIME - set +x -done; \ No newline at end of file diff --git a/.github/scripts/install_geth.sh b/.github/scripts/install_geth.sh new file mode 100755 index 000000000000..8469f5a73f8e --- /dev/null +++ b/.github/scripts/install_geth.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Installs Geth (https://geth.ethereum.org) in $HOME/bin for x86_64 Linux. + +set -eo pipefail + +GETH_BUILD=${GETH_BUILD:-"1.13.4-3f907d6a"} + +name="geth-linux-amd64-$GETH_BUILD" + +mkdir -p "$HOME/bin" +wget "https://gethstore.blob.core.windows.net/builds/$name.tar.gz" +tar -xvf "$name.tar.gz" +rm "$name.tar.gz" +mv "$name/geth" "$HOME/bin/geth" +rm -rf "$name" +chmod +x "$HOME/bin/geth" + +# Add $HOME/bin to $PATH +[[ "$PATH" != *$HOME/bin* ]] && export PATH=$HOME/bin:$PATH +[ -n "$CI" ] && echo "$HOME/bin" >> "$GITHUB_PATH" + +geth version diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index ddad7d5781b0..33dbe188c11c 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -1,3 +1,5 @@ +# Runs benchmarks. + on: pull_request: merge_group: @@ -20,49 +22,31 @@ jobs: if: github.event_name != 'pull_request' steps: - name: Checkout main sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: main path: main - - name: Checkout PR sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: clean: false path: pr - - name: Install Valgrind - run: | - sudo apt update && sudo apt install valgrind - - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - + run: sudo apt update && sudo apt install valgrind + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: workspaces: | main -> target pr -> target cache-on-failure: true - - name: Generate test vectors run: | cargo run --bin reth --manifest-path main/Cargo.toml -- test-vectors tables cp -r testdata main mv testdata pr - - name: Set main baseline run: cargo bench --package reth-db --bench iai --features test-utils --manifest-path main/Cargo.toml - - name: Compare PR benchmark shell: 'script -q -e -c "bash {0}"' # required to workaround /dev/tty not being available - run: | - ./pr/.github/scripts/compare_iai.sh - - bench-success: - if: always() - name: bench success - runs-on: ubuntu-latest - steps: - # Note: This check is a dummy because we don't have any bench checks enabled. - - run: echo OK. + run: pr/.github/scripts/compare_iai.sh diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 4ff06ec7b34c..d38b41fcf1c1 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -1,4 +1,7 @@ +# Documentation and mdbook related jobs. + name: book + on: push: branches: [main] @@ -13,7 +16,7 @@ jobs: timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install mdbook run: | @@ -36,7 +39,7 @@ jobs: timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install mdbook-linkcheck run: | @@ -53,10 +56,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly-2023-10-29 - name: Install mdbook run: | mkdir mdbook diff --git a/.github/workflows/deny.yml b/.github/workflows/deny.yml index f4ee00981068..519b1bf38abe 100644 --- a/.github/workflows/deny.yml +++ b/.github/workflows/deny.yml @@ -1,3 +1,5 @@ +# Runs `cargo-deny` when modifying `Cargo.lock`. + name: deny on: @@ -10,7 +12,6 @@ on: merge_group: env: - RUSTFLAGS: -D warnings CARGO_TERM_COLOR: always concurrency: deny-${{ github.head_ref || github.run_id }} @@ -20,7 +21,7 @@ jobs: name: deny runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v1 with: command: check all diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index e731a7a56923..6471e33546b9 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -1,4 +1,4 @@ -# Automatically run `cargo update` periodically +# Runs `cargo update` periodically. name: Update Dependencies @@ -31,7 +31,7 @@ jobs: name: Update runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - name: cargo update diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 476d9c821005..05cba3e211bc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,3 +1,5 @@ +# Publishes the Docker image. + name: docker on: @@ -21,24 +23,18 @@ jobs: packages: write contents: read steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - + - uses: taiki-e/install-action@cross - name: Log in to Docker run: | echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username ${DOCKER_USERNAME} --password-stdin - - name: Set up Docker builder run: | docker run --privileged --rm tonistiigi/binfmt --install arm64,amd64 docker buildx create --use --name cross-builder - - name: Build and push image - run: | - cargo install cross - env PROFILE=maxperf make docker-build-latest + run: make PROFILE=maxperf docker-build-latest diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml deleted file mode 100644 index 5bb9088b984e..000000000000 --- a/.github/workflows/fuzz.yml +++ /dev/null @@ -1,61 +0,0 @@ -on: - pull_request: - merge_group: - push: - branches: [main] - -env: - CARGO_TERM_COLOR: always - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -name: fuzz -jobs: - all: - # Skip the Fuzzing Jobs until we make them run fast and reliably. Currently they will - # always recompile the codebase for each test and that takes way too long. - if: false - runs-on: - group: Reth - strategy: - matrix: - target: - - reth-primitives - - reth-db - - reth-eth-wire - - reth-codecs - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - - name: Install fuzzer - uses: actions-rs/cargo@v1 - with: - command: install - args: cargo-test-fuzz cargo-afl - - - name: Run fuzz tests - run: | - ./.github/scripts/fuzz.sh ${{ matrix.target }} - env: - AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES: 1 - - fuzz-success: - if: always() - name: fuzz success - runs-on: ubuntu-latest - needs: all - steps: - # Note: This check is a dummy because we currently have fuzz tests disabled. - - run: echo OK. - #- name: Decide whether the needed jobs succeeded or failed - # uses: re-actors/alls-green@release/v1 - # with: - # jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/hive.yml b/.github/workflows/hive.yml index 1abe4ed46d73..4404c0c2eb8c 100644 --- a/.github/workflows/hive.yml +++ b/.github/workflows/hive.yml @@ -1,7 +1,11 @@ +# Runs `ethereum/hive` tests. + +name: hive + on: schedule: # every day - - cron: '0 0 * * *' + - cron: "0 0 * * *" env: CARGO_TERM_COLOR: always @@ -10,16 +14,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -name: hive jobs: prepare: runs-on: group: Reth steps: - - name: Checkout sources - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: mkdir artifacts - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build and export reth image @@ -33,7 +34,7 @@ jobs: cache-to: type=gha,mode=max - name: Checkout hive tests - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ethereum/hive ref: master @@ -41,7 +42,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: '^1.13.1' + go-version: "^1.13.1" - run: go version - name: Build hive tool run: | @@ -55,7 +56,6 @@ jobs: name: artifacts path: ./artifacts - test: continue-on-error: ${{ matrix.experimental }} strategy: @@ -71,7 +71,17 @@ jobs: # we have excluded these tests because we do not support block # announcements # exclude: [TestLargeAnnounce, TestBroadcast, TestBlockHashAnnounce] - include: [TestStatus, TestGetBlockHeaders, TestSimultaneousRequests, TestSameRequestID, TestZeroRequestID, TestGetBlockBodies, TestMaliciousHandshake, TestMaliciousStatus, TestTransaction, TestMaliciousTx] + include: + - TestStatus + - TestGetBlockHeaders + - TestSimultaneousRequests + - TestSameRequestID + - TestZeroRequestID + - TestGetBlockBodies + - TestMaliciousHandshake + - TestMaliciousStatus + - TestTransaction + - TestMaliciousTx experimental: true - sim: ethereum/engine limit: engine-exchange-capabilities @@ -93,7 +103,23 @@ jobs: experimental: true # eth_ rpc methods - sim: ethereum/rpc-compat - include: [eth_blockNumber, eth_call, eth_chainId, eth_createAccessList, eth_estimateGas, eth_feeHistory, eth_getBalance, eth_getBlockBy, eth_getBlockTransactionCountBy, eth_getCode, eth_getStorage, eth_getTransactionBy, eth_getTransactionCount, eth_getTransactionReceipt, eth_sendRawTransaction, eth_syncing] + include: + - eth_blockNumber + - eth_call + - eth_chainId + - eth_createAccessList + - eth_estimateGas + - eth_feeHistory + - eth_getBalance + - eth_getBlockBy + - eth_getBlockTransactionCountBy + - eth_getCode + - eth_getStorage + - eth_getTransactionBy + - eth_getTransactionCount + - eth_getTransactionReceipt + - eth_sendRawTransaction + - eth_syncing experimental: true # not running eth_getProof tests because we do not support # eth_getProof yet @@ -175,7 +201,7 @@ jobs: chmod +x /usr/local/bin/hive - name: Checkout hive tests - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ethereum/hive ref: master diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 63eee472b367..2a7063826e77 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,3 +1,7 @@ +# Runs integration tests. + +name: integration + on: pull_request: merge_group: @@ -6,17 +10,15 @@ on: env: CARGO_TERM_COLOR: always - GETH_BUILD: 1.13.4-3f907d6a SEED: rustethereumethereumrust concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -name: integration jobs: test: - name: test (partition ${{ matrix.partition }}/${{ strategy.job-total }}) + name: test (${{ matrix.partition }}/${{ strategy.job-total }}) runs-on: group: Reth strategy: @@ -24,29 +26,14 @@ jobs: partition: [1, 2] timeout-minutes: 60 steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Install Geth + run: .github/scripts/install_geth.sh + - uses: taiki-e/install-action@nextest - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - - name: Install geth - run: | - mkdir -p "$HOME/bin" - wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-$GETH_BUILD.tar.gz - tar -xvf geth-linux-amd64-$GETH_BUILD.tar.gz - rm geth-linux-amd64-$GETH_BUILD.tar.gz - mv geth-linux-amd64-$GETH_BUILD/geth $HOME/bin/geth - chmod u+x "$HOME/bin/geth" - export PATH=$HOME/bin:$PATH - echo $HOME/bin >> $GITHUB_PATH - geth version - - - name: Install latest nextest release - uses: taiki-e/install-action@nextest - - name: Run tests run: | cargo nextest run \ @@ -64,39 +51,30 @@ jobs: RUST_LOG: info,sync=error timeout-minutes: 60 steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - - name: Run sync (${{ matrix.profile }}) + - name: Run sync run: | cargo run --profile release --features jemalloc,min-error-logs \ --bin reth -- node \ --debug.tip 0x91c90676cab257a59cd956d7cb0bceb9b1a71d79755c23c7277a0697ccfaf8c4 \ --debug.max-block 100000 \ --debug.terminate - - name: Verify the target block hash run: | - cargo run --profile release \ - db get CanonicalHeaders 100000 | grep 0x91c90676cab257a59cd956d7cb0bceb9b1a71d79755c23c7277a0697ccfaf8c4 + cargo run --profile release -- \ + db get CanonicalHeaders 100000 \ + | grep 0x91c90676cab257a59cd956d7cb0bceb9b1a71d79755c23c7277a0697ccfaf8c4 integration-success: - if: always() name: integration success - runs-on: - group: Reth + runs-on: ubuntu-latest + if: always() needs: [test] - timeout-minutes: 60 + timeout-minutes: 30 steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/lint.yml similarity index 84% rename from .github/workflows/ci.yml rename to .github/workflows/lint.yml index 3e109e6ee780..458d95c52ad1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/lint.yml @@ -1,3 +1,5 @@ +name: lint + on: pull_request: merge_group: @@ -7,14 +9,13 @@ on: env: CARGO_TERM_COLOR: always -name: ci jobs: clippy: name: clippy runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@clippy with: toolchain: nightly-2023-10-29 @@ -30,10 +31,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly-2023-10-29 - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true @@ -50,29 +49,27 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly-2023-10-29 components: rustfmt - run: cargo fmt --all --check - grafana-lint: - name: grafana lint + grafana: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check dashboard JSON with jq uses: sergeysova/jq-action@v2 with: cmd: jq empty etc/grafana/dashboards/overview.json lint-success: - if: always() name: lint success runs-on: ubuntu-latest - needs: [clippy, docs, fmt, grafana-lint] + if: always() + needs: [clippy, docs, fmt, grafana] timeout-minutes: 30 steps: - name: Decide whether the needed jobs succeeded or failed diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4168c30a1ae3..7dd8e1fbdbda 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,5 @@ -# This workflow is borrowed from Lighthouse: https://github.com/sigp/lighthouse/blob/693886b94176faa4cb450f024696cb69cda2fe58/.github/workflows/release.yml +# This workflow is modified from Lighthouse: +# https://github.com/sigp/lighthouse/blob/441fc1691b69f9edc4bbdc6665f3efab16265c9b/.github/workflows/release.yml name: release @@ -25,80 +26,49 @@ jobs: build: name: build release + runs-on: ${{ matrix.os }} + needs: extract-version strategy: matrix: - arch: - [ - aarch64-unknown-linux-gnu, - x86_64-unknown-linux-gnu, - x86_64-apple-darwin, - aarch64-apple-darwin, - x86_64-pc-windows-gnu, - ] include: - - arch: aarch64-unknown-linux-gnu - platform: ubuntu-20.04 + - target: aarch64-unknown-linux-gnu + os: ubuntu-20.04 profile: maxperf - - arch: x86_64-unknown-linux-gnu - platform: ubuntu-20.04 + - target: x86_64-unknown-linux-gnu + os: ubuntu-20.04 profile: maxperf - - arch: x86_64-apple-darwin - platform: macos-latest + - target: x86_64-apple-darwin + os: macos-latest profile: maxperf - - arch: aarch64-apple-darwin - platform: macos-latest + - target: aarch64-apple-darwin + os: macos-latest profile: maxperf - - arch: x86_64-pc-windows-gnu - platform: ubuntu-20.04 + - target: x86_64-pc-windows-gnu + os: ubuntu-20.04 profile: maxperf - - runs-on: ${{ matrix.platform }} - needs: extract-version steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Get latest version of stable Rust - run: rustup update stable - - name: Install target - run: rustup target add ${{ matrix.arch }} + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: ${{ matrix.target }} + - uses: taiki-e/install-action@cross - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - # ============================== - # Apple M1 SDK setup - # ============================== - - name: Apple M1 setup - if: ${{ matrix.job.target == 'aarch64-apple-darwin' }} + if: matrix.target == 'aarch64-apple-darwin' run: | echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV - echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV - - # ============================== - # Builds - # ============================== - - - name: Build reth for ${{ matrix.arch }} - run: | - cargo install cross - env PROFILE=${{ matrix.profile }} make build-${{ matrix.arch }} + echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-os-version)" >> $GITHUB_ENV - - name: Move cross-compiled binary - if: matrix.arch != 'x86_64-pc-windows-gnu' + - name: Build Reth + run: make PROFILE=${{ matrix.profile }} build-${{ matrix.target }} + - name: Move binary run: | mkdir artifacts - mv target/${{ matrix.arch }}/${{ matrix.profile }}/reth ./artifacts - - - name: Move cross-compiled binary (Windows) - if: matrix.arch == 'x86_64-pc-windows-gnu' - run: | - mkdir artifacts - mv target/${{ matrix.arch }}/${{ matrix.profile }}/reth.exe ./artifacts - - # ============================== - # Signing - # ============================== + [[ "${{ matrix.target }}" == *windows* ]] && ext=".exe" + mv "target/${{ matrix.target }}/${{ matrix.profile }}/reth${ext}" ./artifacts - name: Configure GPG and create artifacts env: @@ -108,26 +78,22 @@ jobs: export GPG_TTY=$(tty) echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --batch --import cd artifacts - tar -czf reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz reth* - echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz + tar -czf reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz reth* + echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz mv *tar.gz* .. shell: bash - # ======================================================================= - # Upload artifacts - # This is required to share artifacts between different jobs - # ======================================================================= - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz - path: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz + name: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz + path: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz - name: Upload signature uses: actions/upload-artifact@v3 with: - name: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc - path: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc + name: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz.asc + path: reth-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.target }}.tar.gz.asc draft-release: name: draft release @@ -139,35 +105,25 @@ jobs: # Required to post the release contents: write steps: - # This is necessary for generating the changelog. It has to come before "Download Artifacts" or else it deletes the artifacts. - - name: Checkout sources - uses: actions/checkout@v3 + # This is necessary for generating the changelog. + # It has to come before "Download Artifacts" or else it deletes the artifacts. + - uses: actions/checkout@v4 with: fetch-depth: 0 - - # ============================== - # Download artifacts - # ============================== - name: Download artifacts uses: actions/download-artifact@v3 - - # ============================== - # Create release draft - # ============================== - name: Generate full changelog id: changelog run: | echo "CHANGELOG<> $GITHUB_OUTPUT echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Create release draft env: GITHUB_USER: ${{ github.repository_owner }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # The formatting here is borrowed from Lighthouse (which is borrowed from OpenEthereum): - # https://github.com/openethereum/openethereum/blob/main/.github/workflows/build.yml + # https://github.com/openethereum/openethereum/blob/6c2d392d867b058ff867c4373e40850ca3f96969/.github/workflows/build.yml run: | body=$(cat <<- "ENDBODY" diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index b2c4361a3a90..e2356af71cee 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -1,88 +1,31 @@ # Runs a series of sanity checks for crate consumers. -# -# Currently the only check is that the version constraints in each `Cargo.toml` do not lead to a breaking dependency. + +name: sanity + on: workflow_dispatch: {} # Once per day at 00:00 UTC schedule: - - cron: '0 0 * * *' + - cron: "0 0 * * *" env: - RUSTFLAGS: -D warnings CARGO_TERM_COLOR: always - GETH_BUILD: 1.13.4-3f907d6a -name: sanity jobs: - dep-version-constraints: + unused-dependencies: runs-on: ubuntu-latest - name: dep version constraints test (partition ${{ matrix.partition }}/${{ strategy.job-total }}) - strategy: - matrix: - partition: [1, 2, 3] steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - - name: Install geth - run: | - mkdir -p "$HOME/bin" - wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-$GETH_BUILD.tar.gz - tar -xvf geth-linux-amd64-$GETH_BUILD.tar.gz - rm geth-linux-amd64-$GETH_BUILD.tar.gz - mv geth-linux-amd64-$GETH_BUILD/geth $HOME/bin/geth - chmod u+x "$HOME/bin/geth" - export PATH=$HOME/bin:$PATH - echo $HOME/bin >> $GITHUB_PATH - geth version - - - name: Install latest nextest release - uses: taiki-e/install-action@nextest - - - name: Update packages - run: cargo update - - - name: Run tests - run: | - cargo nextest run --locked --workspace --all-features \ - --partition hash:${{ matrix.partition }}/${{ strategy.job-total }} \ - -E 'kind(lib)' -E 'kind(bin)' -E 'kind(proc-macro)' - - - uses: JasonEtco/create-an-issue@v2 - if: ${{ failure() }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - with: - update_existing: true - filename: .github/SANITY_DEPS_ISSUE_TEMPLATE.md - - unused-deps: - runs-on: ubuntu-latest - name: unused dependencies - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@nightly - - - name: Install cargo-udeps - run: cargo install cargo-udeps --locked - + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + - uses: taiki-e/install-action@cargo-udeps - name: Check for unused dependencies - run: cargo +nightly udeps --all-features --all-targets - + run: cargo udeps --all-features --all-targets - uses: JasonEtco/create-an-issue@v2 if: ${{ failure() }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + WORKFLOW_URL: + ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} with: update_existing: true filename: .github/SANITY_UNUSED_DEPS_ISSUE_TEMPLATE.md - diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5328cc95e8fc..700c7ea1efd8 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,7 @@ +# Marks issues as stale. + name: stale issues + on: workflow_dispatch: {} schedule: diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 17ff5f9a6685..ca80c4e9a291 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -1,3 +1,7 @@ +# Runs unit tests. + +name: unit + on: pull_request: merge_group: @@ -12,88 +16,71 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -name: unit jobs: test: - name: test (partition ${{ matrix.partition }}/${{ strategy.job-total }}) + name: tests (${{ matrix.partition }}/${{ strategy.job-total }}) runs-on: group: Reth strategy: matrix: partition: [1, 2] - timeout-minutes: 60 + timeout-minutes: 30 steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - - name: Install latest nextest release - uses: taiki-e/install-action@nextest - + - uses: taiki-e/install-action@nextest - name: Run tests run: | cargo nextest run \ --locked --all-features --workspace --exclude examples --exclude ef-tests \ --partition hash:${{ matrix.partition }}/${{ strategy.job-total }} \ - -E 'kind(lib)' -E 'kind(bin)' -E 'kind(proc-macro)' + -E "kind(lib) | kind(bin) | kind(proc-macro)" - eth-blockchain: - name: ethereum / state tests (stable) + state: + name: Ethereum state tests runs-on: group: Reth env: RUST_LOG: info,sync=error - timeout-minutes: 60 + timeout-minutes: 30 steps: - - name: Checkout sources - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Checkout ethereum/tests - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ethereum/tests path: testing/ef-tests/ethereum-tests submodules: recursive fetch-depth: 1 - - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true + - uses: dtolnay/rust-toolchain@stable + - uses: taiki-e/install-action@nextest - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Install latest nextest release - uses: taiki-e/install-action@nextest + - run: cargo nextest run --release -p ef-tests --features ef-tests - - name: Run Ethereum tests - run: cargo nextest run --release -p ef-tests --features ef-tests - - doc-test: - name: rustdoc + doc: + name: doc tests runs-on: group: Reth - timeout-minutes: 60 + timeout-minutes: 30 steps: - - uses: actions/checkout@v3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@stable + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - - name: Run doctests - run: cargo test --doc --all --all-features + with: + cache-on-failure: true + - run: cargo test --doc --workspace --all-features unit-success: - if: always() name: unit success runs-on: ubuntu-latest - needs: [test, eth-blockchain, doc-test] - timeout-minutes: 60 + if: always() + needs: [test, state, doc] + timeout-minutes: 30 steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1