feat(ci): add relay E2E testing job and persona event tests

The 184 ignored Rust E2E tests in sprout-test-client were never run in
CI — the relay only got exercised indirectly through Playwright. This
adds a dedicated relay-e2e job and shared infra script so relay protocol
correctness is tested directly.

Changes:
- scripts/start-relay-for-tests.sh: shared script that starts docker
  compose services, waits for health, applies schema, builds and starts
  the relay, and polls readiness. Used by both the new relay-e2e job and
  the refactored desktop-e2e-integration job.
- .github/workflows/ci.yml: new relay-e2e job (triggers on crates/**
  changes, ~5 min) that runs all ignored E2E tests against the relay.
  desktop-e2e-integration refactored to use the shared script instead of
  inline infra setup.
- crates/sprout-test-client/tests/e2e_persona.rs: 11 new E2E tests for
  kind:30175 persona events covering publish+query, NIP-33 replacement
  semantics, d-tag validation (empty, missing, too long, uppercase,
  special chars, underscore start), valid slug acceptance, and multiple
  personas per author.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
2026-06-10 19:54:53 -04:00
parent c95517812a
commit 0b9eebcbee
3 changed files with 616 additions and 58 deletions

View File

@@ -211,8 +211,6 @@ jobs:
.
desktop/src-tauri
save-if: ${{ github.event_name != 'pull_request' }}
- name: Start integration services
run: docker compose up -d postgres redis typesense minio minio-init
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
@@ -246,63 +244,8 @@ jobs:
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
- name: Desktop build
run: just desktop-build
- name: Wait for integration services
run: |
wait_healthy() {
local service="$1"
local container="$2"
for attempt in $(seq 1 60); do
status=$(docker inspect --format='{{.State.Health.Status}}' "${container}" 2>/dev/null || echo "not_found")
if [ "${status}" = "healthy" ]; then
echo "${service} is healthy"
return 0
fi
sleep 2
done
docker logs "${container}" || true
return 1
}
wait_healthy "Postgres" "sprout-postgres"
wait_healthy "Redis" "sprout-redis"
wait_healthy "Typesense" "sprout-typesense"
wait_healthy "MinIO" "sprout-minio"
- name: Apply database schema
run: ./bin/pgschema apply --file schema/schema.sql --auto-approve
env:
PGHOST: localhost
PGPORT: "5432"
PGUSER: sprout
PGPASSWORD: sprout_dev
PGDATABASE: sprout
- name: Build relay
run: cargo build --profile ci -p sprout-relay
- name: Start relay
run: |
nohup env \
DATABASE_URL=postgres://sprout:sprout_dev@localhost:5432/sprout \
REDIS_URL=redis://localhost:6379 \
TYPESENSE_URL=http://localhost:8108 \
TYPESENSE_API_KEY=sprout_dev_key \
RELAY_URL=ws://localhost:3000 \
SPROUT_BIND_ADDR=0.0.0.0:3000 \
SPROUT_REQUIRE_AUTH_TOKEN=false \
SPROUT_RECONCILE_CHANNELS=true \
SPROUT_GIT_PROBE_WRITERS=8 \
./target/ci/sprout-relay > /tmp/sprout-relay.log 2>&1 &
echo $! > /tmp/sprout-relay.pid
for attempt in $(seq 1 60); do
if ! kill -0 "$(cat /tmp/sprout-relay.pid)" 2>/dev/null; then
cat /tmp/sprout-relay.log
exit 1
fi
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:3000/_readiness || true)
if [ "${status_code}" = "200" ]; then
exit 0
fi
sleep 1
done
cat /tmp/sprout-relay.log
exit 1
run: ./scripts/start-relay-for-tests.sh
- name: Seed desktop e2e data
run: bash scripts/setup-desktop-test-data.sh
- name: Desktop relay-backed e2e
@@ -324,6 +267,32 @@ jobs:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
relay-e2e:
name: Relay E2E
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [changes]
if: github.event_name == 'push' || needs.changes.outputs.rust == 'true'
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.event_name != 'pull_request' }}
- name: Start relay
run: ./scripts/start-relay-for-tests.sh
- name: Relay E2E tests
run: RELAY_URL=ws://localhost:3000 cargo test -p sprout-test-client --test '*' -- --ignored --nocapture
- name: Upload relay logs
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: relay-e2e-artifacts
path: /tmp/sprout-relay.log
if-no-files-found: ignore
web:
name: Web
runs-on: ubuntu-latest