Skip to content

Commit

Permalink
CI: cache pip installs (microsoft#1057)
Browse files Browse the repository at this point in the history
* CI: cache pip installs

* Update to new min deps filename

* Use cache action instead

* Cache releases too
  • Loading branch information
adamjstewart authored Feb 7, 2023
1 parent 76e9442 commit 590a412
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install .[tests]
pip list
Expand All @@ -33,7 +40,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install .[datasets,tests]
pip list
Expand All @@ -49,7 +63,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install .[datasets,docs,tests]
pip list
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/style.txt
pip list
Expand All @@ -35,7 +42,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/style.txt
pip list
Expand All @@ -51,7 +65,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/style.txt
pip list
Expand All @@ -67,7 +88,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/style.txt
pip list
Expand All @@ -83,7 +111,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/style.txt') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/style.txt
pip list
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/required.txt') }}-${{ hashFiles('requirements/datasets.txt') }}-${{ hashFiles('requirements/tests.txt') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/required.txt -r requirements/datasets.txt -r requirements/tests.txt
pip list
Expand All @@ -41,6 +48,12 @@ jobs:
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/required.txt') }}-${{ hashFiles('requirements/datasets.txt') }}-${{ hashFiles('requirements/tests.txt') }}
- name: Setup headless display for pyvista
uses: pyvista/setup-headless-display-action@v1
- name: Install apt dependencies (Linux)
Expand All @@ -58,6 +71,7 @@ jobs:
pacman -S --noconfirm --needed unrar
if: ${{ runner.os == 'Windows' }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/required.txt -r requirements/datasets.txt -r requirements/tests.txt
pip list
Expand Down Expand Up @@ -86,11 +100,18 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.8'
- name: Cache dependencies
uses: actions/[email protected]
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/min-reqs.old') }}-${{ hashFiles('requirements/mins-cons.old') }}
- name: Install apt dependencies (Linux)
run: |
sudo apt-get update
sudo apt-get install unrar
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install -r requirements/min-reqs.old -c requirements/min-cons.old
pip list
Expand Down

0 comments on commit 590a412

Please sign in to comment.