diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e3ac0afbd..bf8114565 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -275,7 +275,7 @@ jobs: push-to-registry: true build-binaries: - name: Build binary (${{ matrix.target.name }}) + name: Build binary (${{ matrix.target.name }}, ${{ matrix.variant.name }}) needs: meta strategy: matrix: @@ -288,7 +288,20 @@ jobs: name: linux-aarch64 - runner: macos-latest name: macos-aarch64 + # Every platform ships twice: ethlambda alone, and ethlambda with ethrex + # embedded as the beacon node's execution client (`include-ethrex`, see + # docs/ethrex.md). Both asset names start with `ethlambda-`, which is + # what github-release downloads, checksums and verifies by. + variant: + - name: default + asset: ethlambda + features: "" + - name: ethrex + asset: ethlambda-ethrex + features: ethlambda/include-ethrex runs-on: ${{ matrix.target.runner }} + env: + ASSET: ${{ matrix.variant.asset }}-${{ matrix.target.name }} steps: - name: Checkout repository @@ -309,19 +322,36 @@ jobs: env: # A tag checkout is detached, so vergen would report "HEAD". VERGEN_GIT_BRANCH: ${{ needs.meta.outputs.channel }} - run: cargo build --release --locked --bin ethlambda + FEATURES: ${{ matrix.variant.features }} + run: cargo build --release --locked --bin ethlambda --features "$FEATURES" - name: Package binary + env: + EMBEDS_ETHREX: ${{ matrix.variant.name == 'ethrex' }} run: | + set -euo pipefail mkdir -p dist - cp target/release/ethlambda "dist/ethlambda-${{ matrix.target.name }}" - "dist/ethlambda-${{ matrix.target.name }}" --version + cp target/release/ethlambda "dist/$ASSET" + "dist/$ASSET" --version + + # Both builds report the same version, so a feature that did not take + # would ship two identical binaries under different names. Only a + # build with ethrex embedded takes the `--ethrex.*` flags. The help + # text is captured first: `grep -q` stops reading at the first match, + # and under pipefail the writer's SIGPIPE would fail the pipe. + help=$("dist/$ASSET" beacon --help) + embeds=false + if grep -q -- '--ethrex\.' <<< "$help"; then embeds=true; fi + if [ "$embeds" != "$EMBEDS_ETHREX" ]; then + echo "::error::$ASSET: takes --ethrex.* flags: $embeds, expected $EMBEDS_ETHREX" + exit 1 + fi - name: Upload binary uses: actions/upload-artifact@v7.0.2 with: - name: ethlambda-${{ matrix.target.name }} - path: dist/ethlambda-${{ matrix.target.name }} + name: ${{ env.ASSET }} + path: dist/${{ env.ASSET }} if-no-files-found: error changelog: @@ -450,7 +480,7 @@ jobs: **Docker image:** \`$IMAGE\` (amd64 and arm64) - **Binaries:** attached below, with their \`SHA256SUMS\`. The \`linux-x86_64\` build targets x86-64-v3, so it needs a CPU with AVX2 (Haswell or later). + **Binaries:** attached below, with their \`SHA256SUMS\`, in two builds per platform. \`ethlambda-\` is ethlambda alone. \`ethlambda-ethrex-\` embeds [ethrex](https://github.com/lambdaclass/ethrex) as the beacon node's execution client, so \`ethlambda beacon\` needs no separate one; see [docs/ethrex.md](https://github.com/$GITHUB_REPOSITORY/blob/main/docs/ethrex.md). The \`linux-x86_64\` builds target x86-64-v3, so they need a CPU with AVX2 (Haswell or later). **Verifying:** the binaries and the image carry GitHub build provenance attestations. See [RELEASE.md](https://github.com/$GITHUB_REPOSITORY/blob/main/RELEASE.md#verifying-a-release) for the commands. diff --git a/CLAUDE.md b/CLAUDE.md index 389124b80..203705e0c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1013,6 +1013,10 @@ incremental, and line-tables-only debuginfo, so rebuilds are much faster than `server_shutdown` against `crates/execution/ethrex/src/lib.rs`, which repeats them - `make test-node` excludes `ethlambda-ethrex`; `make test-ethrex` (own CI job) runs it plus the engine and binary with the feature on +- Releases ship both builds per platform (`release.yaml`'s `build-binaries` + matrix): `ethlambda-` and `ethlambda-ethrex-`, the second + checked for the `--ethrex.*` flags before upload. Docker images and the + Homebrew bottle stay ethlambda-only ### Aggregator Flag Required for Finalization - At least one node **must** be started with `--is-aggregator` to finalize blocks diff --git a/README.md b/README.md index 4e9cdaf65..2e3be91ac 100644 --- a/README.md +++ b/README.md @@ -447,8 +447,12 @@ Additional features: ### Releases Binaries for Linux (x86_64, aarch64) and macOS (Apple silicon) are attached to -[GitHub Releases](https://github.com/lambdaclass/ethlambda/releases). Docker -images are published to `ghcr.io/lambdaclass/ethlambda` with the following tags: +[GitHub Releases](https://github.com/lambdaclass/ethlambda/releases). Releases +after v1.0.0 carry two builds: `ethlambda-`, and +`ethlambda-ethrex-`, which embeds ethrex as the beacon node's +execution client ([`docs/ethrex.md`](docs/ethrex.md)). +Docker images are published to `ghcr.io/lambdaclass/ethlambda` with the +following tags: | Tag | Description | |-----|-------------| diff --git a/RELEASE.md b/RELEASE.md index 0d76a98b7..5c7baa1a0 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -44,13 +44,21 @@ docker pull ghcr.io/lambdaclass/ethlambda:sha-12f8377 # pinned to a specific c ## Release binaries -Every release candidate attaches these binaries, plus a `SHA256SUMS` file: - -| Asset | Platform | -|-------|----------| -| `ethlambda-linux-x86_64` | Linux x86_64, glibc 2.35+ (built on Ubuntu 22.04). Targets x86-64-v3, so it needs AVX2 (Haswell or later) | -| `ethlambda-linux-aarch64` | Linux aarch64, glibc 2.35+ | -| `ethlambda-macos-aarch64` | macOS on Apple silicon | +Every release candidate attaches two builds for each platform, plus a +`SHA256SUMS` file covering all of them. `ethlambda-` is ethlambda +alone. `ethlambda-ethrex-` is built with the `include-ethrex` feature: +`ethlambda beacon` without `--execution-endpoint` runs +[ethrex](https://github.com/lambdaclass/ethrex) in its own process as its +execution client (see [`docs/ethrex.md`](docs/ethrex.md)). + +| Platform | ethlambda | ethlambda with ethrex | +|----------|-----------|-----------------------| +| Linux x86_64, glibc 2.35+ (built on Ubuntu 22.04). Targets x86-64-v3, so it needs AVX2 (Haswell or later) | `ethlambda-linux-x86_64` | `ethlambda-ethrex-linux-x86_64` | +| Linux aarch64, glibc 2.35+ | `ethlambda-linux-aarch64` | `ethlambda-ethrex-linux-aarch64` | +| macOS on Apple silicon | `ethlambda-macos-aarch64` | `ethlambda-ethrex-macos-aarch64` | + +The Docker images are ethlambda alone. `docs/ethrex.md` shows how to build an +image with ethrex embedded. ## Verifying a release @@ -209,7 +217,9 @@ in this order, and drop the boxes that do not apply: The `ethlambda` formula in [lambdaclass/homebrew-tap](https://github.com/lambdaclass/homebrew-tap) builds from the final tag's source tarball. Apple silicon gets a bottle instead, repackaged from the release's `ethlambda-macos-aarch64` binary, so it installs -the same binary the release ships; every other platform builds from source. The +the same binary the release ships; every other platform builds from source. +The formula builds without `include-ethrex`, so the bottle comes from that +build too, never from `ethlambda-ethrex-macos-aarch64`. The bottle is attached to a tap release tagged `ethlambda-vX.Y.Z`, because the tap's bare `vX.Y.Z` tags are ethrex's. diff --git a/docs/ethrex.md b/docs/ethrex.md index ac814901a..84e2196a5 100644 --- a/docs/ethrex.md +++ b/docs/ethrex.md @@ -12,6 +12,12 @@ cargo build --release --features include-ethrex docker build --build-arg FEATURES=include-ethrex -t ethlambda:ethrex . ``` +Releases attach this build for every platform as `ethlambda-ethrex-`, +next to the ethlambda-only `ethlambda-` (see +[`RELEASE.md`](https://github.com/lambdaclass/ethlambda/blob/main/RELEASE.md#release-binaries)). +The published Docker images are +ethlambda-only, so an image with ethrex embedded is built as above. + ## Choosing the execution client | Build | `--execution-endpoint` given | Execution client |