Files
stack/.woodpecker/ci.yml
kert 78c6f53a9e
Some checks failed
ci/woodpecker/push/infra-ci Pipeline was successful
ci/woodpecker/push/deploy Pipeline failed
coverage 99% coverage
ci/woodpecker/push/ci Pipeline was successful
fix ci: replace drone-git-push plugin with git commands
appleboy/drone-git-push treats 'path' as a chdir directory, not a file
to commit. Use alpine/git with explicit git add/commit/push instead.
2026-03-22 10:54:50 -04:00

122 lines
3.5 KiB
YAML

# ── Quality gate ─────────────────────────────────────────────────
# Runs on every push and PR. Must pass before merge to main.
# Gitea branch protection requires this pipeline's status checks.
when:
- event: [push, pull_request, manual]
steps:
- name: lint
image: ghcr.io/astral-sh/uv:python3.13-bookworm-slim
environment:
UV_PYTHON_PREFERENCE: only-system
UV_LINK_MODE: copy
UV_PROJECT_ENVIRONMENT: .venv
commands:
- uv sync --dev
- uv run ruff check src/ tests/ --output-format=concise
- uv run ruff format --check src/ tests/
- name: test
image: ghcr.io/astral-sh/uv:python3.13-bookworm-slim
environment:
UV_PYTHON_PREFERENCE: only-system
UV_LINK_MODE: copy
UV_PROJECT_ENVIRONMENT: .venv
commands:
- uv run pytest tests/ --cov=src --cov-report=term-missing --cov-fail-under=99 -q 2>&1 | tee pytest.out
- uv run python dev/scripts/coverage_badge.py < pytest.out > coverage.svg
depends_on:
- lint
- name: coverage-badge
image: ghcr.io/astral-sh/uv:python3.13-bookworm-slim
failure: ignore
environment:
UV_PYTHON_PREFERENCE: only-system
UV_LINK_MODE: copy
UV_PROJECT_ENVIRONMENT: .venv
GITEA_TOKEN:
from_secret: gitea_token
GITEA_URL:
from_secret: gitea_url
commands:
- uv run python dev/scripts/coverage_badge.py --post pytest.out
depends_on:
- test
- name: commit-badge
image: alpine/git
failure: ignore
environment:
REGISTRY_USER:
from_secret: registry_user
REGISTRY_PASS:
from_secret: registry_pass
commands:
- git config user.name woodpecker-ci
- git config user.email ci@fhirworx.io
- git add coverage.svg
- git diff --cached --quiet && echo "no change" && exit 0
- git commit -m "update coverage badge [skip ci]"
- git push http://$REGISTRY_USER:$REGISTRY_PASS@gitea:3000/homelab/stack.git HEAD:main
when:
- branch: main
event: push
depends_on:
- test
- name: upload-coverage-badge
image: woodpeckerci/plugin-s3
failure: ignore
settings:
endpoint: http://rustfs:9000
bucket: gitea
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
source: "coverage.svg"
target: /badges/homelab/stack/
path_style: true
depends_on:
- test
- name: pr-comment
image: woodpeckerci/plugin-gitea-comment
settings:
gitea_url:
from_secret: gitea_url
api_key:
from_secret: gitea_token
message: >
**CI** for `${CI_COMMIT_SHA:0:8}` —
[pipeline #${CI_PIPELINE_NUMBER}](${CI_PIPELINE_URL})
when:
- event: pull_request
depends_on:
- test
- coverage-badge
- name: validate-compose
image: docker:cli
volumes:
- /run/user/1000/docker.sock:/var/run/docker.sock
commands:
- docker compose config --quiet
# ── Failure reporter ─────────────────────────────────────────
- name: report-failure
image: ghcr.io/astral-sh/uv:python3.13-bookworm-slim
environment:
UV_PYTHON_PREFERENCE: only-system
UV_LINK_MODE: copy
UV_PROJECT_ENVIRONMENT: .venv
GITEA_TOKEN:
from_secret: gitea_token
commands:
- uv sync --no-dev
- uv run python -m api.diag
when:
- status: [failure]