|
1 | 1 | ################################################################################
|
2 |
| -# Store a cache for dependencies on every merge to devel. |
| 2 | +# Ensure poetry and tox installed dependencies are in the cache. |
3 | 3 | #
|
4 |
| -# All PR's have access to devel's caches. This makes sure it gets generated and |
5 |
| -# is available for the next PR. Otherwise every PR will always generate a cache |
6 |
| -# for the first commit of the PR (subsequent commits will reuse that). |
| 4 | +# All PR's can reuse devel's caches, but a PR's cache cannot be reused from |
| 5 | +# one PR to the next. This jobs' sole purpose is to make sure every PR updates |
| 6 | +# devel's cache (if changes are needed) on merging. |
7 | 7 | #
|
8 | 8 | # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
|
9 | 9 | ################################################################################
|
@@ -34,21 +34,25 @@ jobs:
|
34 | 34 |
|
35 | 35 | steps:
|
36 | 36 | - uses: actions/checkout@v3
|
37 |
| - - name: Poetry Cache Dir |
| 37 | + - name: Poetry Venv Dir |
38 | 38 | run: |
|
39 |
| - echo "POETRY_CACHE_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV |
| 39 | + echo "VENV_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV |
40 | 40 |
|
41 |
| - - name: Poetry Cache from Cache |
| 41 | + - name: Restore the Cache |
42 | 42 | id: cache-deps
|
43 | 43 | uses: actions/cache@v3
|
44 | 44 | with:
|
45 |
| - path: ${{ env.POETRY_CACHE_DIR }} |
| 45 | + path: ${{ env.VENV_DIR }} |
46 | 46 | # bump the suffix if you need to force-refresh the cache
|
47 |
| - key: poetry-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-1 |
| 47 | + key: py-trees-ci-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock', '**/tox.ini') }}-1 |
48 | 48 |
|
49 | 49 | # Install all deps, sans the project (--no-root)
|
50 |
| - - name: Install Dependencies |
| 50 | + - name: Poetry - Install Dependencies |
51 | 51 | run: poetry install --no-interaction --no-root
|
52 | 52 | if: steps.cache-deps.outputs.cache-hit != 'true'
|
53 | 53 |
|
| 54 | + - name: Tox - Install Dependencies |
| 55 | + run: poetry run tox --workdir ${{ env.VENV_DIR }} --notest -e ${{ matrix.python-py-version }} check my${{ matrix.python-py-version }} |
| 56 | + if: steps.cache-deps.outputs.cache-hit != 'true' |
| 57 | + |
54 | 58 |
|
0 commit comments