name: Realm simulation on: push: branches: - feature/ai-brain-router paths: - "app/api/bridge/ale/**" - "app/api/world-monitor/**" - "core/service.ts" - "core/autonomy.ts" - "core/types.ts" - "ale/azerothai_bridge.lua" - "scripts/simulate-live-realm.mjs" - "scripts/sites-env.mjs" - "package.json" - ".github/workflows/realm-simulation.yml" workflow_dispatch: jobs: simulated-live-world: runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 with: version: 11.25.0 - uses: actions/setup-node@v4 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile - name: Build AzerothAI run: pnpm build - name: Configure simulated ALE worldserver run: | cat > .dev.vars <<'EOF' ALE_BRIDGE_TOKEN=simulation-bridge-token ALE_OPERATOR_TOKEN=simulation-operator-token ALE_RAW_EXEC_ENABLED=false AUTONOMY_TOKEN=simulation-autonomy-token EOF - name: Initialize local realm database run: | node --import ./scripts/sites-env.mjs ./node_modules/wrangler/bin/wrangler.js d1 execute DB --local --config dist/server/wrangler.json --persist-to .wrangler/state --file drizzle/0000_old_deathbird.sql - name: Start AzerothAI test runtime run: | nohup pnpm start >/tmp/azerothai-simulation.log 2>&1 & echo $! >/tmp/azerothai-simulation.pid for i in {1..60}; do if curl -fsS http://127.0.0.1:8787/api/health >/dev/null; then exit 0 fi sleep 1 done cat /tmp/azerothai-simulation.log exit 1 - name: Simulate AzerothCore + Playerbots + ALE world activity env: AZEROTHAI_URL: http://127.0.0.1:8787 ALE_BRIDGE_TOKEN: simulation-bridge-token AUTONOMY_TOKEN: simulation-autonomy-token run: | set -o pipefail node scripts/simulate-live-realm.mjs | tee simulation-report.txt - name: Capture final monitor snapshots if: always() run: | mkdir -p simulation-artifacts cp simulation-report.txt simulation-artifacts/ 2>/dev/null || true cp /tmp/azerothai-simulation.log simulation-artifacts/runtime.log 2>/dev/null || true curl -fsS http://127.0.0.1:8787/api/state > simulation-artifacts/final-state.json 2>/dev/null || true curl -fsS http://127.0.0.1:8787/api/world-monitor > simulation-artifacts/world-monitor.json 2>/dev/null || true - name: Upload simulation report if: always() uses: actions/upload-artifact@v4 with: name: realm-simulation-report path: simulation-artifacts/ if-no-files-found: ignore