Skip to content

Cache dependencies in CI #1618

Closed
Closed
@antonpirker

Description

@antonpirker

Problem Statement

When running our tests in GitHub actions a lot of virtual environments are created where the dependencies for the current test runs are installed.

This takes a long time. There is a caching feature in GitHub actions.
See:
https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows

Solution Brainstorm

In the (Javascript) example in the documentation they use a hash of the contents of package-lock.json as the key.

This we can not use, because he have for example this depencency in our requirements file Werkzeug<2.1.0.

So if 2.4 is the current Werkzeug version and we run our tests, Version 2.4 will be put in the cache.
If then Werkzeug 2.5 is release and we run our tests again we will still have 2.4 in our cache and it will not be invalidated and we will run the tests against 2.4 and not 2.5.

To have proper lock file for the caching we should consider using something like pipenv or poetry instead of pip:
https://remastr.com/blog/pip-pipenv-poetry-comparison

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions