Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
148 lines
4.4 KiB
YAML
148 lines
4.4 KiB
YAML
services:
|
||
- name: postgres
|
||
image: postgres:16
|
||
environment:
|
||
POSTGRES_DB: python_tdd_test
|
||
POSTGRES_USER: postgres
|
||
POSTGRES_PASSWORD: postgres
|
||
|
||
- name: redis
|
||
image: redis:7
|
||
|
||
steps:
|
||
- name: test-UTs-n-ITs
|
||
image: python:3.13-slim
|
||
environment:
|
||
DATABASE_URL: postgresql://postgres:postgres@postgres/python_tdd_test
|
||
CELERY_BROKER_URL: redis://redis:6379/0
|
||
REDIS_URL: redis://redis:6379/1
|
||
# Workspace-shared pip cache — Woodpecker mounts the workspace across
|
||
# all steps in a run, so the wheels populated here are reused by
|
||
# test-two-browser-FTs + test-FTs (saves ~30-60s × 2 = ~1-2 min per
|
||
# run). Cache lives only inside one run; cross-run caching would
|
||
# need a volume plugin.
|
||
PIP_CACHE_DIR: .pip-cache
|
||
commands:
|
||
- pip install -r requirements.txt
|
||
- cd ./src
|
||
- python manage.py test apps
|
||
when:
|
||
- event: push
|
||
path:
|
||
- "src/**"
|
||
- "requirements.txt"
|
||
- ".woodpecker/main.yaml"
|
||
|
||
- name: test-two-browser-FTs
|
||
image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest
|
||
environment:
|
||
HEADLESS: 1
|
||
CELERY_BROKER_URL: redis://redis:6379/0
|
||
REDIS_URL: redis://redis:6379/1
|
||
STRIPE_SECRET_KEY:
|
||
from_secret: stripe_secret_key
|
||
STRIPE_PUBLISHABLE_KEY:
|
||
from_secret: stripe_publishable_key
|
||
PIP_CACHE_DIR: .pip-cache
|
||
commands:
|
||
- pip install -r requirements.txt
|
||
- cd ./src
|
||
- python manage.py collectstatic --noinput
|
||
- python manage.py test functional_tests --tag=two-browser
|
||
- python manage.py test functional_tests --tag=sequential
|
||
- python manage.py test functional_tests --tag=channels
|
||
when:
|
||
- event: push
|
||
path:
|
||
- "src/**"
|
||
- "requirements.txt"
|
||
- ".woodpecker/main.yaml"
|
||
|
||
- name: test-FTs
|
||
image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest
|
||
environment:
|
||
HEADLESS: 1
|
||
CELERY_BROKER_URL: redis://redis:6379/0
|
||
REDIS_URL: redis://redis:6379/1
|
||
STRIPE_SECRET_KEY:
|
||
from_secret: stripe_secret_key
|
||
STRIPE_PUBLISHABLE_KEY:
|
||
from_secret: stripe_publishable_key
|
||
PIP_CACHE_DIR: .pip-cache
|
||
commands:
|
||
- pip install -r requirements.txt
|
||
- cd ./src
|
||
- python manage.py collectstatic --noinput
|
||
- python manage.py test functional_tests --parallel --exclude-tag=channels --exclude-tag=two-browser
|
||
when:
|
||
- event: push
|
||
path:
|
||
- "src/**"
|
||
- "requirements.txt"
|
||
- ".woodpecker/main.yaml"
|
||
|
||
- name: screendumps
|
||
image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest
|
||
commands:
|
||
- cat ./src/functional_tests/screendumps/*.html || echo "No screendumps found"
|
||
when:
|
||
- event: push
|
||
status: failure
|
||
path:
|
||
- "src/**"
|
||
- "requirements.txt"
|
||
- ".woodpecker/main.yaml"
|
||
|
||
- name: build-and-push
|
||
image: docker:cli
|
||
environment:
|
||
REGISTRY_PASSWORD:
|
||
from_secret: gitea_registry_password
|
||
commands:
|
||
- echo "$REGISTRY_PASSWORD" | docker login gitea.earthmanrpg.me -u discoman --password-stdin
|
||
- docker build -t gitea.earthmanrpg.me/discoman/gamearray:latest .
|
||
- docker push gitea.earthmanrpg.me/discoman/gamearray:latest
|
||
when:
|
||
- branch: main
|
||
event: push
|
||
path:
|
||
- "src/**"
|
||
- "requirements.txt"
|
||
- "Dockerfile"
|
||
- ".woodpecker/main.yaml"
|
||
|
||
- name: deploy-staging
|
||
image: alpine
|
||
environment:
|
||
SSH_KEY:
|
||
from_secret: deploy_ssh_key
|
||
commands:
|
||
- apk add --no-cache openssh-client
|
||
- mkdir -p ~/.ssh
|
||
- printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
|
||
- chmod 600 ~/.ssh/id_ed25519
|
||
- ssh -o StrictHostKeyChecking=no discoman@staging.earthmanrpg.me /opt/gamearray/deploy.sh
|
||
when:
|
||
- branch: main
|
||
event: push
|
||
path:
|
||
- "src/**"
|
||
- "requirements.txt"
|
||
- "Dockerfile"
|
||
- "infra/**"
|
||
- ".woodpecker/main.yaml"
|
||
|
||
- name: deploy-prod
|
||
image: alpine
|
||
environment:
|
||
SSH_KEY:
|
||
from_secret: deploy_ssh_key
|
||
commands:
|
||
- apk add --no-cache openssh-client
|
||
- mkdir -p ~/.ssh
|
||
- printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
|
||
- chmod 600 ~/.ssh/id_ed25519
|
||
- ssh -o StrictHostKeyChecking=no discoman@staging.earthmanrpg.me /opt/gamearray/deploy.sh
|
||
when:
|
||
- event: tag
|