Try caching of pip dependencies so that pip install can be skipped for subsequent builds that don't change dependencies.

Use hash of both dev-requirements.txt and requirements.txt files for cache key.
pull/3028/head
derekpierre 2022-11-25 12:22:12 -05:00
parent 2ecd189819
commit 68bbdb83e1
2 changed files with 30 additions and 6 deletions

View File

@ -18,13 +18,25 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10 and install dependencies
- id: setup_python
name: Set up Python 3.10 Environment
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.10'
cache: 'pip' # cache pip dependencies
- run: pip install .[dev]
- id: python_cache
name: Retrieve Cached Python Dependencies
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('dev-requirements.txt', 'requirements.txt') }}
- name: Install Dependencies
if: steps.python_cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Install Solidity Compiler
run: python ./scripts/installation/install_solc.py

View File

@ -21,12 +21,24 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} and install dependencies
- id: setup_python
name: Set up Python ${{ matrix.python-version }} Environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # cache pip dependencies
- run: pip install .[dev]
- id: python_cache
name: Retrieve Cached Python Dependencies
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('dev-requirements.txt', 'requirements.txt') }}
- name: Install Dependencies
if: steps.python_cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Install Solidity Compiler
run: python ./scripts/installation/install_solc.py