-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(framework:skip) Add caching to speed up E2E CI tests #3480
Conversation
.github/workflows/e2e.yml
Outdated
- name: Install dependencies | ||
run: python -m poetry install | ||
run: python -m pip install . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add -U
flag to always upgrade packages to the newest available version.
Example:
If we have the requirement pytest>=7.3,<8
and the cache already contains the version 7.3
, pip install
does not install the latest version 7.4.1
because pip
prefers the installed version unless --upgrade
or -U
is specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, let me investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue
Description
This PR improves the speed of the CI for E2E tests.
Related issues/PRs
This PR is inspired by #1975 and this blogpost by Evan Pete Walsh. The CI should be triggered couple of times after that has happened to compare the impact of the caching.
Explanation
The CI cache works as follows:
main
branchWhenever a new commit or PR is made to the main branch the
Cache Python location
job in.github/workflows/e2e.yml
will run and cache the following directory:${{ env.pythonLocation }}
(Note that caching only~/.cache/pip
will cache the wheels, but not the installation itself)The cache will be overwritten if there is a cache miss. It is retrieved by jobs in pull requests by the following key:
pip-${{ runner.os }}-${{ matrix.directory }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }}
We ensure that the job retrieving the cache must meet the following requirements:
/opt/hostedtoolcache/Python/3.8.18/x64
)pyproject.toml
in the project folders.One significant update in this PR is that all
pyproject.toml
s in the E2E folder have been migrated to purepip
installation withhatchling
backend without relying onpoetry
andsetuptools
.In this PR, we only rely on
actions@cache
for caching the Python location instead ofactions@setup-python
because the latter does not yet work with matrix configurations due to cache key conflicts. This is explained by thesetup-python
maintainers in this thread.Pull Requests
Pull requests will try to use the cache by doing a lookup using the previously described key and pull the cache is available.
Preliminary results
E2E timings can reduce down to ~4 min 50+ secs by caching the Python location, compared to ~5 min 20+ secs if we cache only
~/.cache/pip
, and ~5 min 40+ secs without caching (see this workflow run).Checklist
[ ] Write tests#contributions
)Changelog entry
Any other comments?
N/A