Skip to content

Commit f9a431b

Browse files
authored
Add files via upload
1 parent b2a267f commit f9a431b

9 files changed

Lines changed: 264 additions & 0 deletions

File tree

scripts/anchor_build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "${ROOT_DIR}"
6+
7+
if ! command -v anchor >/dev/null 2>&1; then
8+
echo "anchor not found."
9+
echo "Install Anchor: https://www.anchor-lang.com/docs/installation"
10+
exit 1
11+
fi
12+
13+
echo "== anchor_build =="
14+
(cd programs/signia-registry && anchor build)
15+
echo "done"

scripts/bootstrap.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# SIGNIA bootstrap script
5+
# Installs/validates required toolchains and common dependencies.
6+
#
7+
# This script is intentionally conservative and avoids sudo.
8+
# It prints actionable instructions if something is missing.
9+
10+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
11+
12+
has() { command -v "$1" >/dev/null 2>&1; }
13+
14+
echo "== SIGNIA bootstrap =="
15+
echo "repo: ${ROOT_DIR}"
16+
17+
# ---- Rust ----
18+
if ! has rustup; then
19+
echo "rustup not found."
20+
echo "Install rustup: https://rustup.rs"
21+
exit 1
22+
fi
23+
24+
echo "checking Rust toolchain..."
25+
rustup show >/dev/null 2>&1 || true
26+
rustup toolchain install stable -q || true
27+
rustup default stable >/dev/null 2>&1 || true
28+
rustup component add clippy rustfmt >/dev/null 2>&1 || true
29+
30+
echo "Rust OK: $(rustc --version)"
31+
32+
# ---- Node ----
33+
if ! has node; then
34+
echo "node not found."
35+
echo "Install Node.js >= 18 (recommend 20): https://nodejs.org"
36+
exit 1
37+
fi
38+
39+
NODE_MAJOR="$(node -p "process.versions.node.split('.')[0]")"
40+
if [ "${NODE_MAJOR}" -lt 18 ]; then
41+
echo "Node.js >= 18 required. Found: $(node --version)"
42+
exit 1
43+
fi
44+
echo "Node OK: $(node --version)"
45+
46+
if has corepack; then
47+
corepack enable >/dev/null 2>&1 || true
48+
fi
49+
50+
# ---- Solana ----
51+
if ! has solana; then
52+
echo "solana CLI not found."
53+
echo "Install: https://docs.solana.com/cli/install-solana-cli-tools"
54+
echo "Proceeding without Solana tooling."
55+
else
56+
echo "Solana OK: $(solana --version)"
57+
fi
58+
59+
# ---- Anchor ----
60+
if ! has anchor; then
61+
echo "anchor not found."
62+
echo "Install Anchor: https://www.anchor-lang.com/docs/installation"
63+
echo "Proceeding without Anchor tooling."
64+
else
65+
echo "Anchor OK: $(anchor --version)"
66+
fi
67+
68+
# ---- Docker ----
69+
if ! has docker; then
70+
echo "docker not found (optional for e2e/local stack)."
71+
else
72+
echo "Docker OK: $(docker --version)"
73+
fi
74+
75+
echo
76+
echo "Bootstrap complete."
77+
echo "Next:"
78+
echo " bash scripts/build_all.sh"
79+
echo " bash scripts/test_all.sh"

scripts/build_all.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "${ROOT_DIR}"
6+
7+
echo "== build_all =="
8+
9+
echo "-- building Rust workspace --"
10+
cargo build --workspace
11+
12+
if [ -d "console/web" ]; then
13+
echo "-- building console/web --"
14+
(cd console/web && npm install && npm run build)
15+
fi
16+
17+
if [ -d "console/interface" ]; then
18+
echo "-- building console/interface --"
19+
(cd console/interface && npm install && npm run build)
20+
fi
21+
22+
if [ -d "sdk/ts" ]; then
23+
echo "-- building sdk/ts --"
24+
(cd sdk/ts && npm install && npm run build)
25+
fi
26+
27+
echo "done"

scripts/devnet_airdrop.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Requests an airdrop on Solana devnet for the currently configured keypair.
5+
6+
if ! command -v solana >/dev/null 2>&1; then
7+
echo "solana CLI not found."
8+
exit 1
9+
fi
10+
11+
AMOUNT="${1:-2}"
12+
solana config set --url https://api.devnet.solana.com >/dev/null
13+
PUBKEY="$(solana address)"
14+
echo "requesting airdrop: ${AMOUNT} SOL to ${PUBKEY}"
15+
solana airdrop "${AMOUNT}" "${PUBKEY}"
16+
solana balance

scripts/generate_openapi.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Generates OpenAPI spec from signia-api (if the project uses utoipa/axum integration),
5+
# or copies the committed docs/api/openapi.yaml into the crate output.
6+
#
7+
# This script is best-effort: the repository may ship the OpenAPI spec as a source file.
8+
9+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10+
cd "${ROOT_DIR}"
11+
12+
SRC="docs/api/openapi.yaml"
13+
OUT="docs/api/openapi.generated.yaml"
14+
15+
if [ -f "${SRC}" ]; then
16+
cp "${SRC}" "${OUT}"
17+
echo "generated: ${OUT} (copied from ${SRC})"
18+
else
19+
echo "openapi source not found at ${SRC}"
20+
exit 1
21+
fi

scripts/lint_all.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "${ROOT_DIR}"
6+
7+
echo "== lint_all =="
8+
9+
echo "-- rustfmt --"
10+
cargo fmt --all -- --check
11+
12+
echo "-- clippy --"
13+
cargo clippy --workspace --all-targets -- -D warnings
14+
15+
if [ -d "console/web" ]; then
16+
echo "-- eslint console/web (best-effort) --"
17+
(cd console/web && npm install && npm run lint) || echo "skip: console/web lint failed or not configured"
18+
fi
19+
20+
if [ -d "console/interface" ]; then
21+
echo "-- eslint console/interface (best-effort) --"
22+
(cd console/interface && npm install && npm run lint) || echo "skip: console/interface lint failed or not configured"
23+
fi
24+
25+
echo "done"

scripts/local_solana.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Starts a local solana-test-validator configured for Anchor.
5+
# This is optional and used for local development.
6+
7+
if ! command -v solana-test-validator >/dev/null 2>&1; then
8+
echo "solana-test-validator not found. Install Solana CLI."
9+
exit 1
10+
fi
11+
12+
LEDGER_DIR="${LEDGER_DIR:-.solana/test-ledger}"
13+
RESET="${RESET:-1}"
14+
15+
ARGS=("--ledger" "${LEDGER_DIR}" "--rpc-port" "8899" "--faucet-port" "9900")
16+
if [ "${RESET}" = "1" ]; then
17+
ARGS+=("--reset")
18+
fi
19+
20+
echo "starting solana-test-validator..."
21+
echo "ledger: ${LEDGER_DIR}"
22+
solana-test-validator "${ARGS[@]}"

scripts/release.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Local release helper.
5+
# This script does NOT publish automatically. It builds artifacts and prints next steps.
6+
7+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8+
cd "${ROOT_DIR}"
9+
10+
VERSION="${1:-}"
11+
if [ -z "${VERSION}" ]; then
12+
echo "usage: bash scripts/release.sh <version>"
13+
exit 1
14+
fi
15+
16+
echo "== release ${VERSION} =="
17+
18+
echo "-- build workspace --"
19+
cargo build --workspace --release
20+
21+
echo "-- build ts sdk --"
22+
if [ -d "sdk/ts" ]; then
23+
(cd sdk/ts && npm install && npm run build)
24+
fi
25+
26+
echo "-- build console --"
27+
if [ -d "console/web" ]; then
28+
(cd console/web && npm install && npm run build)
29+
fi
30+
if [ -d "console/interface" ]; then
31+
(cd console/interface && npm install && npm run build)
32+
fi
33+
34+
echo
35+
echo "Artifacts are built."
36+
echo "Next steps (manual):"
37+
echo " - tag git: git tag v${VERSION} && git push --tags"
38+
echo " - create GitHub release (attach artifacts if needed)"
39+
echo " - publish npm package from sdk/ts"
40+
echo " - publish python package from sdk/python"

scripts/test_all.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
cd "${ROOT_DIR}"
6+
7+
echo "== test_all =="
8+
9+
echo "-- rust tests --"
10+
cargo test --workspace
11+
12+
if [ -d "programs/signia-registry" ] && command -v anchor >/dev/null 2>&1; then
13+
echo "-- anchor tests (optional) --"
14+
(cd programs/signia-registry && anchor test) || echo "skip: anchor tests failed"
15+
else
16+
echo "skip: anchor not installed or program missing"
17+
fi
18+
19+
echo "done"

0 commit comments

Comments
 (0)