mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-04 06:13:09 +00:00
Use prebuilt binaries artifact in compose CI
This commit is contained in:
parent
17406dc285
commit
3a8835e3e6
26
.github/workflows/lint.yml
vendored
26
.github/workflows/lint.yml
vendored
@ -228,6 +228,31 @@ jobs:
|
|||||||
- name: Prepare workspace tmpdir
|
- name: Prepare workspace tmpdir
|
||||||
run: mkdir -p "$TMPDIR"
|
run: mkdir -p "$TMPDIR"
|
||||||
|
|
||||||
|
- name: Restore cached nomos binaries
|
||||||
|
id: restore-nomos-bins
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/.tmp/nomos-binaries.tar.gz
|
||||||
|
key: ${{ runner.os }}-nomos-binaries-${{ env.NOMOS_NODE_REV }}-${{ env.NOMOS_BUNDLE_VERSION }}
|
||||||
|
|
||||||
|
- name: Download nomos binaries artifact (fallback)
|
||||||
|
if: steps.restore-nomos-bins.outputs.cache-hit != 'true'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ARTIFACT_NAME: nomos-binaries-${{ runner.os }}-${{ env.NOMOS_NODE_REV }}-${{ env.NOMOS_BUNDLE_VERSION }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
mkdir -p "${TMPDIR}"
|
||||||
|
artifact_id=$(gh api -X GET "repos/${GITHUB_REPOSITORY}/actions/artifacts" --paginate -F per_page=100 \
|
||||||
|
--jq '.artifacts[] | select(.name=="'"${ARTIFACT_NAME}"'") | .id' | head -n1)
|
||||||
|
if [ -z "$artifact_id" ]; then
|
||||||
|
echo "Nomos binaries artifact ${ARTIFACT_NAME} not found. Run build-binaries workflow." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
gh api -X GET "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" > "${TMPDIR}/nomos-binaries.zip"
|
||||||
|
unzip -o "${TMPDIR}/nomos-binaries.zip" -d "${TMPDIR}"
|
||||||
|
mv "${TMPDIR}/nomos-binaries.tar.gz" "${GITHUB_WORKSPACE}/.tmp/nomos-binaries.tar.gz"
|
||||||
|
|
||||||
- name: Set compose target dir
|
- name: Set compose target dir
|
||||||
run: echo "CARGO_TARGET_DIR=${RUNNER_TEMP}/target-compose" >> "$GITHUB_ENV"
|
run: echo "CARGO_TARGET_DIR=${RUNNER_TEMP}/target-compose" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
@ -276,6 +301,7 @@ jobs:
|
|||||||
RUST_LOG: "info"
|
RUST_LOG: "info"
|
||||||
NOMOS_LOG_LEVEL: "info"
|
NOMOS_LOG_LEVEL: "info"
|
||||||
NOMOS_LOG_DIR: "${{ github.workspace }}/.tmp/compose-logs"
|
NOMOS_LOG_DIR: "${{ github.workspace }}/.tmp/compose-logs"
|
||||||
|
NOMOS_BINARIES_TAR: "${{ github.workspace }}/.tmp/nomos-binaries.tar.gz"
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "$TMPDIR"
|
mkdir -p "$TMPDIR"
|
||||||
scripts/run-demo.sh compose 60
|
scripts/run-demo.sh compose 60
|
||||||
|
|||||||
@ -23,6 +23,7 @@ RUN_SECS="${2:-60}"
|
|||||||
VERSION="${VERSION:-v0.3.1}"
|
VERSION="${VERSION:-v0.3.1}"
|
||||||
IMAGE="${NOMOS_TESTNET_IMAGE:-nomos-testnet:local}"
|
IMAGE="${NOMOS_TESTNET_IMAGE:-nomos-testnet:local}"
|
||||||
NOMOS_NODE_REV="${NOMOS_NODE_REV:-d2dd5a5084e1daef4032562c77d41de5e4d495f8}"
|
NOMOS_NODE_REV="${NOMOS_NODE_REV:-d2dd5a5084e1daef4032562c77d41de5e4d495f8}"
|
||||||
|
RESTORED_BINARIES=0
|
||||||
|
|
||||||
case "$MODE" in
|
case "$MODE" in
|
||||||
compose) BIN="compose_runner" ;;
|
compose) BIN="compose_runner" ;;
|
||||||
@ -31,6 +32,41 @@ case "$MODE" in
|
|||||||
*) echo "Unknown mode '$MODE' (use compose|local)" >&2; exit 1 ;;
|
*) echo "Unknown mode '$MODE' (use compose|local)" >&2; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
restore_binaries_from_tar() {
|
||||||
|
local tar_path="${NOMOS_BINARIES_TAR:-${ROOT_DIR}/.tmp/nomos-binaries.tar.gz}"
|
||||||
|
local extract_dir="${ROOT_DIR}/.tmp/nomos-binaries"
|
||||||
|
if [ ! -f "$tar_path" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "==> Restoring binaries from ${tar_path}"
|
||||||
|
rm -rf "${extract_dir}"
|
||||||
|
mkdir -p "${extract_dir}"
|
||||||
|
tar -xzf "$tar_path" -C "${extract_dir}"
|
||||||
|
local src="${extract_dir}/artifacts"
|
||||||
|
local bin_dst="${ROOT_DIR}/testing-framework/assets/stack/bin"
|
||||||
|
local circuits_src="${src}/circuits"
|
||||||
|
local circuits_dst="${ROOT_DIR}/testing-framework/assets/stack/kzgrs_test_params"
|
||||||
|
if [ -f "${src}/nomos-node" ] && [ -f "${src}/nomos-executor" ] && [ -f "${src}/nomos-cli" ]; then
|
||||||
|
mkdir -p "${bin_dst}"
|
||||||
|
cp "${src}/nomos-node" "${bin_dst}/"
|
||||||
|
cp "${src}/nomos-executor" "${bin_dst}/"
|
||||||
|
cp "${src}/nomos-cli" "${bin_dst}/"
|
||||||
|
else
|
||||||
|
echo "Binaries missing in ${tar_path}; fallback to build-from-source path" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ -d "${circuits_src}" ] && [ -f "${circuits_src}/kzgrs_test_params" ]; then
|
||||||
|
rm -rf "${circuits_dst}"
|
||||||
|
mkdir -p "${circuits_dst}"
|
||||||
|
rsync -a --delete "${circuits_src}/" "${circuits_dst}/"
|
||||||
|
else
|
||||||
|
echo "Circuits missing in ${tar_path}; fallback to download/build path" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
RESTORED_BINARIES=1
|
||||||
|
export RESTORED_BINARIES
|
||||||
|
}
|
||||||
|
|
||||||
ensure_host_binaries() {
|
ensure_host_binaries() {
|
||||||
# Build nomos-node/nomos-executor for the host if not already present.
|
# Build nomos-node/nomos-executor for the host if not already present.
|
||||||
HOST_SRC="${ROOT_DIR}/.tmp/nomos-node-host-src"
|
HOST_SRC="${ROOT_DIR}/.tmp/nomos-node-host-src"
|
||||||
@ -75,9 +111,15 @@ ensure_host_binaries() {
|
|||||||
export NOMOS_NODE_BIN NOMOS_EXECUTOR_BIN
|
export NOMOS_NODE_BIN NOMOS_EXECUTOR_BIN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restore_binaries_from_tar || true
|
||||||
|
|
||||||
echo "==> Preparing circuits (version ${VERSION})"
|
echo "==> Preparing circuits (version ${VERSION})"
|
||||||
SETUP_OUT="/tmp/nomos-setup-output.$$"
|
SETUP_OUT="/tmp/nomos-setup-output.$$"
|
||||||
"${ROOT_DIR}/scripts/setup-circuits-stack.sh" "${VERSION}" </dev/null | tee "$SETUP_OUT"
|
if [ "${RESTORED_BINARIES}" -ne 1 ]; then
|
||||||
|
"${ROOT_DIR}/scripts/setup-circuits-stack.sh" "${VERSION}" </dev/null | tee "$SETUP_OUT"
|
||||||
|
else
|
||||||
|
echo "Skipping circuits setup; using restored bundle"
|
||||||
|
fi
|
||||||
|
|
||||||
# Prefer the host bundle if it exists; otherwise fall back to Linux bundle.
|
# Prefer the host bundle if it exists; otherwise fall back to Linux bundle.
|
||||||
if [ -d "${ROOT_DIR}/.tmp/nomos-circuits-host" ]; then
|
if [ -d "${ROOT_DIR}/.tmp/nomos-circuits-host" ]; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user