458 lines
18 KiB
YAML

name: Lint
on:
push:
branches: ["*"]
pull_request:
env:
CARGO_TERM_COLOR: always
NOMOS_NODE_REV: 2f60a0372c228968c3526c341ebc7e58bbd178dd
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install nomos circuits
run: |
./scripts/setup-nomos-circuits.sh v0.3.1 "$HOME/.nomos-circuits"
echo "NOMOS_CIRCUITS=$HOME/.nomos-circuits" >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
components: rustfmt
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-target-fmt-${{ hashFiles('**/Cargo.lock') }}-nightly-2025-09-14
restore-keys: ${{ runner.os }}-target-fmt-
- run: cargo +nightly-2025-09-14 fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install nomos circuits
run: |
./scripts/setup-nomos-circuits.sh v0.3.1 "$HOME/.nomos-circuits"
echo "NOMOS_CIRCUITS=$HOME/.nomos-circuits" >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
components: clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-target-clippy-${{ hashFiles('**/Cargo.lock') }}-nightly-2025-09-14
restore-keys: ${{ runner.os }}-target-clippy-
- run: cargo +nightly-2025-09-14 clippy --all --all-targets --all-features -- -D warnings
deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install nomos circuits
run: |
./scripts/setup-nomos-circuits.sh v0.3.1 "$HOME/.nomos-circuits"
echo "NOMOS_CIRCUITS=$HOME/.nomos-circuits" >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install cargo-deny
run: cargo install cargo-deny --locked --version 0.18.2
- run: cargo deny check --hide-inclusion-graph -c .cargo-deny.toml --show-stats -D warnings
taplo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
- name: Install taplo
run: |
TAPLO_VERSION=0.9.3
cargo install taplo-cli --locked --version ${TAPLO_VERSION}
- run: taplo fmt --check
- run: taplo lint
machete:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install nomos circuits
run: |
./scripts/setup-nomos-circuits.sh v0.3.1 "$HOME/.nomos-circuits"
echo "NOMOS_CIRCUITS=$HOME/.nomos-circuits" >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install cargo-machete
run: cargo +nightly-2025-09-14 install --git https://github.com/bnjbvr/cargo-machete --locked cargo-machete
- run: cargo machete
local_smoke:
runs-on:
- self-hosted
- macOS
- X64
env:
POL_PROOF_DEV_MODE: true
LOCAL_DEMO_RUN_SECS: 120
LOCAL_DEMO_VALIDATORS: 1
LOCAL_DEMO_EXECUTORS: 1
NOMOS_CIRCUITS: ${{ github.workspace }}/.tmp/nomos-circuits
NOMOS_KZGRS_PARAMS_PATH: ${{ github.workspace }}/.tmp/nomos-circuits
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
RUSTFLAGS: -C debuginfo=0
steps:
- uses: actions/checkout@v4
- name: Set temp dir
run: |
echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"
echo "CARGO_TARGET_DIR=${{ runner.temp }}/target-local" >> "$GITHUB_ENV"
echo "NOMOS_LOG_DIR=${{ runner.temp }}/local-logs" >> "$GITHUB_ENV"
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
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: Install nomos circuits
run: |
./scripts/setup-nomos-circuits.sh v0.3.1 "$NOMOS_CIRCUITS"
echo "NOMOS_CIRCUITS=$NOMOS_CIRCUITS" >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Restore cached nomos binaries
id: restore-nomos-bins
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/nomos-binaries/nomos-binaries.tar.gz
key: ${{ runner.os }}-nomos-binaries-${{ env.NOMOS_NODE_REV }}
- 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 }}
run: |
set -euo pipefail
mkdir -p "${RUNNER_TEMP}/nomos-binaries"
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 cache missing and artifact not found. Run manual build-binaries workflow." >&2
exit 1
fi
gh api -X GET "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" > "${RUNNER_TEMP}/nomos-binaries/artifact.zip"
unzip -o "${RUNNER_TEMP}/nomos-binaries/artifact.zip" -d "${RUNNER_TEMP}/nomos-binaries"
- name: Install nomos binaries
run: |
BIN_DIR="${RUNNER_TEMP}/nomos-binaries"
if [ -f "${BIN_DIR}/nomos-binaries.tar.gz" ]; then
tar -xzf "${BIN_DIR}/nomos-binaries.tar.gz" -C "${BIN_DIR}"
fi
INSTALL_BIN="${RUNNER_TEMP}/nomos-bin"
mkdir -p "$INSTALL_BIN"
if [ "${RUNNER_OS}" = "macOS" ]; then
cp "${BIN_DIR}/nomos-node" "${BIN_DIR}/nomos-executor" "${BIN_DIR}/nomos-cli" "$INSTALL_BIN/"
chmod +x "${INSTALL_BIN}/nomos-node" "${INSTALL_BIN}/nomos-executor" "${INSTALL_BIN}/nomos-cli"
echo "$INSTALL_BIN" >> "$GITHUB_PATH"
echo "NOMOS_NODE_BIN=${INSTALL_BIN}/nomos-node" >> "$GITHUB_ENV"
echo "NOMOS_EXECUTOR_BIN=${INSTALL_BIN}/nomos-executor" >> "$GITHUB_ENV"
else
sudo cp "${BIN_DIR}/nomos-node" /usr/local/bin/
sudo cp "${BIN_DIR}/nomos-executor" /usr/local/bin/
sudo cp "${BIN_DIR}/nomos-cli" /usr/local/bin/
sudo chmod +x /usr/local/bin/nomos-node /usr/local/bin/nomos-executor /usr/local/bin/nomos-cli
echo "NOMOS_NODE_BIN=/usr/local/bin/nomos-node" >> "$GITHUB_ENV"
echo "NOMOS_EXECUTOR_BIN=/usr/local/bin/nomos-executor" >> "$GITHUB_ENV"
fi
- name: Stage KZG params for local run
run: |
rm -rf testing-framework/assets/stack/kzgrs_test_params
mkdir -p testing-framework/assets/stack/kzgrs_test_params
rsync -a --delete "$NOMOS_CIRCUITS"/ testing-framework/assets/stack/kzgrs_test_params/ || true
- name: Run local runner smoke (ignored test)
run: |
cargo +nightly-2025-09-14 test -p runner-examples --test local_runner_bin_smoke -- --ignored --nocapture
- name: Upload local smoke logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: local-smoke-logs
path: ${{ env.NOMOS_LOG_DIR }}
if-no-files-found: ignore
compose_smoke:
runs-on:
- self-hosted
- macOS
- X64
env:
TMPDIR: ${{ github.workspace }}/.tmp
NOMOS_CIRCUITS: ${{ github.workspace }}/.tmp/nomos-circuits
NOMOS_TESTNET_IMAGE: nomos-testnet:local
DOCKER_BUILDKIT: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare workspace tmpdir
run: mkdir -p "$TMPDIR"
- name: Restore cached nomos binaries
id: restore-nomos-bins-compose
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/nomos-binaries/nomos-binaries.tar.gz
key: ${{ runner.os }}-nomos-binaries-${{ env.NOMOS_NODE_REV }}
- name: Download nomos binaries artifact (fallback)
if: steps.restore-nomos-bins-compose.outputs.cache-hit != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_NAME: nomos-binaries-${{ runner.os }}-${{ env.NOMOS_NODE_REV }}
run: |
set -euo pipefail
mkdir -p "${RUNNER_TEMP}/nomos-binaries"
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 cache missing and artifact not found. Run manual build-binaries workflow." >&2
exit 1
fi
gh api -X GET "repos/${GITHUB_REPOSITORY}/actions/artifacts/${artifact_id}/zip" > "${RUNNER_TEMP}/nomos-binaries/artifact.zip"
unzip -o "${RUNNER_TEMP}/nomos-binaries/artifact.zip" -d "${RUNNER_TEMP}/nomos-binaries"
- name: Stage nomos binaries into build context
run: |
BIN_DIR="${RUNNER_TEMP}/nomos-binaries"
tar -xzf "${BIN_DIR}/nomos-binaries.tar.gz" -C "${BIN_DIR}"
mkdir -p testing-framework/assets/stack/bin
cp "${BIN_DIR}/nomos-node" testing-framework/assets/stack/bin/
cp "${BIN_DIR}/nomos-executor" testing-framework/assets/stack/bin/
cp "${BIN_DIR}/nomos-cli" testing-framework/assets/stack/bin/
rm -rf testing-framework/assets/stack/kzgrs_test_params
mkdir -p testing-framework/assets/stack/kzgrs_test_params
rsync -a --delete "$NOMOS_CIRCUITS"/ testing-framework/assets/stack/kzgrs_test_params/ || true
- name: Prune docker to free space
run: |
docker system prune -af --volumes || true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
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: Install system dependencies (Linux)
if: runner.os == 'Linux'
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
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- 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="${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
rm -rf testing-framework/assets/stack/kzgrs_test_params
mkdir -p testing-framework/assets/stack/kzgrs_test_params
if command -v rsync >/dev/null 2>&1; then
rsync -a --delete "$CIRCUITS_DIR"/ testing-framework/assets/stack/kzgrs_test_params/
else
rm -rf testing-framework/assets/stack/kzgrs_test_params/*
cp -a "$CIRCUITS_DIR"/. testing-framework/assets/stack/kzgrs_test_params/
fi
echo "NOMOS_CIRCUITS=$CIRCUITS_DIR" >> "$GITHUB_ENV"
echo "CIRCUITS_OVERRIDE=testing-framework/assets/stack/kzgrs_test_params" >> "$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 testing-framework/assets/stack/scripts/build_test_image.sh
testing-framework/assets/stack/scripts/build_test_image.sh
- name: Run compose mixed workload binary
env:
POL_PROOF_DEV_MODE: "true"
COMPOSE_NODE_PAIRS: "1x1"
NOMOS_TESTNET_IMAGE: ${{ env.NOMOS_TESTNET_IMAGE }}
COMPOSE_RUNNER_HOST: "127.0.0.1"
RUST_BACKTRACE: "1"
NOMOS_TESTS_TRACING: "true"
NOMOS_LOG_DIR: "${{ github.workspace }}/.tmp/compose-logs"
NOMOS_LOG_LEVEL: "info"
run: |
mkdir -p "$TMPDIR"
cargo run -p runner-examples --bin compose_runner -- --nocapture
- name: Collect compose logs
if: failure()
run: |
mkdir -p ci-artifacts/compose
if [ -d "${TMPDIR}/compose-logs" ]; then
tar -czf ci-artifacts/compose/node-logs.tgz -C "${TMPDIR}/compose-logs" .
fi
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
- name: Upload compose artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: compose-mixed-workload-logs
path: ci-artifacts
- name: Cleanup compose containers
if: always()
run: |
ids=$(docker ps -a --filter "name=nomos-compose-" -q)
if [ -n "$ids" ]; then
docker rm -f $ids
fi
book:
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: nightly-2025-09-14
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-09-14
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install mdBook toolchain
run: |
MDBOOK_VERSION=0.4.40
LINKCHECK_VERSION=0.7.7
MERMAID_VERSION=0.12.6
cargo +nightly-2025-09-14 install --locked mdbook --version ${MDBOOK_VERSION}
cargo +nightly-2025-09-14 install mdbook-linkcheck --version ${LINKCHECK_VERSION}
cargo +nightly-2025-09-14 install --locked mdbook-mermaid --version ${MERMAID_VERSION}
cargo +nightly-2025-09-14 install --locked typos-cli --version 1.20.11
- name: Spell check (typos)
run: typos --format brief book/src
- name: Markdown lint
run: npx -y markdownlint-cli2 "book/src/**/*.md"
- name: Build book
run: mdbook build book
- name: Check links
run: mdbook-linkcheck book
- name: Upload book artifact for Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
path: book/book
deploy_book:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: book
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4