From 6b9eec61e5b38de7fb7ff9e8b5c817d24c69a01b Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Thu, 8 Jan 2026 09:26:11 +0200 Subject: [PATCH] fix: ci try 1 --- .../action.yml | 9 + .github/workflows/ci.yml | 10 + Cargo.lock | 6 - bedrock_client/Cargo.toml | 6 - ci_scripts/setup-nomos-circuits.sh | 203 ++++++++++++++++++ 5 files changed, 222 insertions(+), 12 deletions(-) create mode 100644 .github/actions/install-nomos-circuits-compatibility/action.yml create mode 100644 ci_scripts/setup-nomos-circuits.sh diff --git a/.github/actions/install-nomos-circuits-compatibility/action.yml b/.github/actions/install-nomos-circuits-compatibility/action.yml new file mode 100644 index 00000000..41f1e0cc --- /dev/null +++ b/.github/actions/install-nomos-circuits-compatibility/action.yml @@ -0,0 +1,9 @@ +name: Install Nomos circuits +description: Installs Nomos circuits for compatibility +runs: + using: "composite" + steps: + - name: Install risc0 + run: | + /home/runner/lssa/ci_scripts/setup-nomos-circuits.sh + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21c73d29..2a90d2ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,8 @@ jobs: - uses: ./.github/actions/install-risc0 + - uses: ./.github/actions/install-nomos-circuits-compatibility + - name: Install active toolchain run: rustup install @@ -95,6 +97,8 @@ jobs: - uses: ./.github/actions/install-risc0 + - uses: ./.github/actions/install-nomos-circuits-compatibility + - name: Install active toolchain run: rustup install @@ -118,6 +122,8 @@ jobs: - uses: ./.github/actions/install-risc0 + - uses: ./.github/actions/install-nomos-circuits-compatibility + - name: Install active toolchain run: rustup install @@ -139,6 +145,8 @@ jobs: - uses: ./.github/actions/install-risc0 + - uses: ./.github/actions/install-nomos-circuits-compatibility + - name: Install active toolchain run: rustup install @@ -161,6 +169,8 @@ jobs: - uses: ./.github/actions/install-risc0 + - uses: ./.github/actions/install-nomos-circuits-compatibility + - name: Install just run: cargo install just diff --git a/Cargo.lock b/Cargo.lock index 0b1b7717..df1c9ca6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -957,13 +957,7 @@ version = "0.1.0" dependencies = [ "anyhow", "common-http-client", - "futures", - "log", "reqwest", - "serde", - "serde_json", - "thiserror 2.0.17", - "url", ] [[package]] diff --git a/bedrock_client/Cargo.toml b/bedrock_client/Cargo.toml index 5a93a1b0..034a093e 100644 --- a/bedrock_client/Cargo.toml +++ b/bedrock_client/Cargo.toml @@ -6,10 +6,4 @@ edition = "2024" [dependencies] reqwest.workspace = true anyhow.workspace = true -serde.workspace = true -log.workspace = true -thiserror.workspace = true -url.workspace = true -futures.workspace = true -serde_json.workspace = true common-http-client.workspace = true diff --git a/ci_scripts/setup-nomos-circuits.sh b/ci_scripts/setup-nomos-circuits.sh new file mode 100644 index 00000000..151c42a4 --- /dev/null +++ b/ci_scripts/setup-nomos-circuits.sh @@ -0,0 +1,203 @@ +#!/bin/bash +# +# Setup script for nomos-circuits +# +# Usage: ./setup-nomos-circuits.sh [VERSION] [INSTALL_DIR] +# +# Arguments: +# VERSION - Optional. Version to install (default: v0.3.1) +# INSTALL_DIR - Optional. Installation directory (default: $HOME/.nomos-circuits) +# +# Examples: +# ./setup-nomos-circuits.sh # Install default version to default location +# ./setup-nomos-circuits.sh v0.2.0 # Install specific version to default location +# ./setup-nomos-circuits.sh v0.2.0 /opt/circuits # Install to custom location + +# LSSA: needed for compatibility + +set -e + +# Default values +VERSION="${1:-v0.3.1}" +DEFAULT_INSTALL_DIR="$HOME/.nomos-circuits" +INSTALL_DIR="${2:-$DEFAULT_INSTALL_DIR}" +REPO="logos-co/nomos-circuits" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +print_info() { + echo -e "${BLUE}ℹ${NC} $1" +} + +print_success() { + echo -e "${GREEN}✓${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}⚠${NC} $1" +} + +print_error() { + echo -e "${RED}✗${NC} $1" +} + +# Detect OS and architecture +detect_platform() { + local os="" + local arch="" + + # Detect OS + case "$(uname -s)" in + Linux*) os="linux";; + Darwin*) os="macos";; + MINGW*|MSYS*|CYGWIN*) os="windows";; + *) print_error "Unsupported operating system: $(uname -s)"; exit 1;; + esac + + # Detect architecture + case "$(uname -m)" in + x86_64) arch="x86_64";; + aarch64) arch="aarch64";; + arm64) arch="aarch64";; + *) print_error "Unsupported architecture: $(uname -m)"; exit 1;; + esac + + echo "${os}-${arch}" +} + +# Check if installation directory exists and get confirmation +check_existing_installation() { + if [ -d "$INSTALL_DIR" ]; then + print_warning "Installation directory already exists: $INSTALL_DIR" + + # Check if it has a VERSION file + if [ -f "$INSTALL_DIR/VERSION" ]; then + local current_version=$(cat "$INSTALL_DIR/VERSION") + print_info "Currently installed version: $current_version" + fi + + # In non-interactive environments (CI), automatically overwrite + if [ ! -t 0 ]; then + print_info "Non-interactive environment detected, automatically overwriting..." + else + # Interactive environment - ask for confirmation + echo + read -p "Do you want to overwrite it? (y/N): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + print_info "Installation cancelled." + exit 0 + fi + fi + + print_info "Removing existing installation..." + rm -rf "$INSTALL_DIR" + fi +} + +# Download and extract the release +download_release() { + local platform="$1" + local artifact="nomos-circuits-${VERSION}-${platform}.tar.gz" + local url="https://github.com/${REPO}/releases/download/${VERSION}/${artifact}" + local temp_dir=$(mktemp -d) + + print_info "Downloading nomos-circuits ${VERSION} for ${platform}..." + print_info "URL: $url" + + # Build curl command with optional authentication + local curl_cmd="curl -L" + if [ -n "$GITHUB_TOKEN" ]; then + curl_cmd="$curl_cmd --header 'authorization: Bearer ${GITHUB_TOKEN}'" + fi + curl_cmd="$curl_cmd -o ${temp_dir}/${artifact} $url" + + if ! eval "$curl_cmd"; then + print_error "Failed to download release artifact" + print_error "Please check that version ${VERSION} exists for platform ${platform}" + print_error "Available releases: https://github.com/${REPO}/releases" + rm -rf "$temp_dir" + exit 1 + fi + + print_success "Download complete" + + print_info "Extracting to ${INSTALL_DIR}..." + mkdir -p "$INSTALL_DIR" + + if ! tar -xzf "${temp_dir}/${artifact}" -C "$INSTALL_DIR" --strip-components=1; then + print_error "Failed to extract archive" + rm -rf "$temp_dir" + exit 1 + fi + + rm -rf "$temp_dir" + print_success "Extraction complete" +} + +# Handle macOS code signing/quarantine issues +handle_macos_quarantine() { + print_info "macOS detected: Removing quarantine attributes from executables..." + + # Remove quarantine attribute from all executable files + if find "$INSTALL_DIR" -type f -perm +111 -exec xattr -d com.apple.quarantine {} \; 2>/dev/null; then + print_success "Quarantine attributes removed" + else + print_warning "Could not remove quarantine attributes (they may not exist)" + fi +} + +# Main installation process +main() { + print_info "Setting up nomos-circuits ${VERSION}" + print_info "Installation directory: $INSTALL_DIR" + echo + + # Detect platform + local platform=$(detect_platform) + print_info "Detected platform: $platform" + + # Check existing installation + check_existing_installation + + # Download and extract + download_release "$platform" + + # Handle macOS quarantine if needed + if [[ "$platform" == macos-* ]]; then + echo + handle_macos_quarantine + fi + + echo + print_success "Installation complete!" + echo + print_info "nomos-circuits ${VERSION} is now installed at: $INSTALL_DIR" + print_info "The following circuits are available:" + + # Discover circuits by finding directories that contain a witness_generator + for dir in "$INSTALL_DIR"/*/; do + if [ -d "$dir" ]; then + local circuit_name=$(basename "$dir") + if [ -f "$dir/witness_generator" ]; then + echo " • $circuit_name" + fi + fi + done + + # Only show export instructions if not using the default location + if [ "$INSTALL_DIR" != "$DEFAULT_INSTALL_DIR" ]; then + echo + print_info "Since you're using a custom installation directory, set the environment variable:" + print_info " export NOMOS_CIRCUITS=$INSTALL_DIR" + echo + fi +} + +# Run main +main