Skip to content

Commit

Permalink
Add caching for virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
klmp200 committed Jan 6, 2025
1 parent 44d76d4 commit a22848b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/actions/setup_project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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") }}
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") }}
path: .venv

- name: Compile gettext messages
run: uv run ./manage.py compilemessages
shell: bash
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@ jobs:
with:
extra_args: --all-files

setup:
name: Setup project for testing
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup_project
- name: Run tests

tests:
name: Run tests and generate coverage report
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false # don't interrupt the other test processes
matrix:
pytest-mark: [slow, not slow]
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup_project
- name: Run tests
run: uv run coverage run -m pytest -m "${{ matrix.pytest-mark }}"
- name: Generate coverage report
Expand Down

0 comments on commit a22848b

Please sign in to comment.