add cache ci #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests on GPU | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# This will trigger the workflow for pull requests to any branch | |
types: [opened, synchronize, reopened] | |
jobs: | |
gpu-tests: | |
name: python | |
runs-on: self-hosted | |
env: | |
# Configure a constant location for the uv cache | |
UV_CACHE_DIR: /root/uv_cache/ | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Set up Python | |
run: uv python install 3.10.13 | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.uv-cache | |
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
uv-${{ runner.os }} | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run tests | |
run: uv run pytest tests | |
- name: Minimize uv cache | |
run: uv cache prune --ci |