ci: cache pip and Ansible Galaxy dependencies - #127
Merged
Conversation
Add `cache: pip` with `cache-dependency-path: requirements-dev.txt` to the three setup-python steps (lint, pytest, molecule). Add an actions/cache step for `~/.ansible/collections` keyed on a hash of requirements.yml in the two jobs that run `ansible-galaxy collection install` (lint, molecule). The setup-python pip cache does not cover Galaxy collections. The new actions/cache ref is pinned to a full commit SHA to satisfy the zizmor unpinned-uses gate. Closes #125 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
|
WORK:REVIEW
|
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.
Adds dependency caching to the CI workflows.
What this does
cache: pipwithcache-dependency-path: requirements-dev.txton all threeactions/setup-pythonsteps (lint, pytest, molecule). All three jobs installfrom the same file, so one dependency path covers them.
actions/cachestep for~/.ansible/collections, keyed on a hash ofrequirements.yml, in the two jobs that runansible-galaxy collection install(lint and molecule). The pip cache does not cover Galaxy collections.The
pytestjob does not install collections and does not get this step.The new
actions/cacheref is pinned to a full commit SHA (v6→55cc8345863c7cc4c66a329aec7e433d2d1c52a9) to satisfy the zizmorunpinned-usesgate added in #124.Notes
matrix-dependent — all four legs install the same
requirements.ymland shareone entry. Concurrent saves produce an
actions/cachewarning, not a failure.ansible-galaxy collection installruns unconditionally rather than beinggated on
cache-hit, so a partial or stale cache is reconciled againstrequirements.ymlon every run. Verified locally that installing over adifferent pinned version overwrites correctly in both the upgrade and
downgrade direction.
cache: pipcaches pip's download cache, not installed packages —pip installstill resolves and installs each run, so the saving is download timeonly. Expect the first run on this branch to be a cache miss.
Closes #125