From 2027a3b6b68daf1281f3446a12be37876d50cf75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Borgna?= <121866228+aborgna-q@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:45:27 +0100 Subject: [PATCH] ci: Use `setup-uv` action (#638) --- .github/script/install-uv.sh | 8 ----- .github/workflows/ci.yml | 39 ++++++++---------------- .github/workflows/python-pure-wheels.yml | 15 +++++---- 3 files changed, 21 insertions(+), 41 deletions(-) delete mode 100755 .github/script/install-uv.sh diff --git a/.github/script/install-uv.sh b/.github/script/install-uv.sh deleted file mode 100755 index 95c2476f..00000000 --- a/.github/script/install-uv.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Installs a fixed UV version -# -# This reads the `UV_CACHE_DIR` environment variable if it is set, -# and stores the downloaded dependencies in that directory. - -curl -LsSf https://astral.sh/uv/0.3.4/install.sh | sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a08c8d89..06e6f8e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,8 @@ env: CI: true # insta snapshots behave differently on ci SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" - UV_CACHE_DIR: /tmp/.uv-cache + # Pinned version for the uv package manager + UV_VERSION: "0.4.18" jobs: # Check if changes were made to the relevant files. @@ -84,18 +85,12 @@ jobs: - uses: actions/checkout@v4 - 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' - - 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: ${{ env.UV_VERSION }} + enable-cache: true + - name: Install Python 3.12 + run: uv python install 3.12 - name: Setup dependencies run: uv sync --locked - name: Type check with mypy @@ -104,8 +99,6 @@ jobs: run: uv run ruff format --check - name: Lint with ruff run: uv run ruff check - - name: Minimize uv cache - run: uv cache prune --ci benches: name: Build benchmarks 🏋️ @@ -234,18 +227,12 @@ jobs: - name: Install stable toolchain uses: dtolnay/rust-toolchain@stable - name: Set up uv - run: .github/script/install-uv.sh - - name: "Set up Python" - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - 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: ${{ env.UV_VERSION }} + enable-cache: true + - name: Install Python 3.10 + run: uv python install 3.10 - name: Setup dependencies run: uv sync --locked - name: Run python tests with coverage instrumentation @@ -255,8 +242,6 @@ jobs: with: name: py-coverage path: coverage.xml - - name: Minimize uv cache - run: uv cache prune --ci coverage-py: name: Upload Python coverage 🐍 diff --git a/.github/workflows/python-pure-wheels.yml b/.github/workflows/python-pure-wheels.yml index 3f89ed19..42262a3a 100644 --- a/.github/workflows/python-pure-wheels.yml +++ b/.github/workflows/python-pure-wheels.yml @@ -18,6 +18,10 @@ on: types: - published +env: + # Pinned version for the uv package manager + UV_VERSION: "0.4.18" + jobs: build-publish: name: Package and publish wheels @@ -45,13 +49,12 @@ jobs: - name: Set up uv - if: ${{ steps.check-tag.outputs.run == 'true' }} - run: .github/script/install-uv.sh - - name: Set up Python - if: ${{ steps.check-tag.outputs.run == 'true' }} - uses: actions/setup-python@v5 + uses: astral-sh/setup-uv@v3 with: - python-version: '3.12' + version: ${{ env.UV_VERSION }} + enable-cache: true + - name: Install Python 3.12 + run: uv python install 3.12 - name: Build sdist and wheels if: ${{ steps.check-tag.outputs.run == 'true' }}