Skip to content

ci: build the RISC-V binary #631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ on:
description: "Build Binary"
required: false
type: boolean
cross-build-binary:
default: true
description: "Cross-build Binary"
required: false
type: boolean
features:
default: ''
description: "Binary Compilation Features"
Expand Down Expand Up @@ -113,10 +118,67 @@ jobs:
name: reth-rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}${{ matrix.features && '-' }}${{ matrix.features }}
path: target/${{ matrix.configs.target }}/release/reth-rbuilder

cross-build-binary:
name: Cross-build binary
needs: extract-version
if: ${{ github.event.inputs.cross-build-binary == 'true' || github.event_name == 'push'}} # when manually triggered or version tagged
runs-on: warp-ubuntu-2404-x64-32x
container:
image: ubuntu:22.04
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this is. The job runs in warp 24.04, right? What's this container for?

Copy link
Contributor

@sukoneck sukoneck May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's understandably confusing. I can add some comments for context to this.

We're running the jobs on Warpbuild runners whose pre-installed software are updated outside of our control by the Warpbuild team. So, to regain control over pre-installed software during the build we run the build inside of a container that runs on the Warpbuild runner.

    # defines the runner
    runs-on: warp-ubuntu-2404-x64-32x
    
    # the build is run inside of this container which is hosted on the runner
    container:
      image: ubuntu:22.04

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm, so this will fail in a 22.04 container. I will try to run it in my fork as @metachris said.

permissions:
contents: write
packages: write
env:
target: riscv64gc-unknown-linux-gnu
strategy:
matrix:
features:
- ${{ github.event.inputs.features || '' }}
steps:
- name: Install dependencies
run: |
dpkg --add-architecture riscv64
echo "deb [arch=riscv64] http://ports.ubuntu.com/ noble main multiverse universe" >> /etc/apt/sources.list
echo "deb [arch=riscv64] http://ports.ubuntu.com/ noble-updates main multiverse universe" >> /etc/apt/sources.list
apt update
apt install --yes \
build-essential \
curl \
gcc-riscv64-linux-gnu \
git \
libclang-dev \
libssl-dev:riscv64 \
pkg-config
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- uses: actions/checkout@v4 # must install git before checkout and set safe.directory after checkout because of container
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this I also don't understand, what container?


- name: Build rbuilder binary
run: |
git config --global --add safe.directory "$(pwd)"
. $HOME/.cargo/env
rustup target add riscv64gc-unknown-linux-gnu
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER="riscv64-linux-gnu-gcc"
export OPENSSL_LIB_DIR="/usr/lib/riscv64-linux-gnu/"
export OPENSSL_INCLUDE_DIR="/usr/include/riscv64-linux-gnu/"
cargo build --release --features=${{ matrix.features }} --target ${{ env.target }}

- name: Upload rbuilder artifact
uses: actions/upload-artifact@v4
with:
name: rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ env.target }}${{ matrix.features && '-' }}${{ matrix.features }}
path: target/${{ env.target }}/release/rbuilder

- name: Upload reth-rbuilder artifact
uses: actions/upload-artifact@v4
with:
name: reth-rbuilder-${{ needs.extract-version.outputs.VERSION }}-${{ env.target }}${{ matrix.features && '-' }}${{ matrix.features }}
path: target/${{ env.target }}/release/reth-rbuilder

draft-release:
name: Draft release
if: ${{ github.event.inputs.draft-release == 'true' || github.event_name == 'push'}} # when manually triggered or version tagged
needs: [extract-version, build-binary]
needs: [extract-version, build-binary, cross-build-binary]
runs-on: warp-ubuntu-latest-x64-16x
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
Expand Down
Loading