From 41fd734a294f8a3af59c6b3895b3154ff4a8da8f Mon Sep 17 00:00:00 2001 From: sirdave73 Date: Thu, 3 Sep 2026 13:25:36 -0400 Subject: [PATCH] =?UTF-8?q?Add=20CI/CD=20test=20pipeline=20(Gitea=20Action?= =?UTF-8?q?s)=20=E2=80=94=20Python=203.12=20+=20pandoc=20+=20pytest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f738df3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,70 @@ +# 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 \ No newline at end of file