Repository navigation
ci: run package tests only for the packages whose code changed - #405
Merged
Merged
Conversation
A pull request now runs the test jobs of the packages it changes and of the code that depends on them. A push to master, a manual run, and a change to uv.lock or to this workflow run everything.
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
The workflow
packages.ymlran every package test job, map2loop and the root suite whenever anything underpackages/changed. A change in one package paid for all of them: about 15 minutes for the root suite on three Python versions and several operating systems.A new
changesjob now decides which jobs run. On a pull request, a change runs its own tests and the tests of the code that depends on it:packages/loop_commonpackages/loop_interpolationLoopStructural/,tests/,pyproject.tomlpackages/loopstructural_visualisationpackages/map2loopuv.lock,.github/workflows/packages.ymlThis follows the dependencies in the
pyproject.tomlfiles:loop-interpolationneedsloop-common, the root package needs both,loopstructuralvisualisationneedsLoopStructural, andmap2loopneeds none of them.A push to
masterand a manual run still run everything.Details
changesjob usesdorny/paths-filter@v3. It outputs the list of packages for thepackages-testmatrix, a flag formap2loop-testand a flag for the root suite. The decision is a short bash step in the workflow.packages-testandmap2loop-testare skipped when they are not needed. The root suite usesalways()so that a skipped job inneedsdoes not skip it. It still stops if a job it waits for failed or was cancelled.LoopStructural/**,tests/**,pyproject.tomlanduv.lock. Before, a pull request that changed only the root package did not start this workflow at all. This is a change in coverage: those pull requests now run the root suite withuv, as the package pull requests already did.tester.ymlis not changed.Test plan
uv.lockor the workflow, nothing relevant, a push, a manual run). Each gave the table above, and the package list was valid JSON in each case.packages.yml, so it runs everything. It does not show the filtering. The first pull request after it merges shows the filtering. A pull request that touches only one package is a good check.dorny/paths-filterstep and theifexpression withalways().