Periodic "bad interpreter" when caching virtual environments
Describe the bug
When testing large projects it is convenient to cache dependencies from pypi with a cache key based on the projects setup.py. I've been been using that pattern (yaml shown below) on several projects for > 6 months. It works great, but periodically (every 1-6 weeks) fails with the error:
Once the error occurs once, it will appear consistently until I alter the cache key and force the virtual environment to rebuild.
I think what's happening is that every time the build/setup for the setup-python action changes, it invalidates the link between the virtual environment and the python binary.
Questions:
- Is there a recommended method for caching dependencies with
setup-pythonthat will not suffer from this issue - Could you recommend file/something that can be hashed and added to the cache key to invalidate the cache when new python builds are pushed?
steps: - name: set up python 3.8 uses: actions/setup-python@v1 with: python-version: 3.8 - name: checkout uses: actions/checkout@v2 - name: cache dependencies id: xyz-cache uses: actions/cache@v2 with: path: venv key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}-0 - name: install xyz if: steps.sl-cache.outputs.cache-hit != 'true' run: | python -m venv venv source venv/bin/activate python -m pip install --U pip setuptools wheel pip install -e ".[dev]"
Thanks!
Which version of the action are you using?
-
v1 -
v2 - Some other tag (such as
v2.0.1ormaster)
Environment
- self-hosted
- Linux
- Windows
- Mac
Python Versions
At least all versions of 3.7 and 3.8 but probably all of them
