Skip to content

feat: add reusable python-ci workflow#174

Merged
CybotTM merged 2 commits into
mainfrom
feat/python-ci-reusable
Jun 7, 2026
Merged

feat: add reusable python-ci workflow#174
CybotTM merged 2 commits into
mainfrom
feat/python-ci-reusable

Conversation

@CybotTM

@CybotTM CybotTM commented Jun 7, 2026

Copy link
Copy Markdown
Member

What

Adds .github/workflows/python-ci.yml — a reusable Python CI workflow (lint / type-check / pytest with Codecov coverage upload), matrixed over OS and Python version.

This is the test/lint counterpart to the existing security-only python-audit.yml. A repo typically calls both: python-ci.yml for lint/type/test/coverage and python-audit.yml for the security scan.

Why

Org Python repos currently inline codecov/codecov-action (and the rest of their CI) in each repo's ci.yml, so Renovate bumps the action per repo (e.g. coding_agent_cli_toolset#88). Centralising the action here means it is pinned and bumped once, the same way php-ci.yml already centralises it for PHP repos.

Design

Mirrors php-ci.yml conventions exactly:

  • Pinned action SHAs, step-security/harden-runner, read-only permissions, persist-credentials: false.
  • Secrets passed explicitly (CODECOV_TOKEN), never secrets: inherit.
  • Caller-supplied commands (install-cmd, lint-cmd, type-check-cmd, test-cmd) routed through env: and run via bash -c "$VAR" — no caller text in argument position, no untrusted github.event.* in run:.
  • Codecov pin: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f (v7.0.0, current latest).
  • Coverage upload gated to a single matrix cell (coverage-os + coverage-python-version) to avoid duplicate uploads.

Validation

Locally clean against the repo's actual CI tooling:

  • yamllint (org lint-yaml.yml config) — clean
  • actionlint — clean
  • zizmor — no findings

Follow-up

coding_agent_cli_toolset will migrate its inline ci.yml lint/test/coverage to call this @main, dropping its inline codecov-action.

Add a reusable Python CI workflow (lint / type-check / pytest with
Codecov coverage upload) matrixed over OS and Python version. This is
the test/lint counterpart to the security-only python-audit.yml and
mirrors php-ci.yml conventions: pinned action SHAs, harden-runner,
read-only permissions, persist-credentials: false, explicit secrets,
and caller commands routed through env + bash -c.

Lets org Python repos drop inline codecov-action references (bumped
per-repo by Renovate) in favour of a single centrally-pinned copy.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Copilot AI review requested due to automatic review settings June 7, 2026 08:27
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new reusable GitHub Actions workflow (python-ci.yml) to centralize Python linting, type-checking, testing, and optional coverage uploads for org repositories, following the same “reusable CI workflow” approach already used for PHP.

Changes:

  • Introduces .github/workflows/python-ci.yml as a workflow_call reusable workflow with OS/Python version matrices.
  • Provides caller-configurable install/lint/type-check/test commands executed via environment variables.
  • Adds optional, single-cell-gated coverage upload to Codecov and/or upload as a workflow artifact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/python-ci.yml
Mirror php-ci.yml: a caller that enables coverage upload while disabling
lint/type-check/tests would otherwise have the whole job skipped, making
the upload a silent no-op. Addresses Copilot review on #174.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@CybotTM CybotTM merged commit 6b38d22 into main Jun 7, 2026
11 checks passed
@CybotTM CybotTM deleted the feat/python-ci-reusable branch June 7, 2026 08:33
CybotTM added a commit to netresearch/coding_agent_cli_toolset that referenced this pull request Jun 7, 2026
## What

Replaces the inline `Test Suite` job with the org-standard
`netresearch/.github/.github/workflows/python-ci.yml@main` reusable
(added in netresearch/.github#174). It runs the unit + integration
pytest suites with coverage and uploads to Codecov.

`lint`, `security`, `build`, `docs`, and `integration-e2e` are
unchanged. The reusable caller keeps the job name `test`, so the `needs:
[lint, test]` / `needs: [test]` dependencies stay valid.

## Why

Renovate was bumping `codecov/codecov-action` in this repo per release
(#88). The action now lives once in `python-ci.yml` and is pinned/bumped
centrally — the same model PHP repos use via `php-ci.yml`. There is no
longer an inline `codecov-action` reference here.

Closes #88.

## Behavior notes

- Test execution still runs across `ubuntu-latest`, `macos-latest`,
`windows-latest` on Python 3.14.
- Coverage now uploads **once** (ubuntu / 3.14) instead of from all
three OS cells — the previous setup uploaded three reports with
different `name=` values.
- Install still uses `pip install -r requirements-dev.txt` (matching the
previous job; not switched to uv).

## Residual

The `lint`, `security`, `build`, `docs`, `integration-e2e` jobs still
pin `actions/checkout` / `actions/setup-python`, which Renovate will
still bump occasionally. This PR stops the **codecov** churn
specifically.

## Validation

`yamllint` (org config) and `actionlint` clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants