sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Cache dependencies in CI

Open antonpirker opened this issue 3 years ago • 1 comments

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

antonpirker avatar Sep 15 '22 07:09 antonpirker

See also the discussion here: https://github.com/getsentry/sentry-python/discussions/1620

antonpirker avatar Sep 15 '22 07:09 antonpirker

Tests are ok now, so I am closing this for now.

antonpirker avatar Jan 24 '23 10:01 antonpirker