2025-11-27 09:02:23 +01:00

128 lines
4.5 KiB
YAML

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"
RAPIDSNARK_USE_ASM: "OFF"
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 }}
COMPOSE_RUNNER_HOST: ${{ env.ACT == 'true' && 'host.docker.internal' || '127.0.0.1' }}
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