Skip to content

docs: add system architecture diagrams and documentation landing page #49

docs: add system architecture diagrams and documentation landing page

docs: add system architecture diagrams and documentation landing page #49

Workflow file for this run

name: StellarID CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
SOROBAN_CLI_VERSION: 22.0.0
jobs:
test-contracts:
name: Test Soroban Contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install soroban-cli
run: cargo install soroban-cli --version ${{ env.SOROBAN_CLI_VERSION }}
- name: Test credential_nft
run: cd contracts/credential_nft && cargo test
- name: Test revocation_registry
run: cd contracts/revocation_registry && cargo test
- name: Test disclosure_contract
run: cd contracts/disclosure_contract && cargo test
- name: Build contracts (WASM)
run: |
cd contracts/credential_nft && cargo build --target wasm32-unknown-unknown --release
cd ../../contracts/revocation_registry && cargo build --target wasm32-unknown-unknown --release
cd ../../contracts/disclosure_contract && cargo build --target wasm32-unknown-unknown --release
- name: Upload WASM artifacts
uses: actions/upload-artifact@v3
with:
name: contract-wasms
path: contracts/*/target/wasm32-unknown-unknown/release/*.wasm
test-backend:
name: Test Backend
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: stellarid_test
POSTGRES_USER: stellarid_user
POSTGRES_PASSWORD: stellarid_pass
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: backend/package-lock.json
- name: Install dependencies
run: cd backend && npm ci
- name: Type check
run: cd backend && npx tsc --noEmit
- name: Run migrations
env:
DATABASE_URL: postgresql://stellarid_user:stellarid_pass@localhost:5432/stellarid_test
run: cd backend && npm run migrate
- name: Run tests
env:
DATABASE_URL: postgresql://stellarid_user:stellarid_pass@localhost:5432/stellarid_test
REDIS_URL: redis://localhost:6379
JWT_SECRET: test_secret_key
STELLAR_NETWORK: testnet
STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org
STELLAR_PASSPHRASE: "Test SDF Network ; September 2015"
CREDENTIAL_NFT_CONTRACT_ID: test_contract_id
REVOCATION_CONTRACT_ID: test_contract_id
DISCLOSURE_CONTRACT_ID: test_contract_id
run: cd backend && npm test -- --coverage
test-zk-circuits:
name: Test ZK Circuits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install circom
run: |
curl -L https://github.com/iden3/circom/releases/latest/download/circom-linux-amd64 \
-o /usr/local/bin/circom
chmod +x /usr/local/bin/circom
circom --version
- name: Install snarkjs
run: npm install -g snarkjs
- name: Install zk-circuits deps
run: cd zk-circuits && npm ci
- name: Download ptau
run: bash scripts/setup-ptau.sh
- name: Compile and test age_check circuit
run: |
cd zk-circuits
circom age_check.circom --r1cs --wasm --sym -o build/
snarkjs groth16 setup build/age_check.r1cs pot12_final.ptau build/age_check_0000.zkey
snarkjs zkey contribute build/age_check_0000.zkey build/age_check_final.zkey \
--name="CI test" -e="test entropy 12345"
snarkjs zkey export verificationkey build/age_check_final.zkey \
build/age_check_verification_key.json
echo "age_check circuit compiled and setup complete"
test-frontend:
name: Test Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: cd frontend && npm ci
- name: Type check
run: cd frontend && npx tsc --noEmit
- name: Lint
run: cd frontend && npm run lint
- name: Build
env:
NEXT_PUBLIC_API_URL: http://localhost:4000/api/v1
run: cd frontend && npm run build
security-audit:
name: Security Audit
runs-on: ubuntu-latest
needs: [test-backend, test-frontend]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Audit backend
run: cd backend && npm audit --audit-level=high || true
- name: Audit frontend
run: cd frontend && npm audit --audit-level=high || true
- name: Install Slither
run: pip3 install slither-analyzer
- name: Run Slither on ZK verifiers
run: |
if ls zk-circuits/build/*_verifier.sol 2>/dev/null; then
slither zk-circuits/build/ --exclude-dependencies || true
else
echo "No Solidity verifiers found, skipping Slither"
fi
deploy-testnet:
name: Deploy to Testnet
runs-on: ubuntu-latest
needs: [test-contracts, test-backend, test-frontend, security-audit]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Download WASM artifacts
uses: actions/download-artifact@v3
with:
name: contract-wasms
- name: Install soroban-cli
run: cargo install soroban-cli --version ${{ env.SOROBAN_CLI_VERSION }}
- name: Deploy contracts
env:
STELLAR_SECRET_KEY: ${{ secrets['STELLAR_ADMIN_SECRET'] }}
run: bash scripts/deploy-contracts.sh
- name: Deploy backend to Render
run: echo "Render automatically deploys on push to main branch."
- name: Deploy frontend
env:
VERCEL_TOKEN: ${{ secrets['VERCEL_TOKEN'] }}
run: npx vercel --prod --token=$VERCEL_TOKEN