ci: Update ci.yml to add Python version to uv cache #58
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: Continuous Integration | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags-ignore: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- main | ||
env: | ||
UV_CACHE_DIR: /tmp/.uv-cache-${{ matrix.python-version }} | ||
Check failure on line 14 in .github/workflows/ci.yml GitHub Actions / Continuous IntegrationInvalid workflow file
|
||
jobs: | ||
ci: | ||
name: Run Tests, Linting, and Build Documentation | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.11, 3.12, 3.13] | ||
fail-fast: true | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
- name: Set up UV Environment | ||
uses: astral-sh/[email protected] | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: uv.lock | ||
- name: Restore UV Cache | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ env.UV_CACHE_DIR }} | ||
key: "uv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('uv.lock') }}" | ||
restore-keys: | | ||
uv-${{ matrix.python-version }}-${{ runner.os }} | ||
- name: Install Dependencies and Sync Project | ||
run: uv sync | ||
- name: Run Formatting, Linting, Type Checks, and Tests | ||
run: | | ||
uv run ruff format ./ | ||
uv run ruff check --fix ./ | ||
uv run mypy ./ | ||
uv run pytest ./ | ||
- name: Scan with SonarCloud | ||
if: matrix.python-version == '3.11' | ||
uses: SonarSource/[email protected] | ||
env: | ||
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' | ||
- name: Upload Test Coverage to Codecov | ||
if: success() && matrix.python-version == '3.11' | ||
uses: codecov/[email protected] | ||
with: | ||
token: '${{ secrets.CODECOV_TOKEN }}' | ||
file: ./coverage-3.11.xml | ||
fail_ci_if_error: true | ||
- name: Build Documentation | ||
run: uv run --group=docs make clean html --directory docs/ | ||
- name: Upload Documentation to GitHub Pages | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: docs/_build/html | ||
- name: Minimize UV Cache | ||
run: uv cache prune --ci |