Closed juhoinkinen closed 1 year ago
Base: 99.56% // Head: 99.56% // Increases project coverage by +0.00%
:tada:
Coverage data is based on head (
c10792c
) compared to base (8a194c4
). Patch has no changes to coverable lines.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Back to draft, there should be a better way to fix this.
Force-pushed to drop very many unsuccessful commits trying to make caching step conditional, with lines like
if: steps.prepare.outputs.cache-matched-key != format('poetry-installation-and-cache-{0}-{1}-{2}', ${{ matrix.python-version }}, ${{ env.POETRY_VERSION }}, ${{ hashFiles('**/poetry.lock') }})
Kudos, SonarCloud Quality Gate passed!
Lately the Python 3.10 test CI/CD jobs have been slow (~7 mins), because the Python dependencies have not been available from cache. First occurrence is in the CI/CD job #308, however it seems that the reason for the slow-down is introducing the linting job in PR #656, because this job has shared the cache keys with the Python 3.10 test job. This has prevented (re)creating/updating the cache by the test job (with the necessary optional dependencies); the "Post" steps for setup-python and caching steps in the test jobs have had errors like:
To avoid this in the caching step the cache key is appended with-${{ github.job }}
so the keys are now clearly different in lint and test jobs (poetry-installation-and-repos-3.10.8-1.2.0-lint
vs.poetry-installation-and-repos-3.10-1.2.0-test
). In the setup-python action the key cannot be specified, so the fix (for now) is to to pin the Python version to 3.10.8 in the linting job, but in the test job to more relaxed 3.10, which makes the keys different by the patch version (setup-python-Linux-python-3.10.8-poetry-<hash>
vs.setup-python-Linux-python-3.10.9-poetry-<hash>
).Now restoring and saving cache is more controlled by using separate cache/restore and cache/save actions: restoring is performed before every job, but saving only after the test jobs that have various optional dependencies installed.
Also now the cache should be updated/recreated if some dependency has been updated, as the cache key includes hash of the
poetry.lock
. The cache restoration is based on "closest matching" key by usingrestore-keys
(the plainkey
is not used at all).The cache/save step is conditional: it is skipped if there are no changes in dependencies.
To make the workflow setup more manageable, the caching, Poetry install and Python setup steps are gathered in one composite action in
.github/actions/prepare/action.yml
file.