Skip to content

Commit

Permalink
ci: Use setup-uv action (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q authored Oct 4, 2024
1 parent cd74ba7 commit fc3efe5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 67 deletions.
8 changes: 0 additions & 8 deletions .github/script/install-uv.sh

This file was deleted.

58 changes: 17 additions & 41 deletions .github/workflows/ci-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ env:
SCCACHE_GHA_ENABLED: "true"
HUGR_BIN_DIR: ${{ github.workspace }}/target/debug
HUGR_BIN: ${{ github.workspace }}/target/debug/hugr
UV_CACHE_DIR: /tmp/.uv-cache

jobs:
# Check if changes were made to the relevant files.
Expand Down Expand Up @@ -53,18 +52,13 @@ jobs:
uses: mozilla-actions/sccache-action@v0.0.6

- name: Set up uv
run: .github/script/install-uv.sh
- name: "Set up Python"
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}
version: "0.4.18"
enable-cache: true
- name: Install Python
run: uv python install ${{ matrix.python-version }}

- name: Setup dependencies. Fail if the lockfile is outdated.
run: uv sync --locked

Expand All @@ -77,9 +71,6 @@ jobs:
- name: Lint with ruff
run: uv run ruff check

- name: Minimize uv cache
run: uv cache prune --ci

build_binary:
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
Expand Down Expand Up @@ -115,20 +106,14 @@ jobs:
- { py: '3.12', coverage: true }
steps:
- uses: actions/checkout@v4

- name: Set up uv
run: .github/script/install-uv.sh
- name: "Set up Python"
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version.py }}
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}
version: "0.4.18"
enable-cache: true
- name: Install Python
run: uv python install ${{ matrix.python-version.py }}

- name: Download the hugr binary
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -163,9 +148,6 @@ jobs:
flags: python
token: ${{ secrets.CODECOV_TOKEN }}

- name: Minimize uv cache
run: uv cache prune --ci

# Ensure that the serialization schema is up to date
serialization-schema:
needs: [changes]
Expand All @@ -178,18 +160,12 @@ jobs:
uses: mozilla-actions/sccache-action@v0.0.6

- name: Set up uv
run: .github/script/install-uv.sh
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Restore uv cache
uses: actions/cache@v4
uses: astral-sh/setup-uv@v3
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}
version: "0.4.18"
enable-cache: true
- name: Install Python
run: uv python install 3.12

- name: Setup dependencies
run: uv sync
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ concurrency:
group: "pages"
cancel-in-progress: true

env:
UV_CACHE_DIR: /tmp/.uv-cache

jobs:
build:
name: Build docs.
Expand All @@ -38,18 +35,12 @@ jobs:
fetch-tags: true

- name: Set up uv
run: ../.github/script/install-uv.sh
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Restore uv cache
uses: actions/cache@v4
uses: astral-sh/setup-uv@v3
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}
version: "0.4.18"
enable-cache: true
- name: Install Python
run: uv python install 3.12

- name: Build docs
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/python-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ jobs:
uses: mozilla-actions/sccache-action@v0.0.6

- name: Set up uv
run: .github/script/install-uv.sh
- name: "Set up Python"
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v3
with:
python-version: '3.12'
version: "0.4.18"
enable-cache: true
- name: Install Python
run: uv python install 3.12

- name: Build sdist and wheels
run: |
Expand Down

0 comments on commit fc3efe5

Please sign in to comment.