2026-02-02 19:24:57 +01:00
|
|
|
# E2E Testing Pipeline using Native Woodpecker Services
|
|
|
|
|
# No Docker-in-Docker - uses pre-built images for fast startup
|
|
|
|
|
|
|
|
|
|
kind: pipeline
|
|
|
|
|
type: docker
|
|
|
|
|
name: e2e
|
|
|
|
|
|
|
|
|
|
when:
|
|
|
|
|
event: pull_request
|
|
|
|
|
|
|
|
|
|
# All background services - services get proper DNS resolution in Woodpecker
|
|
|
|
|
# Note: Services can't depend on steps, so they wait internally for contracts.env
|
|
|
|
|
services:
|
|
|
|
|
# PostgreSQL for Ponder
|
|
|
|
|
- name: postgres
|
|
|
|
|
image: postgres:16-alpine
|
|
|
|
|
environment:
|
|
|
|
|
POSTGRES_USER: ponder
|
|
|
|
|
POSTGRES_PASSWORD: ponder_local
|
|
|
|
|
POSTGRES_DB: ponder_local
|
|
|
|
|
|
|
|
|
|
# Anvil blockchain fork
|
|
|
|
|
- name: anvil
|
|
|
|
|
image: ghcr.io/foundry-rs/foundry:latest
|
|
|
|
|
entrypoint:
|
|
|
|
|
- anvil
|
|
|
|
|
- --host=0.0.0.0
|
|
|
|
|
- --port=8545
|
|
|
|
|
- --fork-url=https://sepolia.base.org
|
|
|
|
|
- --fork-block-number=20000000
|
|
|
|
|
- --chain-id=31337
|
|
|
|
|
- --accounts=10
|
|
|
|
|
- --balance=10000
|
|
|
|
|
|
|
|
|
|
# Ponder indexer - waits for contracts.env from bootstrap
|
|
|
|
|
- name: ponder
|
|
|
|
|
image: registry.niovi.voyage/harb/ponder-ci:latest
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
# Wait for contracts.env (bootstrap writes it after deploying)
|
|
|
|
|
echo "=== Waiting for contracts.env ==="
|
|
|
|
|
for i in $(seq 1 120); do
|
|
|
|
|
if [ -f /woodpecker/src/contracts.env ]; then
|
|
|
|
|
echo "Found contracts.env after $i attempts"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
echo "Waiting for contracts.env... ($i/120)"
|
|
|
|
|
sleep 3
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ ! -f /woodpecker/src/contracts.env ]; then
|
|
|
|
|
echo "ERROR: contracts.env not found after 6 minutes"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Source contract addresses from bootstrap
|
|
|
|
|
. /woodpecker/src/contracts.env
|
|
|
|
|
echo "=== Contract addresses ==="
|
|
|
|
|
echo "KRAIKEN=$KRAIKEN"
|
|
|
|
|
echo "STAKE=$STAKE"
|
|
|
|
|
echo "START_BLOCK=$START_BLOCK"
|
|
|
|
|
|
|
|
|
|
# Export env vars required by ponder
|
|
|
|
|
export DATABASE_URL="$DATABASE_URL"
|
|
|
|
|
export DATABASE_SCHEMA="ponder_ci_$START_BLOCK"
|
|
|
|
|
export START_BLOCK="$START_BLOCK"
|
|
|
|
|
export KRAIKEN_ADDRESS="$KRAIKEN"
|
|
|
|
|
export STAKE_ADDRESS="$STAKE"
|
|
|
|
|
export PONDER_NETWORK=BASE_SEPOLIA_LOCAL_FORK
|
|
|
|
|
export PONDER_RPC_URL_BASE_SEPOLIA_LOCAL_FORK="$PONDER_RPC_URL_1"
|
|
|
|
|
export PONDER_RPC_URL_1="$PONDER_RPC_URL_1"
|
|
|
|
|
|
|
|
|
|
echo "=== Starting Ponder (pre-built image) ==="
|
|
|
|
|
cd /app/services/ponder
|
|
|
|
|
{
|
|
|
|
|
echo "DATABASE_URL=${DATABASE_URL}"
|
|
|
|
|
echo "PONDER_RPC_URL_1=${PONDER_RPC_URL_1}"
|
|
|
|
|
echo "DATABASE_SCHEMA=${DATABASE_SCHEMA}"
|
|
|
|
|
echo "START_BLOCK=${START_BLOCK}"
|
|
|
|
|
} > .env.local
|
|
|
|
|
exec npm run dev
|
|
|
|
|
|
|
|
|
|
# Webapp - waits for contracts.env from bootstrap
|
|
|
|
|
- name: webapp
|
|
|
|
|
image: registry.niovi.voyage/harb/webapp-ci:latest
|
|
|
|
|
environment:
|
|
|
|
|
CI: "true"
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
# Wait for contracts.env (bootstrap writes it after deploying)
|
|
|
|
|
echo "=== Waiting for contracts.env ==="
|
|
|
|
|
for i in $(seq 1 120); do
|
|
|
|
|
if [ -f /woodpecker/src/contracts.env ]; then
|
|
|
|
|
echo "Found contracts.env after $i attempts"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
echo "Waiting for contracts.env... ($i/120)"
|
|
|
|
|
sleep 3
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ ! -f /woodpecker/src/contracts.env ]; then
|
|
|
|
|
echo "ERROR: contracts.env not found after 6 minutes"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Source contract addresses from bootstrap
|
|
|
|
|
. /woodpecker/src/contracts.env
|
|
|
|
|
|
|
|
|
|
# Export environment variables for Vite
|
|
|
|
|
export VITE_KRAIKEN_ADDRESS="$KRAIKEN"
|
|
|
|
|
export VITE_STAKE_ADDRESS="$STAKE"
|
|
|
|
|
export VITE_DEFAULT_CHAIN_ID=31337
|
|
|
|
|
export VITE_LOCAL_RPC_PROXY_TARGET=http://anvil:8545
|
|
|
|
|
export VITE_LOCAL_GRAPHQL_PROXY_TARGET=http://ponder:42069
|
|
|
|
|
export VITE_SWAP_ROUTER=0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4
|
|
|
|
|
export VITE_BASE_PATH=/app/
|
|
|
|
|
|
|
|
|
|
# kraiken-lib/src MUST be baked into the pre-built image
|
|
|
|
|
# (Woodpecker services don't have workspace access, so we can't copy from /woodpecker/src/)
|
|
|
|
|
echo "=== Verifying kraiken-lib/src in pre-built image ==="
|
|
|
|
|
if [ -d /app/kraiken-lib/src ]; then
|
|
|
|
|
echo "kraiken-lib/src found in image"
|
|
|
|
|
ls -la /app/kraiken-lib/
|
|
|
|
|
else
|
|
|
|
|
echo "ERROR: kraiken-lib/src not found in image!"
|
|
|
|
|
echo "The webapp-ci image needs to be rebuilt. Run build-ci-images pipeline."
|
|
|
|
|
echo "Services in Woodpecker don't have workspace access - kraiken-lib/src must be baked into the image."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "=== Starting webapp (pre-built image) ==="
|
|
|
|
|
cd /app/web-app
|
|
|
|
|
# Explicitly set CI=true to disable Vue DevTools in vite.config.ts
|
|
|
|
|
# (prevents 500 errors from devtools path resolution in CI environment)
|
|
|
|
|
export CI=true
|
|
|
|
|
echo "CI=$CI (should be 'true' to disable Vue DevTools)"
|
|
|
|
|
exec npm run dev -- --host 0.0.0.0 --port 5173 --base /app/
|
|
|
|
|
|
|
|
|
|
# Landing page - no contracts needed, starts immediately
|
|
|
|
|
- name: landing
|
|
|
|
|
image: registry.niovi.voyage/harb/landing-ci:latest
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eu
|
|
|
|
|
echo "=== Starting landing (pre-built image) ==="
|
|
|
|
|
cd /app/landing
|
|
|
|
|
exec npm run dev -- --host 0.0.0.0 --port 5174
|
|
|
|
|
|
|
|
|
|
# Caddy proxy - waits for contracts.env to ensure other services are starting
|
|
|
|
|
- name: caddy
|
|
|
|
|
image: caddy:2.8-alpine
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
# Wait briefly for other services to start
|
|
|
|
|
echo "=== Waiting for contracts.env before starting Caddy ==="
|
|
|
|
|
for i in $(seq 1 120); do
|
|
|
|
|
if [ -f /woodpecker/src/contracts.env ]; then
|
|
|
|
|
echo "Found contracts.env, starting Caddy..."
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
echo "Waiting for contracts.env... ($i/120)"
|
|
|
|
|
sleep 3
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
printf '%s\n' ':8081 {' \
|
|
|
|
|
' route /app* {' \
|
|
|
|
|
' reverse_proxy webapp:5173' \
|
|
|
|
|
' }' \
|
|
|
|
|
' route /api/graphql* {' \
|
|
|
|
|
' uri strip_prefix /api' \
|
|
|
|
|
' reverse_proxy ponder:42069' \
|
|
|
|
|
' }' \
|
|
|
|
|
' route /api/rpc* {' \
|
|
|
|
|
' uri strip_prefix /api/rpc' \
|
|
|
|
|
' reverse_proxy anvil:8545' \
|
|
|
|
|
' }' \
|
|
|
|
|
' reverse_proxy landing:5174' \
|
|
|
|
|
'}' > /etc/caddy/Caddyfile
|
|
|
|
|
exec caddy run --config /etc/caddy/Caddyfile
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
# Step 0: Install dependencies for onchain compilation
|
|
|
|
|
- name: install-deps
|
|
|
|
|
image: node:20-alpine
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eu
|
|
|
|
|
apk add --no-cache git
|
|
|
|
|
echo "=== Installing uni-v3-lib dependencies ==="
|
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
cd onchain/lib/uni-v3-lib
|
|
|
|
|
npm install
|
|
|
|
|
|
|
|
|
|
# Step 1: Wait for base services and deploy contracts
|
|
|
|
|
# Uses pre-built node-ci image with Foundry pre-installed (saves ~60s)
|
|
|
|
|
- name: bootstrap
|
|
|
|
|
image: registry.niovi.voyage/harb/node-ci:latest
|
|
|
|
|
depends_on:
|
|
|
|
|
- install-deps
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
2026-02-03 12:07:28 +01:00
|
|
|
# Create a bootstrap wrapper that runs under bash
|
|
|
|
|
# (Woodpecker uses /bin/sh which lacks 'source' and bash-isms)
|
|
|
|
|
export ANVIL_RPC=http://anvil:8545
|
|
|
|
|
export CONTRACT_ENV=/woodpecker/src/contracts.env
|
|
|
|
|
export LOG_FILE=/dev/null
|
|
|
|
|
export ONCHAIN_DIR="$PWD/onchain"
|
|
|
|
|
export TXNBOT_FUND_VALUE=10ether
|
|
|
|
|
export TXNBOT_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8
|
|
|
|
|
export TXNBOT_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
|
|
|
|
|
exec bash scripts/ci-bootstrap.sh
|
2026-02-02 19:24:57 +01:00
|
|
|
|
|
|
|
|
# Step 2: Wait for stack to be healthy (services run in background)
|
|
|
|
|
- name: wait-for-stack
|
|
|
|
|
image: alpine:3.20
|
|
|
|
|
depends_on:
|
|
|
|
|
- bootstrap
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eu
|
2026-02-03 12:07:28 +01:00
|
|
|
apk add --no-cache curl bash
|
2026-02-02 19:24:57 +01:00
|
|
|
|
|
|
|
|
echo "=== Waiting for stack to be healthy (max 7 min) ==="
|
2026-02-03 12:07:28 +01:00
|
|
|
bash scripts/wait-for-service.sh http://ponder:42069/ 420 ponder
|
|
|
|
|
bash scripts/wait-for-service.sh http://webapp:5173/app/ 420 webapp
|
|
|
|
|
bash scripts/wait-for-service.sh http://landing:5174/ 420 landing
|
|
|
|
|
bash scripts/wait-for-service.sh http://caddy:8081/app/ 420 caddy
|
|
|
|
|
echo "=== Stack is healthy ==="
|
2026-02-02 19:24:57 +01:00
|
|
|
|
|
|
|
|
# Step 3: Run E2E tests
|
|
|
|
|
- name: run-e2e-tests
|
|
|
|
|
image: mcr.microsoft.com/playwright:v1.55.1-jammy
|
|
|
|
|
depends_on:
|
|
|
|
|
- wait-for-stack
|
|
|
|
|
timeout: 600
|
|
|
|
|
environment:
|
|
|
|
|
STACK_BASE_URL: http://caddy:8081
|
|
|
|
|
STACK_RPC_URL: http://caddy:8081/api/rpc
|
|
|
|
|
STACK_WEBAPP_URL: http://caddy:8081
|
|
|
|
|
STACK_GRAPHQL_URL: http://caddy:8081/api/graphql
|
|
|
|
|
CI: "true"
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eux
|
|
|
|
|
echo "=== Installing test dependencies ==="
|
|
|
|
|
npm config set fund false
|
|
|
|
|
npm config set audit false
|
|
|
|
|
npm ci --no-audit --no-fund
|
|
|
|
|
|
|
|
|
|
echo "=== Running E2E tests ==="
|
|
|
|
|
npx playwright test --reporter=list
|
|
|
|
|
|
|
|
|
|
# Step 4: Collect artifacts
|
|
|
|
|
- name: collect-artifacts
|
|
|
|
|
image: alpine:3.20
|
|
|
|
|
depends_on:
|
|
|
|
|
- run-e2e-tests
|
|
|
|
|
when:
|
|
|
|
|
status:
|
|
|
|
|
- success
|
|
|
|
|
- failure
|
|
|
|
|
commands:
|
|
|
|
|
- |
|
|
|
|
|
set -eu
|
|
|
|
|
apk add --no-cache tar gzip
|
|
|
|
|
mkdir -p artifacts
|
|
|
|
|
|
|
|
|
|
if [ -d playwright-report ]; then
|
|
|
|
|
tar -czf artifacts/playwright-report.tgz playwright-report
|
2026-02-03 12:07:28 +01:00
|
|
|
echo "Playwright report archived"
|
2026-02-02 19:24:57 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d test-results ]; then
|
|
|
|
|
tar -czf artifacts/test-results.tgz test-results
|
2026-02-03 12:07:28 +01:00
|
|
|
echo "Test results archived"
|
2026-02-02 19:24:57 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
ls -lh artifacts/ 2>/dev/null || echo "No artifacts"
|