Attempt to cache all the wheels

This commit is contained in:
Jean-Paul Calderone 2023-08-09 12:34:09 -04:00
parent c5cac7b5a7
commit 4db44dc178

View File

@ -206,6 +206,11 @@ jobs:
# "save_cache" step below or caching won't really work right.
PIP_CACHE_DIR: "pip-cache"
# And tell pip where it can find out cached wheelhouse for fast wheel
# installation, even for projects that don't distribute wheels. This
# must also agree with the "save_cache" step below.
PIP_FIND_LINKS: "wheelhouse"
steps:
- "checkout"
@ -213,7 +218,11 @@ jobs:
# download all our Python dependencies from PyPI.
- "restore_cache":
keys:
- "pip-packages-v1-{{ checksum \"setup.py\" }}"
# The download cache and/or the wheelhouse may contain Python
# version-specific binary packages so include the Python version
# in this key, as well as the canonical source of our
# dependencies.
- "pip-packages-v1-{{ parameters.pythonVersion }}-{{ checksum \"setup.py\" }}"
- "run":
name: "Fix $env:PATH"
@ -239,16 +248,34 @@ jobs:
python misc/build_helpers/show-tool-versions.py
- "run":
name: "Install Dependencies"
# It's faster to install a wheel than a source package. If we don't
# have a cached wheelhouse then build all of the wheels and dump
# them into a directory where they can become a cached wheelhouse.
# We would have built these wheels during installation anyway so it
# doesn't cost us anything extra and saves us effort next time.
name: "(Maybe) Build Wheels"
command: |
python -m pip install .[testenv] .[test]
if ((Test-Path .\wheelhouse) -and (Test-Path .\wheelhouse\*)) {
echo "Found populated wheelhouse, skipping wheel building."
} else {
python -m pip wheel --wheel-dir $env:PIP_FIND_LINKS .[testenv] .[test]
}
- "save_cache":
paths:
# Make sure this agrees with PIP_CACHE_DIR in the environment.
- "pip-cache"
- "wheelhouse"
key: "pip-packages-v1-{{ checksum \"setup.py\" }}"
- "run":
name: "Install Dependencies"
environment:
# By this point we should no longer need an index.
PIP_NO_INDEX: "1"
command: |
python -m pip install .[testenv] .[test]
- "run":
name: "Run Unit Tests"
environment: