Skip to content
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

Try out caching pip #2107

Closed
wants to merge 13 commits into from
13 changes: 13 additions & 0 deletions .github/workflows/minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip on windows
id: cache-pip
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: C:\Users\runneradmin\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Check cache hit
if: runner.os == 'Windows'
run: |
echo "Cache hit status: ${{ steps.cache-pip.outputs.cache-hit }}"
- name: Install dependencies
run: |
Comment on lines 40 to 41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the cache to determine how to install dependencies:

Suggested change
- name: Install dependencies
run: |
- name: Install SDV (cache has not changed)
if: steps.cache-pip.outputs.cache-hit == 'true'
run: |
python -m pip install --no-dependencies .
- name: Install SDV and dependencies (cache has changed)
if: steps.cache-pip.outputs.cache-hit != 'true'
run: |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot call the force command --no-dependencies, as that command ignores installing dependencies altogether (Job example).

Pip looks into the cache location path and will directly install those files rather than re-download them so we don't need to have separate steps. Example here: we can see it using the cache and cut down the time for windows installation by not downloading. (~2-3 mins saved)

python -m pip install --upgrade pip
Expand Down
Loading