-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Cache pip downloads in CI #9192
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,10 @@ jobs: | |
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: requirements-tests.txt | ||
- name: Update pip | ||
if: matrix.os == "macos-11" | ||
run: python -m pip install -U pip | ||
- name: Install dependencies | ||
run: pip install $(grep tomli== requirements-tests.txt) $(grep mypy== requirements-tests.txt) | ||
|
@@ -55,6 +58,10 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
requirements-tests.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this contain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we'll be able to specify non-types dependencies, are they going to be specified in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think that's the idea, yup! |
||
stubs/**/@tests/requirements-stubtest.txt | ||
- name: Install dependencies | ||
run: pip install -r requirements-tests.txt | ||
- name: Run stubtest | ||
|
@@ -86,6 +93,8 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: 'pip' | ||
cache-dependency-path: stub_uploader/requirements.txt | ||
- name: Run tests | ||
run: | | ||
cd stub_uploader | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,11 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
typeshed_to_test/requirements-tests.txt | ||
typeshed_to_test/stubs/**/@tests/requirements-stubtest.txt | ||
typeshed_to_test/stubs/**/METADATA.toml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this will actually speed anything up. The only thing this workflow directly pip-installs is Maybe just get rid of the changes to this workflow file, for now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more sensible to base the cache key on Anyway, this can be reconsidered, I'll revert for now. |
||
- name: Install dependencies | ||
run: pip install git+https://github.com/hauntsaninja/mypy_primer.git | ||
- name: Run mypy_primer | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,8 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
python-version: "3.9" | ||
cache: 'pip' | ||
cache-dependency-path: requirements-tests.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. python-version: "3.9"
cache: 'pip'
cache-dependency-path: requirements-tests.txt Consider this as a rant about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😅 What's the preferred quote style between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think we have one, and I for one don't care at all, as long as it works :) |
||
- run: pip install -r requirements-tests.txt | ||
- run: python ./tests/typecheck_typeshed.py --platform=${{ matrix.platform }} |
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.
Why do we need this line? I usually update pip on all envs.
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.
actions/setup-python#506 (comment)
I can only assume
python -m pip install -U pip
was done because of"macos-11"
. As the only times that command is ran is when also using"macos-11
. So only running it on that OS is a small optimization for the others.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.
Given that we have
PIP_DISABLE_PIP_VERSION_CHECK: 1
set as an environment variable in this workflow, we probably don't need this step at all. It usually isn't essential to have the very latest version of pip installed; the only significant benefit from upgrading pip in CI is that you don't get the annoying "WARNING: a newer version of pip is available, you should upgrade NOW" message with every CI job.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.
I didn't even notice
PIP_DISABLE_PIP_VERSION_CHECK
. Should I remove the step? Leave it as it was before?Uh oh!
There was an error while loading. Please reload this page.
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.
I reckon you can remove it. There's other workflows we have in this repo where we don't have it as a step, and removing the step fits with the theme of this PR ("speed up CI by getting pip to do less work").