From 956f10c5691b4f4d1a7e2d648fa2ca2eb4b27ab5 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 2 Apr 2024 17:10:13 -0400 Subject: [PATCH] ci: use uv (#805) * ci: use uv Signed-off-by: Henry Schreiner * chore: drop uv from 3.7 jobs Signed-off-by: Henry Schreiner --------- Signed-off-by: Henry Schreiner --- .github/workflows/ci.yml | 26 +++++++++++++++++--------- noxfile.py | 5 ++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6033c2b..21a824be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-20.04, windows-latest, macos-latest] python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] @@ -26,6 +27,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Setup uv + uses: yezz123/setup-uv@v4 + if: matrix.python-version != '3.7' - name: Set up Miniconda uses: conda-incubator/setup-miniconda@v3 with: @@ -33,9 +37,12 @@ jobs: python-version: ${{ matrix.python-version }} miniforge-variant: Mambaforge use-mamba: true - - name: Install Nox-under-test - run: | - python -m pip install --disable-pip-version-check . + - name: Install Nox-under-test (uv) + if: matrix.python-version != '3.7' + run: uv pip install --system . + - name: Install Nox-under-test (pip) + if: matrix.python-version == '3.7' + run: python -m pip install --disable-pip-version-check . - name: Run tests on ${{ matrix.os }} (tox <4) run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}', tox_version='<4')" -- --full-trace - name: Run tox-to-nox tests on ${{ matrix.os }} (tox latest) @@ -56,9 +63,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" + - name: Setup uv + uses: yezz123/setup-uv@v4 - name: Install Nox-under-test - run: | - python -m pip install --disable-pip-version-check . + run: uv pip install --system . - name: Download individual coverage reports uses: actions/download-artifact@v4 with: @@ -78,8 +86,7 @@ jobs: with: python-version: 3.9 - name: Install Nox-under-test - run: | - python -m pip install --disable-pip-version-check . + run: python -m pip install --disable-pip-version-check . - name: Lint run: nox --non-interactive --error-on-missing-interpreter --session "lint" docs: @@ -90,9 +97,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.9 + - name: Setup uv + uses: yezz123/setup-uv@v4 - name: Install Nox-under-test - run: | - python -m pip install --disable-pip-version-check . + run: uv pip install --system . - name: Docs run: nox --non-interactive --error-on-missing-interpreter --session "docs" deploy: diff --git a/noxfile.py b/noxfile.py index 6b4de3ad..a151e5b1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -27,6 +27,9 @@ ON_WINDOWS_CI = "CI" in os.environ and platform.system() == "Windows" +nox.needs_version = ">=2024.3.2" +nox.options.default_venv_backend = "uv|virtualenv" + # Skip 'conda_tests' if user doesn't have conda installed nox.options.sessions = ["tests", "cover", "lint", "docs"] if shutil.which("conda"): @@ -76,7 +79,7 @@ def tests(session: nox.Session, tox_version: str) -> None: con.execute("DELETE FROM file WHERE SUBSTR(path, 2, 1) == ':'") -@nox.session(python=["3.7", "3.8", "3.9", "3.10"], venv_backend="conda") +@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"], venv_backend="conda") def conda_tests(session: nox.Session) -> None: """Run test suite with pytest.""" session.create_tmp() # Fixes permission errors on Windows