mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-02 21:33:07 +00:00
Add compose CI workflow and allow rapidsnark rebuilds
This commit is contained in:
parent
92e855741a
commit
6f21cc5420
125
.github/workflows/compose-mixed.yml
vendored
Normal file
125
.github/workflows/compose-mixed.yml
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
name: Compose Mixed Workload
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
compose-mixed-workload:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TMPDIR: ${{ github.workspace }}/.tmp
|
||||
NOMOS_TESTNET_IMAGE: nomos-testnet:local
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare workspace tmpdir
|
||||
run: mkdir -p "$TMPDIR"
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang llvm-dev libclang-dev pkg-config cmake libssl-dev rsync libgmp10 libgmp-dev libgomp1 nasm
|
||||
else
|
||||
apt-get update
|
||||
apt-get install -y clang llvm-dev libclang-dev pkg-config cmake libssl-dev rsync libgmp10 libgmp-dev libgomp1 nasm
|
||||
fi
|
||||
|
||||
- name: Cache cargo registry
|
||||
if: env.ACT != 'true'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-
|
||||
|
||||
- name: Cache target directory
|
||||
if: env.ACT != 'true'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-target-compose-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-target-compose-
|
||||
|
||||
- name: Install circuits for host build
|
||||
env:
|
||||
NOMOS_CIRCUITS_PLATFORM: linux-x86_64
|
||||
NOMOS_CIRCUITS_REBUILD_RAPIDSNARK: "1"
|
||||
RAPIDSNARK_FORCE_REBUILD: "1"
|
||||
RAPIDSNARK_BUILD_GMP: "0"
|
||||
run: |
|
||||
CIRCUITS_DIR="${TMPDIR}/nomos-circuits"
|
||||
chmod +x scripts/setup-nomos-circuits.sh
|
||||
scripts/setup-nomos-circuits.sh v0.3.1 "$CIRCUITS_DIR"
|
||||
# Copy into build context so Docker doesn't need network
|
||||
mkdir -p tests/kzgrs/circuits_bundle
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -a --delete "$CIRCUITS_DIR"/ tests/kzgrs/circuits_bundle/
|
||||
else
|
||||
rm -rf tests/kzgrs/circuits_bundle/*
|
||||
cp -a "$CIRCUITS_DIR"/. tests/kzgrs/circuits_bundle/
|
||||
fi
|
||||
echo "NOMOS_CIRCUITS=$CIRCUITS_DIR" >> "$GITHUB_ENV"
|
||||
echo "CIRCUITS_OVERRIDE=tests/kzgrs/circuits_bundle" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build compose test image
|
||||
env:
|
||||
DOCKER_CLI_HINTS: "false"
|
||||
IMAGE_TAG: ${{ env.NOMOS_TESTNET_IMAGE }}
|
||||
CIRCUITS_OVERRIDE: ${{ env.CIRCUITS_OVERRIDE }}
|
||||
run: |
|
||||
chmod +x testnet/scripts/build_test_image.sh
|
||||
./testnet/scripts/build_test_image.sh
|
||||
|
||||
- name: Run compose mixed workload test
|
||||
env:
|
||||
POL_PROOF_DEV_MODE: "true"
|
||||
COMPOSE_NODE_PAIRS: "1x1"
|
||||
NOMOS_TESTNET_IMAGE: ${{ env.NOMOS_TESTNET_IMAGE }}
|
||||
RUST_BACKTRACE: "1"
|
||||
run: |
|
||||
mkdir -p "$TMPDIR"
|
||||
if [ "${{ env.ACT }}" = "true" ]; then
|
||||
export COMPOSE_RUNNER_PRESERVE=1
|
||||
fi
|
||||
cargo test -p tests-workflows compose_runner_mixed_workloads -- --nocapture
|
||||
|
||||
- name: Collect compose logs
|
||||
if: failure()
|
||||
run: |
|
||||
mkdir -p ci-artifacts/compose
|
||||
docker ps -a --filter "name=nomos-compose-" --format '{{.ID}} {{.Names}} {{.Status}}' > ci-artifacts/compose/containers.txt || true
|
||||
for id in $(docker ps -a --filter "name=nomos-compose-" -q); do
|
||||
docker logs "$id" > "ci-artifacts/compose/${id}.log" 2>&1 || true
|
||||
done
|
||||
if compgen -G "tests/.tmp*/__logs.*" > /dev/null; then
|
||||
mkdir -p ci-artifacts/tests
|
||||
find tests -path "tests/.tmp*/__logs.*" -type d -print0 | while IFS= read -r -d '' dir; do
|
||||
tar -czf "ci-artifacts/tests/$(basename "$(dirname "$dir")")-$(basename "$dir").tgz" -C "$dir" .
|
||||
done
|
||||
fi
|
||||
|
||||
- name: Upload compose artifacts
|
||||
if: failure() && env.ACT != 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: compose-mixed-workload-logs
|
||||
path: ci-artifacts
|
||||
|
||||
- name: Cleanup compose containers
|
||||
if: always() && env.ACT != 'true'
|
||||
run: |
|
||||
ids=$(docker ps -a --filter "name=nomos-compose-" -q)
|
||||
if [ -n "$ids" ]; then
|
||||
docker rm -f $ids
|
||||
fi
|
||||
@ -15,6 +15,10 @@ TARGET_ARCH="$(uname -m)"
|
||||
CIRCUITS_DIR="$1"
|
||||
RAPIDSNARK_REPO="${RAPIDSNARK_REPO:-https://github.com/iden3/rapidsnark.git}"
|
||||
RAPIDSNARK_REF="${RAPIDSNARK_REF:-main}"
|
||||
FORCE_REBUILD="${RAPIDSNARK_FORCE_REBUILD:-0}"
|
||||
BUILD_DIR=""
|
||||
PACKAGE_DIR=""
|
||||
CMAKE_TARGET_PLATFORM=""
|
||||
|
||||
if [ ! -d "$CIRCUITS_DIR" ]; then
|
||||
echo "circuits directory '$CIRCUITS_DIR' does not exist" >&2
|
||||
@ -22,25 +26,43 @@ if [ ! -d "$CIRCUITS_DIR" ]; then
|
||||
fi
|
||||
|
||||
system_gmp_package() {
|
||||
local multiarch
|
||||
multiarch="$(gcc -print-multiarch 2>/dev/null || echo aarch64-linux-gnu)"
|
||||
local multiarch arch
|
||||
arch="${1:-${TARGET_ARCH}}"
|
||||
multiarch="$(gcc -print-multiarch 2>/dev/null || echo "${arch}-linux-gnu")"
|
||||
local lib_path="/usr/lib/${multiarch}/libgmp.a"
|
||||
if [ ! -f "$lib_path" ]; then
|
||||
echo "system libgmp.a not found at $lib_path" >&2
|
||||
return 1
|
||||
fi
|
||||
mkdir -p depends/gmp/package_aarch64/lib depends/gmp/package_aarch64/include
|
||||
cp "$lib_path" depends/gmp/package_aarch64/lib/
|
||||
mkdir -p "depends/gmp/package_${arch}/lib" "depends/gmp/package_${arch}/include"
|
||||
cp "$lib_path" "depends/gmp/package_${arch}/lib/"
|
||||
# Headers are small; copy the public ones the build expects.
|
||||
cp /usr/include/gmp*.h depends/gmp/package_aarch64/include/ || true
|
||||
cp /usr/include/gmp*.h "depends/gmp/package_${arch}/include/" || true
|
||||
}
|
||||
|
||||
case "$TARGET_ARCH" in
|
||||
arm64 | aarch64)
|
||||
CMAKE_TARGET_PLATFORM="aarch64"
|
||||
BUILD_DIR="build_prover_arm64"
|
||||
PACKAGE_DIR="${RAPIDSNARK_PACKAGE_DIR:-package_arm64}"
|
||||
;;
|
||||
x86_64)
|
||||
if [ "$FORCE_REBUILD" != "1" ]; then
|
||||
echo "rapidsnark rebuild skipped for architecture '$TARGET_ARCH' (set RAPIDSNARK_FORCE_REBUILD=1 to override)" >&2
|
||||
exit 0
|
||||
fi
|
||||
CMAKE_TARGET_PLATFORM="x86_64"
|
||||
BUILD_DIR="build_prover_x86_64"
|
||||
PACKAGE_DIR="${RAPIDSNARK_PACKAGE_DIR:-package_x86_64}"
|
||||
;;
|
||||
*)
|
||||
echo "rapidsnark rebuild skipped for architecture '$TARGET_ARCH'" >&2
|
||||
exit 0
|
||||
if [ "$FORCE_REBUILD" != "1" ]; then
|
||||
echo "rapidsnark rebuild skipped for unsupported architecture '$TARGET_ARCH'" >&2
|
||||
exit 0
|
||||
fi
|
||||
CMAKE_TARGET_PLATFORM="$TARGET_ARCH"
|
||||
BUILD_DIR="build_prover_${TARGET_ARCH}"
|
||||
PACKAGE_DIR="${RAPIDSNARK_PACKAGE_DIR:-package_${TARGET_ARCH}}"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -53,20 +75,26 @@ cd "$workdir/rapidsnark"
|
||||
git submodule update --init --recursive >&2
|
||||
|
||||
if [ "${RAPIDSNARK_BUILD_GMP:-1}" = "1" ]; then
|
||||
GMP_TARGET="${RAPIDSNARK_GMP_TARGET:-aarch64}"
|
||||
if [ -z "${RAPIDSNARK_GMP_TARGET:-}" ]; then
|
||||
if [ "$CMAKE_TARGET_PLATFORM" = "x86_64" ]; then
|
||||
GMP_TARGET="host"
|
||||
else
|
||||
GMP_TARGET="$CMAKE_TARGET_PLATFORM"
|
||||
fi
|
||||
else
|
||||
GMP_TARGET="$RAPIDSNARK_GMP_TARGET"
|
||||
fi
|
||||
./build_gmp.sh "$GMP_TARGET" >&2
|
||||
else
|
||||
echo "Using system libgmp to satisfy rapidsnark dependencies" >&2
|
||||
system_gmp_package
|
||||
system_gmp_package "$CMAKE_TARGET_PLATFORM"
|
||||
fi
|
||||
|
||||
PACKAGE_DIR="${RAPIDSNARK_PACKAGE_DIR:-package_arm64}"
|
||||
|
||||
rm -rf build_prover_arm64
|
||||
mkdir build_prover_arm64
|
||||
cd build_prover_arm64
|
||||
rm -rf "$BUILD_DIR"
|
||||
mkdir "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
cmake .. \
|
||||
-DTARGET_PLATFORM=aarch64 \
|
||||
-DTARGET_PLATFORM="$CMAKE_TARGET_PLATFORM" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="../${PACKAGE_DIR}" \
|
||||
-DBUILD_SHARED_LIBS=OFF >&2
|
||||
|
||||
@ -82,6 +82,8 @@ LABEL maintainer="augustinas@status.im" \
|
||||
|
||||
RUN apt-get update && apt-get install -yq \
|
||||
libstdc++6 \
|
||||
libgmp10 \
|
||||
libgomp1 \
|
||||
libssl3 \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user