From f6f72aea63b4e118af0fec9da24a13ca03442104 Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Fri, 27 Dec 2024 13:41:31 +0100 Subject: [PATCH] Bump `setup-uv` to v5, change Python install flow (#194) * Bump `setup-uv` to v5, change Python install flow Newest `setup-uv` has the means to install a Python version by argument, and automatically creates a venv to install / sync in. Also, caching is now enabled by default, which should save some time and bandwidth. --- .github/workflows/lint-and-test.yaml | 28 ++++++++++++---------------- .github/workflows/release.yaml | 6 +++--- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/lint-and-test.yaml b/.github/workflows/lint-and-test.yaml index 52349be..0b07668 100644 --- a/.github/workflows/lint-and-test.yaml +++ b/.github/workflows/lint-and-test.yaml @@ -15,13 +15,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install uv - uses: astral-sh/setup-uv@v4 - - name: Install Python 3.10 interpreter - run: uv python install 3.10 - - name: Install the project - run: uv sync --group dev + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.10" - name: Run pre-commit checks - run: uvx pre-commit run --all-files --verbose --show-diff-on-failure + run: uv run pre-commit run --all-files --verbose --show-diff-on-failure test: name: Test nnbench on ${{ matrix.os }} on Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} @@ -33,13 +31,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install uv - uses: astral-sh/setup-uv@v4 - - name: Install Python ${{ matrix.python-version }} - run: uv python install ${{ matrix.python-version }} - - name: Install the project in developer mode - run: uv sync --group dev - - name: Execute python tests - run: uv run pytest -s + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Test with Python ${{ matrix.python-version }} + run: uv run --frozen pytest -s docs: name: Publish latest documentation for nnbench runs-on: ubuntu-latest @@ -48,9 +44,9 @@ jobs: with: fetch-depth: 0 - name: Install uv - uses: astral-sh/setup-uv@v4 - - name: Install Python 3.11 interpreter - run: uv python install 3.11 + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" - name: Install the project run: uv sync --group docs - name: Build documentation using mike diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index da87db0..4ca5e0b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,9 +16,9 @@ jobs: with: fetch-depth: 0 - name: Install uv - uses: astral-sh/setup-uv@v4 - - name: Install Python 3.11 interpreter - run: uv python install 3.11 + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" - name: Install the project run: uv sync --all-groups - name: Build and check