Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
If we can cache .tox in GitHub Actions we could speed up the CI a lot. However, in practice, I find that Tox won't run from a cached .tox directory. It could be worth looking into this.
The workflow is:
name: Python CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python:
- 3.7
- 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Cache tox environments
id: cache-tox
uses: actions/cache@v1
with:
path: .tox
# setup.cfg, pyproject.toml, and .pre-commit-config.yaml have
# versioning info that would impact the tox environment. hashFiles
# only takes a single file path or pattern at the moment.
key: ${{ runner.os }}-${{ matrix.python }}-tox-${{ hashFiles('setup.cfg') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run tox
run: tox -e py,lint,typing # run tox using Python in pathThe error is:
Run tox 1s
15
##[error]Process completed with exit code 2.
1
Run tox -e py,lint,typing
6
ERROR: invocation failed (exit code 1), logfile: /home/runner/work/safir/safir/.tox/.package/log/.package-4.log
7
================================== log start ===================================
8
Traceback (most recent call last):
9
File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/tox/helper/build_requires.py", line 7, in <module>
10
backend = __import__(backend_spec, fromlist=[None])
11
ModuleNotFoundError: No module named 'setuptools'
12
13
=================================== log end ====================================
14
ERROR: FAIL could not package project - v = InvocationError("/home/runner/work/safir/safir/.tox/.package/bin/python /opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/tox/helper/build_requires.py setuptools.build_meta ''", 1)
15
##[error]Process completed with exit code 2.
Reacted by Martim Lobao
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
rra commentedon Mar 16, 2022
We are now caching the tox environments and everything seems to work fine, so presumably this is a bug that was subsequently fixed.
hughesadam87 commentedon Sep 27, 2023
@rra you're caching tox like this or some other way?
rra commentedon Sep 27, 2023
We're using the https://github.com/lsst-sqre/run-tox shared action now, but internally it does the following:
Workflow: Cache the Tox environment
Workflow: Cache the Tox environment
Workflow: Cache the Tox environment
Workflow: Cache the Tox environment