disinto/.woodpecker/smoke-init.yml

39 lines
1.5 KiB
YAML
Raw Normal View History

# .woodpecker/smoke-init.yml — Smoke test for disinto init using mock Forgejo
#
# Runs on PRs that touch init-related files:
# - bin/disinto (the init code)
# - lib/load-project.sh, lib/env.sh (init dependencies)
# - tests/** (test changes)
# - .woodpecker/smoke-init.yml (pipeline changes)
#
# Uses mock Forgejo server (starts in <1s) instead of real Forgejo.
# Total runtime target: <10 seconds.
#
# Pipeline steps:
# 1. Start mock-forgejo.py (instant startup)
# 2. Run smoke-init.sh which:
# - Runs disinto init against mock
# - Verifies users, repos, labels created via API
# - Verifies .env tokens, TOML generated, cron installed
# - Queries /mock/state endpoint to verify all API calls made
when:
- event: pull_request
path:
- "bin/disinto"
- "lib/load-project.sh"
- "lib/env.sh"
- "tests/smoke-init.sh"
- "tests/mock-forgejo.py"
- ".woodpecker/smoke-init.yml"
steps:
- name: smoke-init
image: python:3-alpine
commands:
- apk add --no-cache bash curl jq git coreutils
- MOCK_FORGE_PORT=3001 python3 tests/mock-forgejo.py > /tmp/mock.log 2>&1 &
# Wait for mock to be ready (might be on a different port if 3001 is in use)
- for i in $(seq 1 30); do curl -sf http://localhost:$MOCK_FORGE_PORT/api/v1/version >/dev/null 2>&1 && break || sleep 1; done
- SMOKE_FORGE_URL=http://localhost:$MOCK_FORGE_PORT FORGE_URL=http://localhost:$MOCK_FORGE_PORT bash tests/smoke-init.sh