From 9532acbab1e90fe47bb4cb4f4d3ab4a9b326ef98 Mon Sep 17 00:00:00 2001 From: "A bot of @njzjz" <48687836+njzjz-bot@users.noreply.github.com> Date: Sat, 5 Oct 2024 00:06:46 -0400 Subject: [PATCH] chore(ci): use astral-sh/setup-uv action (#10) Generated by the task: https://github.com/njzjz-bot/njzjz-bot/issues/9. --------- Co-authored-by: Jinzhe Zeng --- .github/workflows/release.yaml | 7 ++++++- .github/workflows/test.yaml | 19 ++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b4a2cc5..ceeeb66 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,7 +13,12 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + cache-dependency-glob: | + **/requirements*.txt + **/pyproject.toml - name: Build dist run: uv tool run --with build[uv] --from build python -m build --installer uv - name: Upload release distributions diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c540531..375aa5c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,8 +8,6 @@ on: env: UV_SYSTEM_PYTHON: 1 - # Configure a constant location for the uv cache - UV_CACHE_DIR: /tmp/.uv-cache jobs: build: runs-on: ubuntu-latest @@ -19,19 +17,16 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + cache-dependency-glob: | + **/requirements*.txt + **/pyproject.toml - name: Set up Python uses: actions/setup-python@v5 with: python-version: 3.12 - - name: Restore uv cache - uses: actions/cache@v4 - with: - path: ${{ env.UV_CACHE_DIR }} - key: uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} - restore-keys: | - uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} - uv-${{ runner.os }} - name: Install dependencies run: uv pip install nox[uv] - name: Test with pytest @@ -40,5 +35,3 @@ jobs: uses: codecov/codecov-action@v4 with: use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} - - name: Minimize uv cache - run: uv cache prune --ci