Skip to content

Commit

Permalink
test.yml: load _and_ save cached venv
Browse files Browse the repository at this point in the history
  • Loading branch information
eneelo committed Dec 6, 2024
1 parent c81a27a commit 919c9de
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# 06.12.2024: modified slightly with inspiration from:
# https://github.com/marketplace/actions/install-poetry-action#testing-using-a-matrix
# https://adamj.eu/tech/2023/11/02/github-actions-faster-python-virtual-environments/

name: Test Python package

Expand Down Expand Up @@ -79,11 +80,11 @@ jobs:
- name: Install dynamic versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
#----------------------------------------------
# load cached venv if cache exists
# load (restore) cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -94,6 +95,14 @@ jobs:
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# save cached venv
#----------------------------------------------
- name: Save cached venv
uses: actions/cache/save@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install root project, if required
#----------------------------------------------
- name: Install project
Expand Down

0 comments on commit 919c9de

Please sign in to comment.