A GitHub Actions CI workflow builder for Python that generates a valid
.github/workflows/ci.yml. Choose the Python versions to test, whether to lint with
flake8, whether to collect coverage, and whether to add a Docker build, and it produces a
matrix workflow with pip caching.
How it works
The test job runs on ubuntu-latest with a strategy.matrix.python-version listing your
versions as quoted strings (so 3.10 is not parsed as the number 3.1). fail-fast: false
runs every version even when one fails. Each run checks out the code, sets up Python with
actions/setup-python@v5 and cache: pip, then installs requirements.txt plus pytest and
the optional tooling.
When lint is on, it runs the two-pass flake8 pattern: a strict pass that fails on real
errors (E9,F63,F7,F82) and a permissive style pass. When coverage is on, pytest runs
with --cov and the resulting coverage.xml is uploaded as a per-version artifact. An
optional second docker job, gated by needs: test, builds your image tagged with the
commit SHA only after the matrix passes.
Tips and notes
- Python versions are emitted as quoted strings on purpose — an unquoted
3.10would be read as the float3.1by YAML, silently testing the wrong runtime. - Keep a
requirements.txt(or adjust the install step forpyproject.toml/requirements-dev.txt); the workflow installs from it before running tests. - Replace the coverage upload with the
codecov/codecov-actionstep if you want coverage trends and PR comments rather than a downloadable artifact. - The strict flake8 pass is the one that should gate merges — it flags undefined names and syntax errors that would crash at runtime, independent of style preferences.