Repository navigation
Run v1/v2 test jobs only when their side of the SDK changes - #233
Merged
Merged
Conversation
Add a changes job that classifies the PR's changed files and gate test-v1 and test-v2 on its outputs with job-level if: conditions, so an unaffected suite reports skipped instead of hitting the live prod API. Shared paths (pyproject.toml, uv.lock, top-level package, test scaffolding and data, this workflow, unrecognised paths) run both; docs, markdown, lint config and other workflows run neither. Detection failure runs both.
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.
PRs to
mainused to run both live suites,test-v1andtest-v2, whatever changed. Each takes about 15 minutes against prod and starts real prod jobs. Now each suite runs only when its side of the SDK is affected.Changes
Only
.github/workflows/tests_main.ymlchanges.A new
changesjob lists the PR's changed files through the GitHub API, including the old path of a renamed file, and classifies each one:fastfuels_sdk/v1/**,tests/v1/**fastfuels_sdk/v2/**,tests/v2/**docs/**,*.md,mkdocs.yml,LICENSE, lint config, other workflowspyproject.toml,uv.lock,fastfuels_sdk/__init__.py,tests/__init__.py,tests/conftest.py,tests/data/**, this workflow, any unrecognised pathThe shared set comes from what the suites actually import.
fastfuels_sdk/__init__.pyimports all of v1, and both suites usetests/__init__.py,tests/conftest.pyandtests/data/.test-v1andtest-v2use job-levelif:conditions rather than anon.pull_request.pathsfilter. An unaffected suite reports "skipped", which branch protection accepts, sotest-v1can still be made a required check.If the
changesjob fails, both suites run. Otherwise a brokenchangesjob would reporttest-v1as "skipped" and let a PR merge untested.The
changesjob only haspull-requests: read. It doesn't check out code or see the API-key secrets.Known gap
A v1-only change doesn't run
test-v2, butimport fastfuels_sdk.v2currently loads v1 too (eager re-export infastfuels_sdk/__init__.py). #232 makes that import lazy, which removes the coupling.Verification
actionlintand the GitHub workflow schema check pass, and so does pre-commit.tests_main.ymlitself, so its own run classifies as "both" and runs both suites. The skip path will show on the next v1-only or v2-only PR.