Use reusable workflow to eliminate setup duplication between test and collateral#199
Use reusable workflow to eliminate setup duplication between test and collateral#199
Conversation
Agent-Logs-Url: https://github.com/jaraco/skeleton/sessions/ae6f447e-da11-4a46-a8d7-23cdbbffe148 Co-authored-by: jaraco <308610+jaraco@users.noreply.github.com>
| env: | ||
| # Environment variable to support color support (jaraco/skeleton#66) | ||
| FORCE_COLOR: 1 | ||
|
|
||
| # Suppress noisy pip warnings | ||
| PIP_DISABLE_PIP_VERSION_CHECK: 'true' | ||
| PIP_NO_WARN_SCRIPT_LOCATION: 'true' | ||
|
|
||
| # Ensure tests can sense settings about the environment | ||
| TOX_OVERRIDE: >- | ||
| testenv.pass_env+=GITHUB_*,FORCE_COLOR |
There was a problem hiding this comment.
@copilot This content is duplicated with main.yml. Is it possible for it to be shared or only defined in one place?
There was a problem hiding this comment.
GitHub Actions doesn't propagate a calling workflow's env into a reusable workflow — they're separate contexts, so the duplication was previously unavoidable.
Since test and collateral now fully delegate to test-suite.yml, the env block in main.yml was no longer serving any job there (the only remaining inline-step job is release, which doesn't need those vars). Removed it in 62e53f8 — the env is now defined in one place only (test-suite.yml).
Agent-Logs-Url: https://github.com/jaraco/skeleton/sessions/35bde516-10a9-4b0d-8c1f-6daa390f7011 Co-authored-by: jaraco <308610+jaraco@users.noreply.github.com>
webknjaz
left a comment
There was a problem hiding this comment.
Try experimenting with integrating https://github.com/ansible/ansible-builder/blob/e94e544b9a003040efde05023ea755d01ee302d9/.github/workflows/ci.yml#L80-L154 in some canary project to see how it goes.
testandcollateraljobs duplicated setup steps, making it easy to add a workaround to one but forget the other — critical becausediffcovincollateralactually runs the tests and needs identical setup.Changes
New
.github/workflows/test-suite.yml— reusableworkflow_callworkflow encapsulating all shared logic:python(default3.x),platform(defaultubuntu-latest),tox-env(default empty)fetch-depth: 0(required for diffcov)toxortox -e <env>based ontox-envinputFORCE_COLOR,TOX_OVERRIDE, etc.)Updated
main.yml— bothtestandcollateralnow delegate to the reusable workflow: