Unverified Commit 2bd85c05 authored by Min Xu's avatar Min Xu Committed by GitHub
Browse files

[chore] fix pyenv download cache (#997)



* [chore] fix pyenv download cache

* fix
Co-authored-by: default avatarMin Xu <min.xu.public@gmail.com>
parent c4af33b6
...@@ -230,6 +230,11 @@ commands: ...@@ -230,6 +230,11 @@ commands:
version: version:
type: string type: string
steps: steps:
# Cache the pyenv download directory to avoid re-downloading over and over.
- restore_cache:
keys:
- cache-key-pyenv-3-9-7-v1
- run: - run:
name: Setup pyenv name: Setup pyenv
# We used to use the following commands to update pyenv. # We used to use the following commands to update pyenv.
...@@ -237,13 +242,22 @@ commands: ...@@ -237,13 +242,22 @@ commands:
# pyenv update # pyenv update
# However, it is not deterministic since pyenv is being updated. # However, it is not deterministic since pyenv is being updated.
# It is now fixed to a version. (v2.3.0 is broken since it cause bash to fail when it try to do "eval $(pyenv init -)") # It is now fixed to a version. (v2.3.0 is broken since it cause bash to fail when it try to do "eval $(pyenv init -)")
#
# We use "-sf" to skip already installed version after cache restoring the pyenv dir. This should avoid redoing
# downloading and installing. The key name has a "v1" in the end so that we can debug and try different cache objects
# while doing development.
command: | command: |
cd /opt/circleci/.pyenv/ cd /opt/circleci/.pyenv/
git remote update git remote update
git checkout v2.2.0 git checkout v2.2.0
pyenv install -f <<parameters.version>> pyenv install -sf <<parameters.version>>
pyenv global <<parameters.version>> pyenv global <<parameters.version>>
- save_cache:
paths:
- /opt/circleci/.pyenv
key: cache-key-pyenv-3-9-7-v1
# ------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------
# Jobs to run # Jobs to run
# ------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment