Add caching for virtualenv

This commit is contained in:
Antoine Bartuccio 2025-01-06 15:10:00 +01:00
parent 0c4d72e17a
commit cbe42d3a60
2 changed files with 15 additions and 0 deletions

View File

@ -21,10 +21,22 @@ runs:
with:
python-version-file: ".python-version"
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
key: venv-${{ runner.os }}-${{ hashFiles('.python-version') }}-${{ hashFiles('pyproject.toml') }}-${{ env.CACHE_SUFFIX }}
path: .venv
- name: Install dependencies
run: uv run ./manage.py install_xapian
shell: bash
- name: Save cached virtualenv
uses: actions/cache/save@v4
with:
key: venv-${{ runner.os }}-${{ hashFiles('.python-version') }}-${{ hashFiles('pyproject.toml') }}-${{ env.CACHE_SUFFIX }}
path: .venv
- name: Compile gettext messages
run: uv run ./manage.py compilemessages
shell: bash

View File

@ -29,6 +29,9 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup_project
env:
# To avoid race conditions on environment cache
CACHE_SUFFIX: ${{ matrix.pytest-mark }}
- name: Run tests
run: uv run coverage run -m pytest -m "${{ matrix.pytest-mark }}"
- name: Generate coverage report