Skip to content

Commit f3cef36

Browse files
committed
e2e: regtest-mint workflow iteration 1 — backend stack up + smoke
First step of phase B.E2E from PLAN-cat21-mint-port.md. Brings up the full backend stack on regtest in CI and curl-checks the endpoints the cat21-mint flow depends on: - ordpool-sdk's consumer-environment compose file provides bitcoind + electrs + mariadb (lives in node_modules after npm ci on the SDK's git pin). - e2e/docker-compose.ordpool-backend.yml layers on the mempool/backend:latest image with a regtest config that points CORE_RPC at the docker bitcoind, ESPLORA at electrs, DATABASE at mariadb. - e2e/mempool-config.regtest.json: BACKEND=esplora, STATISTICS=off, REDIS=off, AUTOMATIC_POOLS_UPDATE=off — minimal surface for the mint flow without paying for the prod indexer's heavier paths. The workflow's healthcheck phase confirms /api/v1/backend-info, /api/v1/blocks/tip/height, /api/v1/fees/recommended all answer. If those three are green, the mint flow's data dependencies are satisfied. Iteration 2 (next commit on this workflow file): add frontend ng serve pointing at the local backend + a Playwright smoke spec that loads /cat21-mint and sees the wallet picker. Iteration 3: load Xverse extension via the SDK's existing harness (xverse-vault.ts + playwright-bootstrap.sh fixtures), drive the connect + fee-pick + mint click + handle approval popup, mine 1 block, assert the pending-feed transition. Triggers: nightly cron (17 3 * * *), workflow_dispatch, and on push when any of the three files above change so iterating on the workflow itself goes through CI fast.
1 parent fce6717 commit f3cef36

3 files changed

Lines changed: 223 additions & 0 deletions

File tree

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: E2E (regtest mint)
2+
3+
# Full-stack mint round-trip on Bitcoin regtest:
4+
# bitcoind + electrs + mariadb (from ordpool-sdk's consumer-environment)
5+
# + ordpool-backend (this repo) + ordpool/frontend serving locally
6+
# + Xverse extension headed in xvfb
7+
# + Playwright drives /cat21-mint end-to-end through to a real mint
8+
#
9+
# Iteration ladder (matches PLAN-cat21-mint-port.md):
10+
# 1. bring the backend stack up, confirm /api/v1/fees/recommended +
11+
# /api/v1/blocks/tip/height answer <-- THIS IS WHERE WE ARE
12+
# 2. add frontend serve + Playwright smoke (page loads, wallet picker
13+
# visible)
14+
# 3. add Xverse extension + full mint click-through + 1-block mine +
15+
# pending feed transition assertion
16+
#
17+
# Subsequent iterations extend the same workflow file rather than
18+
# creating new ones — keeps the CI surface stable.
19+
20+
on:
21+
workflow_dispatch:
22+
schedule:
23+
- cron: '17 3 * * *' # nightly at 03:17 UTC
24+
push:
25+
paths:
26+
- 'e2e/docker-compose.ordpool-backend.yml'
27+
- 'e2e/mempool-config.regtest.json'
28+
- '.github/workflows/e2e-regtest-mint.yml'
29+
30+
permissions:
31+
contents: read
32+
33+
concurrency:
34+
group: ordpool-e2e-regtest-mint-${{ github.ref }}
35+
cancel-in-progress: true
36+
37+
jobs:
38+
regtest-mint:
39+
name: Bring up stack + smoke-test backend
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 30
42+
steps:
43+
- name: Checkout ordpool
44+
uses: actions/checkout@v4
45+
46+
- name: Setup Node
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: '24.13.0'
50+
cache: 'npm'
51+
cache-dependency-path: 'frontend/package-lock.json'
52+
53+
- name: Install frontend npm deps (brings ordpool-sdk into node_modules)
54+
run: npm ci
55+
working-directory: frontend
56+
57+
- name: Make SDK consumer-environment scripts executable
58+
# Git on Linux preserves the bit, but defensive against any
59+
# cross-platform clone that lost it.
60+
run: chmod +x node_modules/ordpool-sdk/e2e/consumer-environment-bootstrap.sh
61+
working-directory: frontend
62+
63+
- name: Bring up consumer-environment + ordpool-backend
64+
run: |
65+
frontend/node_modules/ordpool-sdk/e2e/consumer-environment-bootstrap.sh \
66+
--extra-file "$(pwd)/e2e/docker-compose.ordpool-backend.yml" \
67+
> stack.json
68+
cat stack.json
69+
70+
- name: Wait for ordpool-backend health
71+
# The backend takes a moment after mariadb is ready before it
72+
# opens the HTTP port. Poll until /api/v1/backend-info responds.
73+
run: |
74+
for i in $(seq 1 60); do
75+
if curl -fsS http://localhost:8999/api/v1/backend-info >/dev/null 2>&1; then
76+
echo "ordpool-backend up"
77+
break
78+
fi
79+
if [ "$i" = "60" ]; then
80+
echo "ordpool-backend never came up"
81+
docker logs ordpool-e2e-backend || true
82+
exit 1
83+
fi
84+
sleep 2
85+
done
86+
87+
- name: Smoke-test backend endpoints
88+
run: |
89+
echo "--- backend-info"
90+
curl -fsS http://localhost:8999/api/v1/backend-info | head -c 400
91+
echo
92+
echo "--- blocks/tip/height"
93+
curl -fsS http://localhost:8999/api/v1/blocks/tip/height
94+
echo
95+
echo "--- fees/recommended"
96+
curl -fsS http://localhost:8999/api/v1/fees/recommended | head -c 400
97+
echo
98+
99+
- name: Dump container logs on failure
100+
if: failure()
101+
run: |
102+
for c in ordpool-e2e-consumer-bitcoind ordpool-e2e-consumer-electrs \
103+
ordpool-e2e-consumer-mariadb ordpool-e2e-backend; do
104+
echo "=== $c ==="
105+
docker logs "$c" 2>&1 | tail -200 || true
106+
done
107+
108+
- name: Tear down stack
109+
if: always()
110+
run: |
111+
docker compose \
112+
-f frontend/node_modules/ordpool-sdk/e2e/docker-compose.consumer-environment.yml \
113+
-f e2e/docker-compose.ordpool-backend.yml \
114+
down -v || true
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# ordpool-backend service for the E2E regtest mint workflow.
2+
#
3+
# Layered on top of ordpool-sdk's consumer-environment compose file
4+
# (which provides bitcoind + electrs + mariadb). Uses the official
5+
# mempool/backend image with a mounted regtest config pointing at the
6+
# SDK's containers via the docker network the consumer-environment
7+
# creates.
8+
#
9+
# Brought up together with the base via:
10+
# docker compose \
11+
# -f node_modules/ordpool-sdk/e2e/docker-compose.consumer-environment.yml \
12+
# -f e2e/docker-compose.ordpool-backend.yml \
13+
# up -d
14+
#
15+
# The bind-mount path for mempool-config.json is relative to wherever
16+
# docker-compose is invoked from. The workflow invokes from the repo
17+
# root, so the path is `e2e/mempool-config.regtest.json`.
18+
19+
services:
20+
21+
ordpool-backend:
22+
image: mempool/backend:latest
23+
container_name: ordpool-e2e-backend
24+
depends_on:
25+
bitcoind:
26+
condition: service_healthy
27+
electrs:
28+
condition: service_healthy
29+
mariadb:
30+
condition: service_healthy
31+
volumes:
32+
- ./e2e/mempool-config.regtest.json:/backend/mempool-config.json:ro
33+
ports:
34+
- "8999:8999"
35+
healthcheck:
36+
test: ["CMD-SHELL", "curl -fsS http://localhost:8999/api/v1/backend-info | grep -q . || exit 1"]
37+
interval: 5s
38+
timeout: 5s
39+
retries: 30
40+
start_period: 20s
41+
# Wait for mariadb to fully accept connections before the backend
42+
# tries its first query — the healthcheck on mariadb fires earlier
43+
# than connection-ready in some versions.
44+
command: ["./wait-for-it.sh", "mariadb:3306", "--timeout=120", "--strict", "--", "./start.sh"]

e2e/mempool-config.regtest.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"_comment": "Regtest config for the E2E mint workflow. Points the mempool/backend image at the SDK's consumer-environment containers (bitcoind, electrs, mariadb on the shared docker network). NETWORK stays 'mainnet' because the framework's NETWORK string controls UI conventions, not the actual chain — bitcoind running with -regtest answers all RPC calls normally and the backend treats whatever chain it gets back from getblockchaininfo as 'the chain we're on'. BACKEND: 'esplora' tells the backend to use electrs as its index source so /api/v1/fees/recommended + UTXO lookups work the same way they do in prod.",
3+
4+
"MEMPOOL": {
5+
"NETWORK": "mainnet",
6+
"BACKEND": "esplora",
7+
"ENABLED": true,
8+
"HTTP_PORT": 8999,
9+
"SPAWN_CLUSTER_PROCS": 0,
10+
"API_URL_PREFIX": "/api/v1/",
11+
"POLL_RATE_MS": 2000,
12+
"CACHE_ENABLED": false,
13+
"INITIAL_BLOCKS_AMOUNT": 8,
14+
"MEMPOOL_BLOCKS_AMOUNT": 8,
15+
"INDEXING_BLOCKS_AMOUNT": 0,
16+
"BLOCKS_SUMMARIES_INDEXING": false,
17+
"STDOUT_LOG_MIN_PRIORITY": "info",
18+
"AUTOMATIC_POOLS_UPDATE": false,
19+
"AUDIT": false,
20+
"RUST_GBT": false,
21+
"ALLOW_UNREACHABLE": true,
22+
"MAX_TRACKED_ADDRESSES": 100
23+
},
24+
25+
"CORE_RPC": {
26+
"HOST": "bitcoind",
27+
"PORT": 18443,
28+
"USERNAME": "ordpool",
29+
"PASSWORD": "ordpool",
30+
"TIMEOUT": 60000,
31+
"COOKIE": false
32+
},
33+
34+
"ESPLORA": {
35+
"REST_API_URL": "http://electrs:3000",
36+
"UNIX_SOCKET_PATH": null,
37+
"RETRY_UNIX_SOCKET_AFTER": 30000,
38+
"REQUEST_TIMEOUT": 10000,
39+
"FALLBACK_TIMEOUT": 5000,
40+
"FALLBACK": []
41+
},
42+
43+
"DATABASE": {
44+
"ENABLED": true,
45+
"HOST": "mariadb",
46+
"PORT": 3306,
47+
"DATABASE": "mempool",
48+
"USERNAME": "mempool",
49+
"PASSWORD": "mempool",
50+
"TIMEOUT": 180000,
51+
"PID_DIR": "",
52+
"POOL_SIZE": 100
53+
},
54+
55+
"STATISTICS": {
56+
"ENABLED": false,
57+
"TX_PER_SECOND_SAMPLE_PERIOD": 150
58+
},
59+
60+
"REDIS": {
61+
"ENABLED": false,
62+
"UNIX_SOCKET_PATH": "",
63+
"BATCH_QUERY_BASE_SIZE": 5000
64+
}
65+
}

0 commit comments

Comments
 (0)