Skip to content

Merge pull request #822 from gchq/feature/add-analytic-test-rpcholesky #1640

Merge pull request #822 from gchq/feature/add-analytic-test-rpcholesky

Merge pull request #822 from gchq/feature/add-analytic-test-rpcholesky #1640

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
tests:
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
- windows-latest
- macos-latest
# macos-latest does not support python 3.9
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760
exclude:
- { python-version: "3.9", os: "macos-latest" }
include:
- { python-version: "3.9", os: "macos-13" }
runs-on: ${{ matrix.os }}
env:
# Set the Python version that `uv` will use for its virtual environment.
UV_PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
with:
# Note that this is just the version of Python that we use to run `uv` with.
# `uv` manages its own version of Python.
# For speed, we use the same version for both, but in principle these could differ.
python-version: ${{ matrix.python-version }}
- name: Set up uv cache directory location (Linux/Mac)
run: echo "UV_CACHE_DIR=${{ runner.temp }}/.uv-cache" >> $GITHUB_ENV
if: runner.os != 'Windows'
- name: Set up uv cache directory location (Windows)
run: echo "UV_CACHE_DIR=${{ runner.temp }}/.uv-cache" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}-${{ matrix.python-version }}-test
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}-${{ matrix.python-version }}
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install latest versions of pip and uv
run: python -m pip install --upgrade pip uv
- name: Install test dependencies
run: uv sync --extra test --no-dev --locked
- name: Debug - uv pip freeze
run: uv pip freeze
- name: Test with pytest
run: uv run pytest --ignore=tests/integration
# Integration tests are slow, so only run if all other tests pass.
- name: Test integration tests
run: uv run pytest tests/integration
- name: Minimize UV cache
run: uv cache prune --ci
if: always()