Update README.md #161
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E | ||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| paths: | ||
| - "crates/**" | ||
| - "programs/**" | ||
| - "sdk/**" | ||
| - "console/**" | ||
| - "examples/**" | ||
| - "schemas/**" | ||
| - "docker-compose.yml" | ||
| - ".github/workflows/e2e.yml" | ||
| - "Cargo.lock" | ||
| - "pnpm-lock.yaml" | ||
| pull_request: | ||
| branches: ["main"] | ||
| paths: | ||
| - "crates/**" | ||
| - "programs/**" | ||
| - "sdk/**" | ||
| - "console/**" | ||
| - "examples/**" | ||
| - "schemas/**" | ||
| - "docker-compose.yml" | ||
| - ".github/workflows/e2e.yml" | ||
| - "Cargo.lock" | ||
| - "pnpm-lock.yaml" | ||
| workflow_dispatch: | ||
| concurrency: | ||
| group: e2e-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_BACKTRACE: 1 | ||
| NODE_VERSION: "20" | ||
| PNPM_VERSION: "9" | ||
| SOLANA_VERSION: "stable" | ||
| ANCHOR_VERSION: "latest" | ||
| SIGNIA_E2E_OUT: "/tmp/signia-e2e" | ||
| SIGNIA_API_URL: "http://127.0.0.1:8787" | ||
| jobs: | ||
| e2e: | ||
| name: End-to-end (compile → verify → publish → query) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Install system dependencies | ||
| run: | | ||
| set -euo pipefail | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| build-essential \ | ||
| pkg-config \ | ||
| libssl-dev \ | ||
| libudev-dev \ | ||
| curl \ | ||
| jq | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: "pnpm" | ||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: ${{ env.PNPM_VERSION }} | ||
| - name: Install JS dependencies (root) | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -f package.json ]; then | ||
| pnpm install --frozen-lockfile || pnpm install | ||
| else | ||
| echo "No root package.json; skipping JS install." | ||
| fi | ||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
| - name: Cache cargo | ||
| uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| cache-on-failure: true | ||
| - name: Build SIGNIA CLI + API (release) | ||
| run: | | ||
| set -euo pipefail | ||
| cargo build --release --locked --manifest-path crates/signia-cli/Cargo.toml | ||
| cargo build --release --locked --manifest-path crates/signia-api/Cargo.toml | ||
| mkdir -p "${SIGNIA_E2E_OUT}" | ||
| cp crates/signia-cli/target/release/signia "${SIGNIA_E2E_OUT}/signia" | ||
| echo "${SIGNIA_E2E_OUT}" >> "${GITHUB_PATH}" | ||
| - name: Print versions | ||
| run: | | ||
| set -euo pipefail | ||
| "${SIGNIA_E2E_OUT}/signia" --version || true | ||
| rustc -V | ||
| cargo -V | ||
| node -v | ||
| pnpm -v | ||
| # ----------------------------- | ||
| # Optional: Local Solana + Anchor program | ||
| # ----------------------------- | ||
| - name: Install Solana CLI (optional) | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| run: | | ||
| set -euo pipefail | ||
| sh -c "$(curl -sSfL https://release.solana.com/${SOLANA_VERSION}/install)" | ||
| echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" | ||
| solana --version | ||
| - name: Cache Solana CLI | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.local/share/solana | ||
| key: solana-${{ runner.os }}-${{ env.SOLANA_VERSION }} | ||
| - name: Install Anchor (optional) | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| run: | | ||
| set -euo pipefail | ||
| cargo install --git https://github.com/coral-xyz/anchor avm --locked | ||
| avm install ${ANCHOR_VERSION} | ||
| avm use ${ANCHOR_VERSION} | ||
| anchor --version | ||
| - name: Start solana-test-validator (optional) | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| run: | | ||
| set -euo pipefail | ||
| solana-test-validator --reset --quiet & | ||
| echo $! > /tmp/solana-validator.pid | ||
| # Wait for RPC | ||
| for i in $(seq 1 60); do | ||
| if solana cluster-version --url http://127.0.0.1:8899 >/dev/null 2>&1; then | ||
| echo "Solana RPC is ready." | ||
| break | ||
| fi | ||
| sleep 1 | ||
| done | ||
| solana config set --url http://127.0.0.1:8899 | ||
| solana airdrop 10 || true | ||
| - name: Build + deploy registry program (optional) | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| working-directory: programs/signia-registry | ||
| run: | | ||
| set -euo pipefail | ||
| anchor build | ||
| # In localnet, anchor deploy typically uses Anchor.toml provider config. | ||
| anchor deploy | ||
| # ----------------------------- | ||
| # Start API service (background) | ||
| # ----------------------------- | ||
| - name: Start SIGNIA API (background) | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p "${SIGNIA_E2E_OUT}/logs" | ||
| # Expect your API to support these env vars; adjust later to your actual config keys. | ||
| export SIGNIA_API_BIND="127.0.0.1:8787" | ||
| export SIGNIA_STORE_DIR="${SIGNIA_E2E_OUT}/store" | ||
| export RUST_LOG="info" | ||
| # If your API uses a config file, replace this with `--config`. | ||
| crates/signia-api/target/release/signia-api > "${SIGNIA_E2E_OUT}/logs/api.log" 2>&1 & | ||
| echo $! > /tmp/signia-api.pid | ||
| # Wait for health endpoint (assumes /health exists) | ||
| for i in $(seq 1 60); do | ||
| if curl -fsS "${SIGNIA_API_URL}/health" >/dev/null 2>&1; then | ||
| echo "SIGNIA API is ready." | ||
| break | ||
| fi | ||
| sleep 1 | ||
| done | ||
| # ----------------------------- | ||
| # E2E flow: compile → verify → publish → query | ||
| # ----------------------------- | ||
| - name: Compile (example: OpenAPI) | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p "${SIGNIA_E2E_OUT}/run" | ||
| # Use an example file in the repo. Adjust the path to match your final examples directory. | ||
| "${SIGNIA_E2E_OUT}/signia" compile \ | ||
| --input "file:examples/openapi/petstore.yaml" \ | ||
| --out "${SIGNIA_E2E_OUT}/run/openapi" \ | ||
| --format bundle | ||
| test -f "${SIGNIA_E2E_OUT}/run/openapi/schema.json" | ||
| test -f "${SIGNIA_E2E_OUT}/run/openapi/manifest.json" | ||
| test -f "${SIGNIA_E2E_OUT}/run/openapi/proof.json" | ||
| - name: Verify bundle | ||
| run: | | ||
| set -euo pipefail | ||
| "${SIGNIA_E2E_OUT}/signia" verify \ | ||
| --bundle "${SIGNIA_E2E_OUT}/run/openapi" \ | ||
| --schemas "./schemas/v1" | ||
| - name: Publish to registry (optional) | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Assumes CLI has a publish command that can target a registry program on localnet. | ||
| "${SIGNIA_E2E_OUT}/signia" publish \ | ||
| --cluster localnet \ | ||
| --rpc http://127.0.0.1:8899 \ | ||
| --bundle "${SIGNIA_E2E_OUT}/run/openapi" \ | ||
| --program-id auto \ | ||
| --commitment confirmed | ||
| - name: Query registry (optional) | ||
| if: ${{ hashFiles('programs/signia-registry/Anchor.toml') != '' }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Example query by schema hash produced in schema.json. | ||
| SCHEMA_HASH="$(jq -r '.schema_hash' "${SIGNIA_E2E_OUT}/run/openapi/schema.json")" | ||
| test -n "${SCHEMA_HASH}" | ||
| "${SIGNIA_E2E_OUT}/signia" fetch \ | ||
| --cluster localnet \ | ||
| --rpc http://127.0.0.1:8899 \ | ||
| --schema-hash "${SCHEMA_HASH}" \ | ||
| --out "${SIGNIA_E2E_OUT}/run/fetched.json" | ||
| test -f "${SIGNIA_E2E_OUT}/run/fetched.json" | ||
| - name: API compile endpoint smoke test | ||
| run: | | ||
| set -euo pipefail | ||
| # Assumes API provides POST /v1/compile accepting JSON; adjust to your final OpenAPI. | ||
| # This is a smoke test placeholder; keep it simple. | ||
| curl -fsS "${SIGNIA_API_URL}/health" | cat | ||
| # ----------------------------- | ||
| # Cleanup | ||
| # ----------------------------- | ||
| - name: Stop services | ||
| if: always() | ||
| run: | | ||
| set +e | ||
| if [ -f /tmp/signia-api.pid ]; then | ||
| kill "$(cat /tmp/signia-api.pid)" || true | ||
| fi | ||
| if [ -f /tmp/solana-validator.pid ]; then | ||
| kill "$(cat /tmp/solana-validator.pid)" || true | ||
| fi | ||
| - name: Upload logs on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: e2e-logs | ||
| path: | | ||
| /tmp/signia-e2e/logs | ||
| /tmp/signia-e2e/run | ||
| if-no-files-found: warn | ||