70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
# CI/CD Test Pipeline — EPUB→PDF converter (Flask, 27 formats)
|
|
# Stack: backend (Python 3.12) | Framework: pytest
|
|
# Target: Gitea Actions — GitHub-Actions-compatible. Read from
|
|
# .github/workflows/ (canonical, portable to GitHub if you ever migrate)
|
|
# Gitea also natively reads .gitea/workflows/ if you prefer Gitea-native isolation.
|
|
#
|
|
# Proportionate by design (Murat, risk-based): a single `tests` job.
|
|
# No lint job (no linter configured; adding ruff = new dep).
|
|
# No contract-test stage (no Pact).
|
|
# No burn-in loop (hermetic suite; no flakiness history → burn-in is 10x pytest runs for no value).
|
|
# No report stage (no HTML report configured). Quality gates live in step-03.
|
|
# Dependency-free: no new app deps; pandoc installed via apt (matches Dockerfile).
|
|
|
|
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }} # safe context; no unsafe interpolation
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests (Python 3.12)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
cache: 'pip' # caches the pip layer between runs
|
|
|
|
- name: Install pandoc (system dep required by Phase 2 pandoc converters)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y pandoc
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run test suite
|
|
run: |
|
|
set -uo pipefail
|
|
pytest -q
|
|
rc=$?
|
|
if [ "$rc" -ne 0 ]; then
|
|
echo "Tests failed on first attempt ($rc); retrying once to absorb transient flakiness..."
|
|
pytest -q
|
|
fi
|
|
|
|
- name: Upload failure artifacts
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: pytest-artifacts
|
|
path: |
|
|
pytest.log
|
|
test-results/
|
|
.pytest_cache/
|
|
retention-days: 7 |