mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
Delete the workflows the forge never reads
git.hanzo.ai resolves .hanzo/workflows and stops there, so these ran on no push and reported green on every one. CI is native and lives in .hanzo/workflows.
This commit is contained in:
@@ -1,510 +0,0 @@
|
||||
name: Full Integration Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
schedule:
|
||||
# Run comprehensive tests daily at 3 AM UTC
|
||||
- cron: '0 3 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
full-integration:
|
||||
name: Full System Integration Test
|
||||
runs-on: lux-build-amd64
|
||||
timeout-minutes: 30
|
||||
|
||||
services:
|
||||
# Database for Bridge
|
||||
postgres-bridge:
|
||||
image: ghcr.io/hanzoai/sql:latest
|
||||
env:
|
||||
POSTGRES_USER: bridge
|
||||
POSTGRES_PASSWORD: bridge
|
||||
POSTGRES_DB: bridge
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
# Database for Lux ID (Casdoor)
|
||||
postgres-id:
|
||||
image: ghcr.io/hanzoai/sql:latest
|
||||
env:
|
||||
POSTGRES_USER: casdoor
|
||||
POSTGRES_PASSWORD: casdoor
|
||||
POSTGRES_DB: casdoor
|
||||
ports:
|
||||
- 5434:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
# NATS for messaging
|
||||
nats:
|
||||
image: nats:2.10-alpine
|
||||
ports:
|
||||
- 4222:4222
|
||||
- 8222:8222
|
||||
options: >-
|
||||
--health-cmd "nc -z localhost 4222"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
# Consul for service discovery
|
||||
consul:
|
||||
image: hashicorp/consul:1.16
|
||||
ports:
|
||||
- 8500:8500
|
||||
options: >-
|
||||
--health-cmd "consul members"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
# Vault for KMS
|
||||
vault:
|
||||
image: hashicorp/vault:1.16
|
||||
env:
|
||||
VAULT_DEV_ROOT_TOKEN_ID: root-token
|
||||
VAULT_DEV_LISTEN_ADDRESS: "0.0.0.0:8200"
|
||||
ports:
|
||||
- 8200:8200
|
||||
options: >-
|
||||
--cap-add=IPC_LOCK
|
||||
--health-cmd "vault status"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
# Redis for caching
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- 6379:6379
|
||||
options: >-
|
||||
--health-cmd "redis-cli ping"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.26.4'
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9.15.0
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# Node dependencies
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
# Install Go dependencies for MPC
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Initialize Vault KMS
|
||||
env:
|
||||
VAULT_ADDR: http://localhost:8200
|
||||
VAULT_TOKEN: root-token
|
||||
run: |
|
||||
echo "=== Initializing Vault KMS ==="
|
||||
|
||||
# Wait for Vault to be ready
|
||||
sleep 5
|
||||
|
||||
# Enable KV secrets engine
|
||||
vault secrets enable -path=secret kv-v2
|
||||
|
||||
# Create MPC keys path
|
||||
vault kv put secret/mpc/keys \
|
||||
node0_key="mock-key-node0" \
|
||||
node1_key="mock-key-node1" \
|
||||
node2_key="mock-key-node2"
|
||||
|
||||
# Create bridge signing keys
|
||||
vault kv put secret/bridge/signing \
|
||||
ethereum_key="mock-eth-key" \
|
||||
bsc_key="mock-bsc-key"
|
||||
|
||||
echo "✅ Vault KMS initialized"
|
||||
|
||||
- name: Start Casdoor (Lux ID)
|
||||
run: |
|
||||
echo "=== Starting Lux ID (Casdoor) ==="
|
||||
|
||||
# Create Casdoor config directory
|
||||
mkdir -p config/casdoor
|
||||
|
||||
# Run Casdoor in background
|
||||
docker run -d \
|
||||
--name casdoor \
|
||||
--network host \
|
||||
-v $(pwd)/config/casdoor:/conf \
|
||||
-e RUNNING_IN_DOCKER=true \
|
||||
casbin/casdoor:latest
|
||||
|
||||
# Wait for Casdoor to start
|
||||
sleep 10
|
||||
|
||||
# Check if Casdoor is running
|
||||
curl -f http://localhost:8000 || echo "Casdoor may still be starting"
|
||||
|
||||
echo "✅ Lux ID (Casdoor) started"
|
||||
|
||||
- name: Install and Configure MPC Tools
|
||||
run: |
|
||||
echo "=== Installing MPC Tools ==="
|
||||
|
||||
# For CI, we'll use mock MPC tools
|
||||
mkdir -p $HOME/go/bin
|
||||
|
||||
# Create realistic mock MPC binary
|
||||
cat > $HOME/go/bin/lux-mpc << 'EOF'
|
||||
#!/bin/bash
|
||||
case "$1" in
|
||||
"start")
|
||||
echo "Starting MPC node $2..."
|
||||
# Simulate MPC node startup
|
||||
sleep 2
|
||||
echo "MPC node $2 started successfully"
|
||||
# Keep running
|
||||
while true; do
|
||||
sleep 60
|
||||
echo "MPC node $2 heartbeat"
|
||||
done
|
||||
;;
|
||||
"keygen")
|
||||
echo "Generating distributed key..."
|
||||
sleep 3
|
||||
echo '{"public_key": "0x04abc...def", "key_shares": 3}'
|
||||
;;
|
||||
"sign")
|
||||
echo "Creating threshold signature..."
|
||||
sleep 2
|
||||
echo '{"signature": "0x1234...5678", "signers": ["node0", "node1"]}'
|
||||
;;
|
||||
*)
|
||||
echo "MPC node mock"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
|
||||
# Create realistic mock MPC CLI
|
||||
cat > $HOME/go/bin/lux-mpc-cli << 'EOF'
|
||||
#!/bin/bash
|
||||
case "$1" in
|
||||
"status")
|
||||
echo '{"status": "healthy", "nodes": 3, "threshold": 2}'
|
||||
;;
|
||||
"generate-peers")
|
||||
echo '{"peers": [{"id": "node0", "addr": "localhost:6000"}, {"id": "node1", "addr": "localhost:6001"}, {"id": "node2", "addr": "localhost:6002"}]}' > ${3:-peers.json}
|
||||
;;
|
||||
"test-sign")
|
||||
echo "Testing signature generation..."
|
||||
echo '{"test": "passed", "signature": "0xabc...123"}'
|
||||
;;
|
||||
*)
|
||||
echo "MPC CLI mock"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod +x $HOME/go/bin/lux-mpc*
|
||||
|
||||
echo "✅ MPC tools installed"
|
||||
|
||||
- name: Prepare test environment
|
||||
run: |
|
||||
# Create necessary directories
|
||||
mkdir -p config/mpc data/mpc/node{0,1,2} logs
|
||||
|
||||
# Generate MPC configuration
|
||||
cat > config/mpc/config.yaml << EOF
|
||||
network:
|
||||
name: bridge-mpc-integration
|
||||
threshold: 2
|
||||
total_nodes: 3
|
||||
|
||||
nats:
|
||||
url: nats://localhost:4222
|
||||
subject_prefix: integration.bridge.mpc
|
||||
|
||||
consul:
|
||||
url: http://localhost:8500
|
||||
service_name: integration-bridge-mpc
|
||||
|
||||
vault:
|
||||
url: http://localhost:8200
|
||||
token: root-token
|
||||
path: secret/mpc
|
||||
|
||||
casdoor:
|
||||
endpoint: http://localhost:8000
|
||||
client_id: integration-test
|
||||
organization: lux-network
|
||||
EOF
|
||||
|
||||
# Generate peers configuration
|
||||
lux-mpc-cli generate-peers --number 3 --output config/mpc/peers.json
|
||||
|
||||
- name: Start MPC Network
|
||||
env:
|
||||
VAULT_ADDR: http://localhost:8200
|
||||
VAULT_TOKEN: root-token
|
||||
CASDOOR_ENDPOINT: http://localhost:8000
|
||||
run: |
|
||||
echo "=== Starting MPC Network ==="
|
||||
|
||||
# Start 3 MPC nodes
|
||||
for i in 0 1 2; do
|
||||
NODE_ID=node$i NODE_PORT=$((6000 + i)) GRPC_PORT=$((9090 + i)) \
|
||||
DATA_DIR=./data/mpc/node$i CONFIG_PATH=./config/mpc/config.yaml \
|
||||
PEERS_PATH=./config/mpc/peers.json \
|
||||
lux-mpc start --name node$i > logs/node$i.log 2>&1 &
|
||||
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Wait for initialization
|
||||
sleep 10
|
||||
|
||||
# Verify nodes are running
|
||||
ps aux | grep lux-mpc | grep -v grep
|
||||
echo "✅ MPC network started with $(ps aux | grep lux-mpc | grep -v grep | wc -l) nodes"
|
||||
|
||||
- name: Run database migrations
|
||||
working-directory: ./app/server
|
||||
env:
|
||||
DATABASE_URL: postgresql://bridge:bridge@localhost:5432/bridge
|
||||
run: |
|
||||
# Run Prisma migrations if available
|
||||
pnpm run prisma:gen || echo "No Prisma"
|
||||
|
||||
# Run SQL migrations
|
||||
psql -h localhost -U bridge -d bridge -f ../../scripts/init.sql
|
||||
|
||||
- name: Start Bridge Server
|
||||
working-directory: ./app/server
|
||||
env:
|
||||
NODE_ENV: test
|
||||
PORT: 5000
|
||||
DATABASE_URL: postgresql://bridge:bridge@localhost:5432/bridge
|
||||
NATS_URL: nats://localhost:4222
|
||||
CONSUL_URL: http://localhost:8500
|
||||
VAULT_ADDR: http://localhost:8200
|
||||
VAULT_TOKEN: root-token
|
||||
AUTH_PROVIDER: casdoor
|
||||
CASDOOR_ENDPOINT: http://localhost:8000
|
||||
CASDOOR_CLIENT_ID: integration-test
|
||||
REDIS_URL: redis://localhost:6379
|
||||
run: |
|
||||
pnpm run build
|
||||
pnpm start > ../../logs/bridge-server.log 2>&1 &
|
||||
|
||||
# Wait for server to start
|
||||
sleep 15
|
||||
|
||||
# Check if server is running
|
||||
curl -f http://localhost:5000/health || (cat ../../logs/bridge-server.log && exit 1)
|
||||
|
||||
- name: Test ID (Casdoor) Integration
|
||||
run: |
|
||||
echo "=== Testing Lux ID Integration ==="
|
||||
|
||||
# Test Casdoor health
|
||||
curl -f http://localhost:8000/api/health || echo "Casdoor health check failed"
|
||||
|
||||
# Test authentication endpoint
|
||||
curl -f http://localhost:5000/api/auth/providers || echo "Auth providers endpoint failed"
|
||||
|
||||
echo "✅ ID integration tests passed"
|
||||
|
||||
- name: Test KMS (Vault) Integration
|
||||
env:
|
||||
VAULT_ADDR: http://localhost:8200
|
||||
VAULT_TOKEN: root-token
|
||||
run: |
|
||||
echo "=== Testing KMS Integration ==="
|
||||
|
||||
# Test reading MPC keys from Vault
|
||||
vault kv get secret/mpc/keys
|
||||
|
||||
# Test Bridge server can access Vault
|
||||
curl -f http://localhost:5000/api/kms/status || echo "KMS status endpoint not implemented"
|
||||
|
||||
echo "✅ KMS integration tests passed"
|
||||
|
||||
- name: Test MPC Integration
|
||||
run: |
|
||||
echo "=== Testing MPC Integration ==="
|
||||
|
||||
# Test MPC status through Bridge API
|
||||
curl -f http://localhost:5000/api/mpc/status || echo "MPC status check failed"
|
||||
|
||||
# Test direct MPC operations
|
||||
lux-mpc-cli status --url http://localhost:6000
|
||||
|
||||
# Test key generation
|
||||
lux-mpc-cli test-sign --url http://localhost:6000
|
||||
|
||||
echo "✅ MPC integration tests passed"
|
||||
|
||||
- name: Test Full Bridge Flow
|
||||
run: |
|
||||
echo "=== Testing Full Bridge Flow ==="
|
||||
|
||||
# Test complete flow: Auth -> KMS -> MPC -> Bridge operation
|
||||
|
||||
# 1. Mock authentication
|
||||
echo "1. Testing authentication..."
|
||||
AUTH_TOKEN="mock-auth-token"
|
||||
|
||||
# 2. Test swap initiation (requires all components)
|
||||
echo "2. Testing swap initiation..."
|
||||
curl -X POST http://localhost:5000/api/swaps \
|
||||
-H "Authorization: Bearer $AUTH_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"from_network": "ethereum",
|
||||
"to_network": "bsc",
|
||||
"from_token": "USDT",
|
||||
"to_token": "USDT",
|
||||
"amount": "100",
|
||||
"to_address": "0x123...abc"
|
||||
}' || echo "Swap initiation test skipped"
|
||||
|
||||
# 3. Test component health checks
|
||||
echo "3. Testing all component health..."
|
||||
curl -f http://localhost:5000/api/health/full || echo "Full health check not implemented"
|
||||
|
||||
echo "✅ Full integration flow tested"
|
||||
|
||||
- name: Run Integration Test Scripts
|
||||
run: |
|
||||
# Run any existing integration test scripts
|
||||
if [ -f "./test/test-bridge-integration.sh" ]; then
|
||||
chmod +x ./test/test-bridge-integration.sh
|
||||
./test/test-bridge-integration.sh || echo "Bridge integration test failed"
|
||||
fi
|
||||
|
||||
if [ -f "./test/test-mpc-complete.sh" ]; then
|
||||
chmod +x ./test/test-mpc-complete.sh
|
||||
./test/test-mpc-complete.sh || echo "MPC complete test failed"
|
||||
fi
|
||||
|
||||
echo "✅ Integration test scripts completed"
|
||||
|
||||
- name: Test Service Discovery
|
||||
run: |
|
||||
echo "=== Testing Service Discovery ==="
|
||||
|
||||
# Check Consul for registered services
|
||||
curl -s http://localhost:8500/v1/catalog/services | jq .
|
||||
|
||||
# Verify MPC nodes registered in Consul
|
||||
curl -s http://localhost:8500/v1/health/service/integration-bridge-mpc | jq '.[] | {Node: .Node.Node, Status: .Checks[].Status}'
|
||||
|
||||
echo "✅ Service discovery tests passed"
|
||||
|
||||
- name: Test Message Queue
|
||||
run: |
|
||||
echo "=== Testing Message Queue ==="
|
||||
|
||||
# Check NATS connectivity
|
||||
curl -s http://localhost:8222/varz | jq '{server_id: .server_id, connections: .connections, messages: .in_msgs}'
|
||||
|
||||
echo "✅ Message queue tests passed"
|
||||
|
||||
- name: Collect logs on failure
|
||||
if: failure()
|
||||
run: |
|
||||
echo "=== Collecting logs ==="
|
||||
echo "--- Bridge Server Log ---"
|
||||
cat logs/bridge-server.log || true
|
||||
echo "--- MPC Node Logs ---"
|
||||
for log in logs/node*.log; do
|
||||
echo "--- $log ---"
|
||||
head -100 "$log" || true
|
||||
done
|
||||
echo "--- Casdoor Log ---"
|
||||
docker logs casdoor || true
|
||||
|
||||
- name: Upload test artifacts
|
||||
if: always()
|
||||
# v3, not v4+: this runs on git.hanzo.ai, which presents as GHES, and
|
||||
# the v4 action refuses outright -- "@actions/artifact v2.0.0+ ... are not
|
||||
# currently supported on GHES". The job does its work and then discards the
|
||||
# artifact at the last step, so a successful run reads as a failed one.
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: integration-test-artifacts
|
||||
path: |
|
||||
logs/
|
||||
config/
|
||||
test-results/
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
# Stop Casdoor container
|
||||
docker stop casdoor || true
|
||||
docker rm casdoor || true
|
||||
|
||||
# Kill MPC processes
|
||||
pkill -f lux-mpc || true
|
||||
|
||||
performance-test:
|
||||
name: Performance and Load Testing
|
||||
runs-on: lux-build-amd64
|
||||
needs: full-integration
|
||||
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run load tests
|
||||
run: |
|
||||
echo "=== Running Performance Tests ==="
|
||||
# Add actual load testing here
|
||||
echo "Performance tests would run here"
|
||||
|
||||
security-audit:
|
||||
name: Security Audit
|
||||
runs-on: lux-build-amd64
|
||||
needs: full-integration
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run security scans
|
||||
run: |
|
||||
echo "=== Running Security Audit ==="
|
||||
# Add comprehensive security scanning
|
||||
echo "Security audit would run here"
|
||||
@@ -1,253 +0,0 @@
|
||||
name: Integration Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
schedule:
|
||||
# Run daily at 2 AM UTC
|
||||
- cron: '0 2 * * *'
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
name: E2E Integration Tests
|
||||
runs-on: lux-build-amd64
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: ghcr.io/hanzoai/sql:latest
|
||||
env:
|
||||
POSTGRES_USER: bridge
|
||||
POSTGRES_PASSWORD: bridge
|
||||
POSTGRES_DB: bridge
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
nats:
|
||||
image: nats:2.10-alpine
|
||||
ports:
|
||||
- 4222:4222
|
||||
options: >-
|
||||
--health-cmd "nc -z localhost 4222"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
consul:
|
||||
image: hashicorp/consul:1.16
|
||||
ports:
|
||||
- 8500:8500
|
||||
options: >-
|
||||
--health-cmd "consul members"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.26.4'
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18.x'
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9.15.0
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# Add Go bin to PATH
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
# Create mock MPC tools for CI
|
||||
mkdir -p $HOME/go/bin
|
||||
echo '#!/bin/bash' > $HOME/go/bin/lux-mpc
|
||||
echo 'echo "Mock MPC node running..."' >> $HOME/go/bin/lux-mpc
|
||||
echo 'sleep infinity' >> $HOME/go/bin/lux-mpc
|
||||
chmod +x $HOME/go/bin/lux-mpc
|
||||
|
||||
echo '#!/bin/bash' > $HOME/go/bin/lux-mpc-cli
|
||||
echo 'case "$1" in' >> $HOME/go/bin/lux-mpc-cli
|
||||
echo ' "generate-peers") echo "{\"peers\":[]}" > $3;;' >> $HOME/go/bin/lux-mpc-cli
|
||||
echo ' "status") echo "Node is healthy";;' >> $HOME/go/bin/lux-mpc-cli
|
||||
echo ' *) echo "Mock MPC CLI";;' >> $HOME/go/bin/lux-mpc-cli
|
||||
echo 'esac' >> $HOME/go/bin/lux-mpc-cli
|
||||
echo 'exit 0' >> $HOME/go/bin/lux-mpc-cli
|
||||
chmod +x $HOME/go/bin/lux-mpc-cli
|
||||
|
||||
# Node dependencies
|
||||
pnpm install --no-frozen-lockfile
|
||||
|
||||
- name: Start infrastructure with Docker Compose
|
||||
run: |
|
||||
# Start only the core infrastructure services
|
||||
echo "Infrastructure services provided by GitHub Actions"
|
||||
|
||||
- name: Prepare MPC configuration
|
||||
run: |
|
||||
mkdir -p config/mpc data/mpc/node{0,1,2} logs
|
||||
|
||||
# Generate peers configuration
|
||||
lux-mpc-cli generate-peers --number 3 --output config/mpc/peers.json
|
||||
|
||||
# Create basic config
|
||||
cat > config/mpc/config.yaml << EOF
|
||||
network:
|
||||
name: bridge-mpc
|
||||
threshold: 2
|
||||
total_nodes: 3
|
||||
nats:
|
||||
url: nats://localhost:4222
|
||||
consul:
|
||||
url: http://localhost:8500
|
||||
EOF
|
||||
|
||||
- name: Start MPC nodes
|
||||
env:
|
||||
NATS_URL: nats://localhost:4222
|
||||
CONSUL_URL: http://localhost:8500
|
||||
run: |
|
||||
# Start MPC nodes using the installed binaries
|
||||
NODE_ID=node0 NODE_PORT=6000 DATA_DIR=./data/mpc/node0 \
|
||||
lux-mpc start --name node0 > logs/node0.log 2>&1 &
|
||||
|
||||
sleep 2
|
||||
|
||||
NODE_ID=node1 NODE_PORT=6001 DATA_DIR=./data/mpc/node1 \
|
||||
lux-mpc start --name node1 > logs/node1.log 2>&1 &
|
||||
|
||||
sleep 2
|
||||
|
||||
NODE_ID=node2 NODE_PORT=6002 DATA_DIR=./data/mpc/node2 \
|
||||
lux-mpc start --name node2 > logs/node2.log 2>&1 &
|
||||
|
||||
# Wait for nodes to initialize
|
||||
sleep 15
|
||||
|
||||
- name: Check MPC nodes status
|
||||
run: |
|
||||
# Check if MPC processes are running
|
||||
ps aux | grep lux-mpc | grep -v grep || (echo "MPC nodes not running"; exit 1)
|
||||
|
||||
# Check logs for readiness
|
||||
grep -q "ready" logs/node0.log || echo "Node0 may still be initializing"
|
||||
|
||||
# Test with CLI
|
||||
lux-mpc-cli status --url http://localhost:6000 || echo "MPC CLI status check failed"
|
||||
|
||||
- name: Run database migrations
|
||||
working-directory: ./app/server
|
||||
env:
|
||||
DATABASE_URL: postgresql://bridge:bridge@localhost:5432/bridge
|
||||
run: |
|
||||
pnpm run prisma:gen || echo "No Prisma"
|
||||
psql -h localhost -U bridge -d bridge -f ../../scripts/init.sql
|
||||
|
||||
- name: Start bridge server
|
||||
working-directory: ./app/server
|
||||
env:
|
||||
NODE_ENV: test
|
||||
PORT: 5000
|
||||
DATABASE_URL: postgresql://bridge:bridge@localhost:5432/bridge
|
||||
NATS_URL: nats://localhost:4222
|
||||
CONSUL_URL: http://localhost:8500
|
||||
run: |
|
||||
pnpm run build
|
||||
pnpm start &
|
||||
sleep 10
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
echo "=== Running Integration Tests ==="
|
||||
|
||||
# Test health endpoints
|
||||
echo "1. Testing health endpoint..."
|
||||
curl -f http://localhost:5000/health || echo "Health endpoint not available"
|
||||
|
||||
# Test MPC integration
|
||||
echo "2. Testing MPC status..."
|
||||
curl -f http://localhost:5000/api/mpc/status || echo "MPC status endpoint not available"
|
||||
|
||||
# Test service discovery
|
||||
echo "3. Testing Consul integration..."
|
||||
curl -s http://localhost:8500/v1/catalog/services | grep -q "bridge" || echo "Bridge not registered in Consul"
|
||||
|
||||
# Test message queue
|
||||
echo "4. Testing NATS connectivity..."
|
||||
curl -s http://localhost:4222 || echo "NATS not accessible"
|
||||
|
||||
# Test database connectivity
|
||||
echo "5. Testing database..."
|
||||
PGPASSWORD=bridge psql -h localhost -U bridge -d bridge -c "SELECT COUNT(*) FROM swaps;" || echo "Database query failed"
|
||||
|
||||
# Run integration test scripts
|
||||
echo "6. Running test scripts..."
|
||||
for script in ./test/test-*.sh; do
|
||||
if [ -f "$script" ]; then
|
||||
echo "Running $script..."
|
||||
chmod +x "$script"
|
||||
"$script" || echo "$script failed"
|
||||
fi
|
||||
done
|
||||
|
||||
# Test API endpoints
|
||||
echo "7. Testing Bridge API endpoints..."
|
||||
curl -f http://localhost:5000/api/networks || echo "Networks endpoint failed"
|
||||
curl -f http://localhost:5000/api/tokens || echo "Tokens endpoint failed"
|
||||
curl -f http://localhost:5000/api/limits || echo "Limits endpoint failed"
|
||||
|
||||
echo "✅ Integration tests completed"
|
||||
|
||||
- name: Run UI automation tests
|
||||
if: false # Enable when Selenium is set up
|
||||
working-directory: ./ui-automation
|
||||
run: |
|
||||
npm install
|
||||
npm test -- --testPathPattern=smoke
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
# v3, not v4+: this runs on git.hanzo.ai, which presents as GHES, and
|
||||
# the v4 action refuses outright -- "@actions/artifact v2.0.0+ ... are not
|
||||
# currently supported on GHES". The job does its work and then discards the
|
||||
# artifact at the last step, so a successful run reads as a failed one.
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: |
|
||||
**/coverage/
|
||||
**/test-results/
|
||||
**/*.log
|
||||
|
||||
security-scan:
|
||||
name: Security Scanning
|
||||
runs-on: lux-build-amd64
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Snyk to check for vulnerabilities
|
||||
uses: snyk/actions/node@master
|
||||
continue-on-error: true
|
||||
env:
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
with:
|
||||
args: --all-projects --severity-threshold=high || echo "Snyk scan skipped - no token configured"
|
||||
@@ -1,228 +0,0 @@
|
||||
name: MPC E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
paths:
|
||||
- 'scripts/**'
|
||||
- 'config/mpc/**'
|
||||
- 'docs/MPC-GO-INTEGRATION.md'
|
||||
- '.github/workflows/mpc-e2e-tests.yml'
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mpc-e2e:
|
||||
name: MPC End-to-End Tests
|
||||
runs-on: lux-build-amd64
|
||||
|
||||
services:
|
||||
nats:
|
||||
image: nats:2.10-alpine
|
||||
ports:
|
||||
- 4223:4222
|
||||
- 8223:8222
|
||||
options: >-
|
||||
--health-cmd "nc -z localhost 4222"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
consul:
|
||||
image: hashicorp/consul:1.16
|
||||
ports:
|
||||
- 8501:8500
|
||||
options: >-
|
||||
--health-cmd "consul members"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.26.4'
|
||||
|
||||
- name: Install MPC tools
|
||||
run: |
|
||||
echo "Installing MPC tools..."
|
||||
# Add Go bin to PATH
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
# Clone MPC repository since it's not public
|
||||
git clone https://github.com/luxfi/mpc.git /tmp/mpc || echo "Failed to clone MPC repo"
|
||||
|
||||
# Try to install from local if clone succeeded
|
||||
if [ -d "/tmp/mpc" ]; then
|
||||
cd /tmp/mpc
|
||||
go build -o $HOME/go/bin/lux-mpc ./cmd/lux-mpc || echo "Failed to build lux-mpc"
|
||||
go build -o $HOME/go/bin/lux-mpc-cli ./cmd/lux-mpc-cli || echo "Failed to build lux-mpc-cli"
|
||||
fi
|
||||
|
||||
# For now, create mock scripts to pass the tests
|
||||
mkdir -p $HOME/go/bin
|
||||
echo '#!/bin/bash' > $HOME/go/bin/lux-mpc
|
||||
echo 'echo "Mock MPC node running..."' >> $HOME/go/bin/lux-mpc
|
||||
echo 'sleep infinity' >> $HOME/go/bin/lux-mpc
|
||||
chmod +x $HOME/go/bin/lux-mpc
|
||||
|
||||
echo '#!/bin/bash' > $HOME/go/bin/lux-mpc-cli
|
||||
echo 'echo "Mock MPC CLI"' >> $HOME/go/bin/lux-mpc-cli
|
||||
echo 'exit 0' >> $HOME/go/bin/lux-mpc-cli
|
||||
chmod +x $HOME/go/bin/lux-mpc-cli
|
||||
|
||||
# Verify installation
|
||||
which lux-mpc || echo "lux-mpc not in PATH"
|
||||
which lux-mpc-cli || echo "lux-mpc-cli not in PATH"
|
||||
|
||||
- name: Prepare MPC environment
|
||||
run: |
|
||||
mkdir -p config/mpc data/mpc/node{0,1,2} logs
|
||||
|
||||
# Generate test configuration
|
||||
cat > config/mpc/config.yaml << EOF
|
||||
network:
|
||||
name: bridge-mpc-test
|
||||
threshold: 2
|
||||
total_nodes: 3
|
||||
|
||||
nats:
|
||||
url: nats://localhost:4223
|
||||
subject_prefix: test.bridge.mpc
|
||||
|
||||
consul:
|
||||
url: http://localhost:8501
|
||||
service_name: test-bridge-mpc
|
||||
|
||||
EOF
|
||||
|
||||
# Generate peer configuration
|
||||
lux-mpc-cli generate-peers --number 3 --output config/mpc/peers.json
|
||||
|
||||
- name: Start MPC network
|
||||
env:
|
||||
NATS_URL: nats://localhost:4223
|
||||
CONSUL_URL: http://localhost:8501
|
||||
LOG_LEVEL: debug
|
||||
run: |
|
||||
# Start 3 MPC nodes
|
||||
for i in 0 1 2; do
|
||||
NODE_ID=node$i NODE_PORT=$((6000 + i)) GRPC_PORT=$((9090 + i)) \
|
||||
DATA_DIR=./data/mpc/node$i CONFIG_PATH=./config/mpc/config.yaml \
|
||||
PEERS_PATH=./config/mpc/peers.json \
|
||||
lux-mpc start --name node$i > logs/node$i.log 2>&1 &
|
||||
|
||||
sleep 3
|
||||
done
|
||||
|
||||
# Wait for initialization
|
||||
sleep 20
|
||||
|
||||
# Verify all nodes are running
|
||||
ps aux | grep lux-mpc | grep -v grep
|
||||
echo "Found $(ps aux | grep lux-mpc | grep -v grep | wc -l) MPC processes"
|
||||
|
||||
- name: Test MPC operations
|
||||
run: |
|
||||
echo "=== Testing MPC Network ==="
|
||||
|
||||
# Test node connectivity
|
||||
echo "1. Testing node connectivity..."
|
||||
for i in 0 1 2; do
|
||||
lux-mpc-cli status --url http://localhost:$((6000 + i)) || echo "Node $i status check failed"
|
||||
done
|
||||
|
||||
# Test mock key generation
|
||||
echo "2. Testing key generation (mock)..."
|
||||
echo "Mock key generation successful"
|
||||
|
||||
# Test mock signature
|
||||
echo "3. Testing signature generation (mock)..."
|
||||
echo "Mock signature generation successful"
|
||||
|
||||
- name: Run E2E test script
|
||||
run: |
|
||||
if [ -f "test/test-mpc-e2e-simple.sh" ]; then
|
||||
chmod +x test/test-mpc-e2e-simple.sh
|
||||
./test/test-mpc-e2e-simple.sh
|
||||
elif [ -f "test/e2e-smoke-test.sh" ]; then
|
||||
chmod +x test/e2e-smoke-test.sh
|
||||
./test/e2e-smoke-test.sh
|
||||
else
|
||||
echo "No E2E test script found, running basic checks"
|
||||
echo "✅ Basic CI checks passed"
|
||||
fi
|
||||
|
||||
- name: Check logs for errors
|
||||
if: always()
|
||||
run: |
|
||||
echo "=== Checking logs for errors ==="
|
||||
for log in logs/*.log; do
|
||||
if [ -f "$log" ]; then
|
||||
echo "--- $log ---"
|
||||
grep -i "error\|fatal\|panic" "$log" | head -20 || echo "No errors found"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
# v3, not v4+: this runs on git.hanzo.ai, which presents as GHES, and
|
||||
# the v4 action refuses outright -- "@actions/artifact v2.0.0+ ... are not
|
||||
# currently supported on GHES". The job does its work and then discards the
|
||||
# artifact at the last step, so a successful run reads as a failed one.
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: mpc-e2e-logs
|
||||
path: |
|
||||
logs/*.log
|
||||
config/mpc/*.yaml
|
||||
config/mpc/*.json
|
||||
|
||||
mpc-integration:
|
||||
name: MPC Bridge Integration
|
||||
runs-on: lux-build-amd64
|
||||
needs: mpc-e2e
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run integration test script
|
||||
run: |
|
||||
if [ -f "test/e2e-smoke-test.sh" ]; then
|
||||
chmod +x test/e2e-smoke-test.sh
|
||||
./test/e2e-smoke-test.sh
|
||||
else
|
||||
echo "Integration test script not found"
|
||||
echo "✅ Basic integration checks passed"
|
||||
fi
|
||||
|
||||
- name: Summary
|
||||
run: |
|
||||
echo "=== MPC E2E Test Summary ==="
|
||||
echo "✅ MPC tools installed successfully"
|
||||
echo "✅ MPC network started with 3 nodes"
|
||||
echo "✅ Basic MPC operations tested"
|
||||
echo "✅ Integration tests completed"
|
||||
echo ""
|
||||
echo "The new MPC architecture is working correctly!"
|
||||
@@ -1,13 +0,0 @@
|
||||
name: mpc-nodes [DEPRECATED]
|
||||
on:
|
||||
workflow_dispatch: # Only manual trigger since mpc-nodes directory is removed
|
||||
jobs:
|
||||
deprecated_notice:
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- name: Deprecation Notice
|
||||
run: |
|
||||
echo "This workflow is deprecated."
|
||||
echo "MPC functionality has been migrated to native Go integration."
|
||||
echo "See docs/MPC-GO-INTEGRATION.md for details."
|
||||
exit 0
|
||||
@@ -1,18 +0,0 @@
|
||||
name: MPC Tests [DEPRECATED]
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Only manual trigger since mpc-service directory is removed
|
||||
|
||||
jobs:
|
||||
deprecated_notice:
|
||||
name: Deprecation Notice
|
||||
runs-on: lux-build-amd64
|
||||
|
||||
steps:
|
||||
- name: MPC Tests Deprecated
|
||||
run: |
|
||||
echo "This workflow is deprecated."
|
||||
echo "The mpc-service directory has been removed."
|
||||
echo "MPC functionality has been migrated to native Go integration."
|
||||
echo "Use the MPC E2E Tests workflow instead."
|
||||
exit 0
|
||||
@@ -1,95 +0,0 @@
|
||||
# Publish @luxfi/* packages to npm.
|
||||
#
|
||||
# Triggered by `v*` tag push. Publishes every public workspace package
|
||||
# (anything with `"publishConfig.access": "public"` and not `"private": true`).
|
||||
#
|
||||
# Public: @luxfi/bridge, @luxfi/core, @luxfi/threshold, @luxfi/utila
|
||||
# Private (workspace-only, never published): @luxbridge/lux-tenant,
|
||||
# @luxbridge/explorer, @luxbridge/server,
|
||||
# @luxbridge/settings, @luxbridge/ui-automation
|
||||
#
|
||||
# The version baked into each package.json is the source of truth — the git
|
||||
# tag is informational. Bump versions in PRs, tag once they merge to main.
|
||||
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
# Self-hosted org runner. GitHub-hosted runners are not authorised for
|
||||
# this org's billing plan.
|
||||
runs-on: evo
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# On tag push the checkout action already resolves the tag ref;
|
||||
# setting fetch-tags here on a self-hosted runner conflicts with
|
||||
# the refspec the runner uses, so we leave it implicit.
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
registry-url: 'https://registry.npmjs.org/'
|
||||
scope: '@luxfi'
|
||||
|
||||
- run: corepack enable && corepack prepare [email protected] --activate
|
||||
|
||||
- name: Configure npm auth (npmjs.org)
|
||||
# Bake the token directly into the userconfig .npmrc — pnpm does
|
||||
# NOT expand ${VAR} references in .npmrc, so the literal token
|
||||
# has to be on disk. setup-node@v4 sets NPM_CONFIG_USERCONFIG to
|
||||
# a temp path; we write to that exact path so pnpm picks it up.
|
||||
run: |
|
||||
token="${NPM_TOKEN:-$NODE_AUTH_TOKEN}"
|
||||
if [ -z "$token" ]; then
|
||||
echo "::error::No NPM token available (NPM_TOKEN nor NODE_AUTH_TOKEN set)"
|
||||
exit 1
|
||||
fi
|
||||
target="${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}"
|
||||
cat > "$target" <<NPMRC
|
||||
registry=https://registry.npmjs.org/
|
||||
@luxfi:registry=https://registry.npmjs.org/
|
||||
//registry.npmjs.org/:_authToken=${token}
|
||||
always-auth=true
|
||||
NPMRC
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- run: pnpm install --frozen-lockfile || pnpm install
|
||||
|
||||
# Build the publishable @luxfi/* packages that emit dist/.
|
||||
- name: Build @luxfi/core
|
||||
run: pnpm --filter @luxfi/core build
|
||||
|
||||
- name: Build @luxfi/threshold
|
||||
run: pnpm --filter @luxfi/threshold build
|
||||
|
||||
- name: Build @luxfi/utila
|
||||
run: pnpm --filter @luxfi/utila build
|
||||
|
||||
# @luxfi/bridge ships source TS directly (no build step required for
|
||||
# consumers using a bundler like Vite/webpack/esbuild — type-only).
|
||||
- name: Typecheck @luxfi/bridge
|
||||
run: pnpm --filter @luxfi/bridge tc
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
# Publish via `pnpm publish -r` — pnpm walks the workspace, skips
|
||||
# `private: true` packages, and only ships those whose version isn't
|
||||
# already on the registry. `--no-git-checks` skips the dirty-tree
|
||||
# guard since the tag commit may include workflow edits.
|
||||
- name: Publish @luxfi/* to npmjs.org
|
||||
run: pnpm publish -r --access public --no-git-checks
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -1,48 +0,0 @@
|
||||
name: Release (Go)
|
||||
|
||||
# Native binary release for the bridge Go CLIs (cmd/bridge, opnet-watcher)
|
||||
# on `v*` tags. Six-platform matrix via goreleaser.
|
||||
#
|
||||
# Container image is built independently by .github/workflows/docker.yml
|
||||
# (native multi-arch ARC runners — NO QEMU).
|
||||
# npm publish is handled by .github/workflows/publish.yml.
|
||||
#
|
||||
# Runner labels: lux-build self-hosted ARC scale-sets per the org policy.
|
||||
# GitHub-hosted runners are NOT a permitted fallback.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: evo
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Install syft for SBOM
|
||||
run: |
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh \
|
||||
| sh -s -- -b "$HOME/.local/bin"
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: "~> v2"
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user