chore: optimize CI test coverage - #388
Merged
Merged
Conversation
Preserve the full Python compatibility matrix while running live integration tests once and reducing PR binary builds to representative platforms. Remove test retry delays and avoid repeated coverage work to shorten feedback without weakening default-branch or release validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The retry sleep moved from core.rest to core.session on master. Patch the stdlib time.sleep so the test does not depend on the module that holds the retry class. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Expose the Actions runtime so the buildx gha cache engages. - Gate the integration job on all five credentials; show it as skipped, not green, when they are absent. - Move the PR binary subset into binaries-matrix.json and fail on an empty matrix. - Add a paths filter to the push trigger in binaries.yml. - Merge the duplicate pytest steps and guard the artifact uploads. - Enable --strict-markers and document the integration marker. - Share the fake API host fixture; replace the conditional sleep patches with one autouse fixture. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Gate the integration job on the three values it requires. The login tests skip themselves when the username and password are absent. The five-value gate stopped all live tests instead. Also drop the pr key from the binaries matrix so it does not appear in job names. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Optimizes CI runtime by separating hermetic and live tests, reducing redundant coverage and PR binary builds, and adding workflow caching and cancellation.
Changes:
- Adds integration markers and safer, faster test fixtures.
- Runs coverage once and limits PR binaries to representative targets.
- Preserves full post-merge validation and adds workflow optimizations.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Summary |
|---|---|
pyproject.toml |
Configures pytest markers and scoped discovery. |
cloudsmith_cli/core/tests/test_rest.py |
Removes retry backoff delays. |
cloudsmith_cli/core/tests/test_download.py |
Removes unused temporary-directory setup. |
cloudsmith_cli/cli/tests/conftest.py |
Restores environment changes safely. |
cloudsmith_cli/cli/tests/commands/test_upstream.py |
Marks live tests as integration tests. |
cloudsmith_cli/cli/tests/commands/test_tokens.py |
Isolates mocked API behavior. |
cloudsmith_cli/cli/tests/commands/test_repos.py |
Marks live tests as integration tests. |
cloudsmith_cli/cli/tests/commands/test_package_commands.py |
Marks live tests as integration tests. |
cloudsmith_cli/cli/tests/commands/test_login.py |
Marks live tests as integration tests. |
cloudsmith_cli/cli/tests/commands/test_entitlements.py |
Marks live tests as integration tests. |
cloudsmith_cli/cli/tests/commands/test_credential_helper.py |
Removes retry sleeps from tests. |
cloudsmith_cli/cli/tests/commands/test_check.py |
Separates mocked and live checks. |
cloudsmith_cli/cli/tests/commands/policy/test_vulnerability.py |
Marks live policy tests. |
cloudsmith_cli/cli/tests/commands/policy/test_licence.py |
Marks live policy tests. |
cloudsmith_cli/cli/tests/commands/policy/test_deny.py |
Marks live policy tests. |
cloudsmith_cli/cli/tests/commands/conftest.py |
Adds fake API-host fixture support. |
AGENTS.md |
Documents revised test commands; coverage should retain the integration exclusion. |
.github/workflows/ty-check.yml |
Adds push runs and stale-run cancellation. |
.github/workflows/test.yml |
Splits unit, coverage, and integration jobs. |
.github/workflows/image-build.yml |
Adds BuildKit caching and cancellation. |
.github/workflows/binaries.yml |
Filters PR targets while retaining full matrices elsewhere. |
.github/scripts/binaries-matrix.json |
Defines representative PR binary targets. |
Suppressed comments (1)
.github/workflows/test.yml:75
- This gate does not check
PYTEST_CLOUDSMITH_USERNAMEorPYTEST_CLOUDSMITH_PASSWORD, even though both login integration tests require those fixtures. If the API key, host, and organization are configured but either login credential is missing, the integration job runs green with those tests skipped, so the full live suite is not actually validated. Include these two secrets in the gate condition as well.
if [ -n "${API_KEY}" ] && [ -n "${API_HOST}" ] && [ -n "${ORGANIZATION}" ]; then
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
BartoszBlizniak
approved these changes
Aug 25, 2026
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
Reduce PR CI cost and feedback time without reducing the Python compatibility guarantee or the binary targets validated before release.
master, reusable release runs, and manual runsMotivation
The existing matrix provided good coverage, but several dimensions repeated work without testing a distinct compatibility property:
Why keep all supported Python versions on PRs?
The package declares support for Python 3.10 through 3.14. Dependency resolution, SDK behavior, standard-library differences, and syntax/runtime compatibility can vary across those versions. The hermetic suite is now fast enough that retaining all five interpreters gives useful early confidence at relatively low cost.
This deliberately reduces platform breadth for PR binary builds, not Python compatibility breadth.
Test organization
The suite now has an explicit
integrationmarker:Environment fixtures now restore their changes through
monkeypatch, and pytest collection is scoped tocloudsmith_cliso local tool worktrees cannot be collected accidentally.Measured impact
Tradeoff
A binary regression specific to Linux ARM, musl, or macOS Intel may now first appear in the full
mastermatrix rather than in the originating PR. This is intentional: representative OS coverage remains on PRs, while complete target validation remains mandatory on the default branch and release workflow.Validation
pytest -m 'not integration' --no-covpytest -m 'not integration' --cov=cloudsmith_clipre-commit run --all-files