Skip to content

Component: ExceptionHandler sample: route managed throw into C# handler #148

Component: ExceptionHandler sample: route managed throw into C# handler

Component: ExceptionHandler sample: route managed throw into C# handler #148

Workflow file for this run

name: Build RISC-V64
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:
inputs:
publish:
description: Publish Docker image
type: boolean
required: false
jobs:
build_riscv64:
runs-on: ubuntu-latest
container:
image: ubuntu:26.04
options: --privileged -v /var/run/docker.sock:/var/run/docker.sock
name: Build RISC-V64 on Ubuntu 26.04
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y \
git \
gcc-riscv64-linux-gnu \
g++-riscv64-linux-gnu \
binutils-riscv64-linux-gnu \
llvm \
clang \
lld \
xxd \
python3 \
python3-pip \
wget \
curl \
ca-certificates \
yq \
docker.io \
libicu-dev
pip3 install lief pyelftools --break-system-packages
# gcc-riscv64-linux-gnu only ships hard-float (lp64d) glibc stubs. We
# compile native modules with -mabi=lp64 (soft-float) to match zisk's
# crt1.o, so we need an empty gnu/stubs-lp64.h marker.
touch /usr/riscv64-linux-gnu/include/gnu/stubs-lp64.h
- name: Install .NET 10
run: |
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --channel 10.0 --install-dir /usr/share/dotnet
ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet
echo "DOTNET_ROOT=/usr/share/dotnet" >> $GITHUB_ENV
echo "/usr/share/dotnet" >> $GITHUB_PATH
- name: Checkout repo
uses: actions/checkout@v4
- name: Build modules (riscv64)
run: ./build.sh modules riscv64
- name: Build bflat (riscv64)
run: ./build.sh bflat riscv64
- name: Build Docker image
run: |
EXTRA_TAGS=""
if [ "${{ github.event.inputs.publish }}" = "true" ]; then
EXTRA_TAGS="-t nethermindeth/bflat-riscv64:latest -t nethermindeth/bflat-riscv64:$GITHUB_SHA"
fi
docker build --platform linux/amd64 \
-t nethermindeth/bflat-riscv64:test \
$EXTRA_TAGS \
.
- name: Smoke test bflat (zisk + zisk_sim)
run: |
set -e
for libc in zisk zisk_sim; do
echo "::group::Smoke build for libc=$libc"
docker run --rm --platform linux/amd64 \
nethermindeth/bflat-riscv64:test \
bash -lc "echo 'class Program { static int Main() => 0; }' > /tmp/smoke.cs && bflat build --arch riscv64 --os linux --stdlib dotnet --libc $libc --no-pie --no-pthread -o /tmp/smoke-$libc /tmp/smoke.cs && file /tmp/smoke-$libc && file /tmp/smoke-$libc | grep -q 'UCB RISC-V'"
echo "::endgroup::"
done
- name: Log in to Docker Hub
if: github.event.inputs.publish == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Publish to Docker Hub
if: github.event.inputs.publish == 'true'
run: |
docker push nethermindeth/bflat-riscv64:latest
docker push "nethermindeth/bflat-riscv64:$GITHUB_SHA"