Skip to content

ci: make use of setup-uv action. #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 5 additions & 25 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,12 @@ jobs:
percentage_float: ${{ steps.cov.outputs.percentage_float }}
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@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.
version: "latest"
python-version: 3.13
- 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
enable-cache: true
- name: Install test dependencies
run: uv sync --extra test --no-dev --locked
- name: Debug - uv pip freeze
Expand Down Expand Up @@ -78,9 +60,7 @@ jobs:
uv run tests/coverage/compare.py \
${{ steps.cov.outputs.percentage_float }} \
$HISTORIC
- name: Minimize UV cache
run: uv cache prune --ci
if: always()

coverage-badge:
name: Update coverage badge
# Keep as a separate job to avoid clashes between meta and main repos
Expand Down
35 changes: 7 additions & 28 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,19 @@ jobs:
name: Build documentation
runs-on: ubuntu-latest
env:
# Note that we use 3.12 here rather than 3.13 to avoid spurious Sphinx errors
# about not being able to link to `pathlib._locals.Path`.
UV_PYTHON: 3.12
# Disable implicitly syncing before running - we run an explicit sync first.
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@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.
version: "latest"
# Note that we use 3.12 here rather than 3.13 to avoid spurious Sphinx errors
# about not being able to link to `pathlib._locals.Path`.
python-version: 3.12
- 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
enable-cache: true
cache-suffix: "docs"
- name: Install documentation dependencies
run: uv sync --extra doc --no-dev --locked
- name: Debug - uv pip freeze
Expand All @@ -54,6 +36,3 @@ jobs:
- name: Check external links
run: |
uv run -m sphinx -b linkcheck documentation/source documentation/build
- name: Minimize UV cache
run: uv cache prune --ci
if: always()
32 changes: 6 additions & 26 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,13 @@ jobs:
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@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: 3.13
- 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 }}-none
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
version: "latest"
python-version: 3.12
enable-cache: true
cache-suffix: "performance"
- name: Install package dependencies
run: uv sync --no-dev --locked
- name: Debug - uv pip freeze
Expand Down Expand Up @@ -109,6 +92,3 @@ jobs:
/repos/:owner/coreax-metadata/contents/$OUT_NAME \
-f message="$message" \
-f content="$content"
- name: Minimize UV cache
run: uv cache prune --ci
if: always()
12 changes: 4 additions & 8 deletions .github/workflows/pre_commit_autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ jobs:
fi

# Pre-commit setup and autoupdate steps
- name: Set up Python 3.13
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
python-version: 3.13
cache: pip
- name: Upgrade Pip
run: python -m pip install --upgrade pip
- name: Install pre-commit
run: pip install pre-commit
- name: Store hash of baseline pre-commit config for comparison
id: old_file
run: echo "hash=$( sha256sum $config_path )" >> $GITHUB_OUTPUT
Expand All @@ -65,7 +61,7 @@ jobs:
- name: Run pre-commit autoupdate on main pre-commit config
id: autoupdate
run: |
pre-commit autoupdate > ${{ env.update_message_path }}
uv tool pre-commit autoupdate > ${{ env.update_message_path }}
sed -i "/updating/!d" ${{ env.update_message_path }}
- name: Store hash of new pre-commit config for comparison
id: new_file
Expand Down
30 changes: 5 additions & 25 deletions .github/workflows/pre_commit_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,13 @@ jobs:
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@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.
version: "latest"
python-version: 3.13
- 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 }}-dev
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
enable-cache: true
cache-suffix: "pre-commit"
- name: Install development dependencies
run: uv sync --dev --locked
- name: Debug - uv pip freeze
Expand All @@ -48,6 +31,3 @@ jobs:
run: sed -e "/fail_fast/d" .pre-commit-config.yaml > /tmp/.pre-commit-config-ci.yaml
- name: Run Pre-commit checks
run: SKIP=no-commit-to-branch uv run pre-commit run --all-files --show-diff-on-failure --config /tmp/.pre-commit-config-ci.yaml
- name: Minimize UV cache
run: uv cache prune --ci
if: always()
27 changes: 5 additions & 22 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,13 @@ jobs:
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@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.
version: "latest"
python-version: 3.13
- 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 }}-dev
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
enable-cache: true
cache-suffix: "pre-commit"
- name: Install dev dependencies
run: uv sync --dev --locked
- name: Debug - uv pip freeze
Expand Down
31 changes: 4 additions & 27 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,16 @@ jobs:
- macos-latest
runs-on: ${{ matrix.os }}
env:
# Set the Python version that `uv` will use for its virtual environment.
UV_PYTHON: ${{ matrix.python-version }}
# Disable implicitly syncing before running - we run an explicit sync first.
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Set up base Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@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.
version: "latest"
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
enable-cache: true
- name: Install test dependencies
run: uv sync --extra test --no-dev --locked
- name: Debug - uv pip freeze
Expand All @@ -64,6 +44,3 @@ jobs:
# Integration tests are slow, so only run if all other tests pass.
- name: Test integration tests
run: uv run pytest tests/integration -n auto --dist worksteal
- name: Minimize UV cache
run: uv cache prune --ci
if: always()
10 changes: 3 additions & 7 deletions .github/workflows/uv_lock_autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ jobs:
fi

# uv setup and lockfile upgrading steps
- name: Set up Python 3.13
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
python-version: 3.13
cache: pip
- name: Upgrade Pip
run: python -m pip install --upgrade pip
- name: Install uv
run: pip install uv
- name: Store hash of baseline files for comparison
id: old_hash
run: |
Expand Down