From 184088bad4e07e0e37f0f504b96183aa95224be4 Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Fri, 27 Dec 2024 13:25:38 +0100 Subject: [PATCH 1/2] 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 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 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 From d1a97cd2d633fafe69d6b1e54ebec1c9ad25e0be Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Fri, 27 Dec 2024 13:39:38 +0100 Subject: [PATCH 2/2] Update release workflow to setup-uv@v5 --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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