Add GitHub Actions CI workflow with ruff and license-header checks#6
Merged
ViacheslavKlimov merged 7 commits intorelease/4.3from Apr 29, 2026
Merged
Add GitHub Actions CI workflow with ruff and license-header checks#6ViacheslavKlimov merged 7 commits intorelease/4.3from
ViacheslavKlimov merged 7 commits intorelease/4.3from
Conversation
- pyproject.toml gains [tool.ruff] config selecting E/W/F/I/B/UP rules with line-length 100, py310 target, per-file-ignores for tests, and exclusions for the generated tb_*_client/ packages. - scripts/apply-license-headers.py is a new idempotent script that walks common/ and scripts/, prepending the existing LICENSE_HEADER template (reused from post_process.py) where missing. Supports --check for CI gating. - Apply ruff --fix and ruff format across hand-written code; small manual fixes in scripts/post_process.py for unused vars and one unavoidable long string template (noqa). - Run apply-license-headers.py once: headers added to common/ overlay files (which ship inside the published wheels via generate-client.sh) and to scripts/*.py for parity with the shell scripts that already carry headers. - Bump tests/test_post_process.py controller-count assertion 57 -> 58 to match the CE spec at 4.4.0 (was stale on master).
Single workflow .github/workflows/ci.yml runs on pull_request and push to master with three parallel jobs: - test: pytest matrix on Python 3.10 and 3.13 (fail-fast off) - lint: ruff check, ruff format --check, and the license-header --check gate - build: full edition pipeline via scripts/build-packages.sh, with Java 17 and a cached openapi-generator JAR; uploads wheels-<sha> artifact Top-level concurrency cancels superseded PR runs but lets master pushes complete. Workflow has read-only contents permission.
Without an explicit [tool.poetry.dependencies].python entry, Poetry defaults the project's supported Python range to '>=2.7,<2.8 || >=3.4', which is incompatible with pytest-mock's '>=3.9' floor and breaks 'poetry install --no-root' on CI runners. Pin to '>=3.10,<4.0' to match the per-edition pyproject.toml files.
The committed tb_ce_client package imports pydantic, urllib3, python-dateutil, and typing-extensions at module load time, so collecting the test files (which sys.path-import tb_ce_client) fails in a fresh CI venv that only has pytest installed. Install ce/ via 'poetry run pip install ./ce' so its [tool.poetry. dependencies] block in ce/pyproject.toml drives the runtime dep versions — single source of truth, no duplication into the root pyproject.toml.
The exponential-backoff path computed base_ms = min(..., max_delay_ms) and *then* applied +/-20% jitter, so a maxed-out base could exceed the cap by up to 20% (e.g. 15000 -> 18000). The test test_retry::TestDelayCappedAtMax::test_delay_capped_at_max asserts delay <= max_delay_ms and was flaky for this reason — failing deterministically about half the time on CI. Re-apply min(delay_ms, max_delay_ms) after jitter. Sync the same fix into the overlaid copies in tb_ce_client/, tb_pe_client/, tb_paas_client/ so the published wheels carry the fix until the next regeneration.
Running 'poetry install' from the root pyproject.toml — needed for the test job in CI as well as local dev — generates poetry.lock as a side effect. The repo's convention is not to track lock files (no edition's poetry.lock is in git either; libraries should resolve against the current pin ranges, not a frozen snapshot).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a GitHub Actions CI pipeline to
release/4.3so PRs and pushes are validated before merge. Three parallel jobs:ruff check,ruff format --check, and a license-header gate (scripts/apply-license-headers.py --check)scripts/build-packages.sh(regenerates all 3 editions, builds wheels, smoke-tests in clean venvs); uploadswheels-<sha>artifactWorkflow triggers on
pull_requestand onpushtomasteror anyrelease/*branch.Alongside the workflow, this PR ships:
[tool.ruff]config in rootpyproject.toml(E,W,F,I,B,UPrules; line-length 100;py310target; per-file-ignores fortests/**; exclusions for generatedtb_*_client/packages).scripts/apply-license-headers.py— idempotent automation that walkscommon/andscripts/and prepends the existing Apache 2.0 header (reused frompost_process.py) to any.pyfile missing one. Supports--checkfor CI gating.--fix+ruff formatacross all hand-written code, plus license headers added tocommon/__init__.py,common/_auth.py,common/_retry.py,scripts/post_process.py,scripts/flatten_docs.py, andscripts/apply-license-headers.pyitself.tests/test_post_process.py(controller count57 → 58) — the assertion was already failing onrelease/4.3independent of CI work.Follow-up for maintainers
After merge, configure
release/4.3branch protection in repo settings to require these status checks:test (3.10),test (3.13),lint,build. A matching PR formasterwill follow.