From 85c1106c058f0615e2b559a717fd5a44c871ec80 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 2 Nov 2024 23:28:24 +0200 Subject: [PATCH] Infra: Lint and test via uv (#4102) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- .github/workflows/lint.yml | 8 +++++--- .github/workflows/test.yml | 25 ++++++++++--------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4c820b7c9ab..85d48c4b93c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,16 +20,18 @@ jobs: steps: - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python 3 uses: actions/setup-python@v5 with: python-version: "3.x" - cache: pip - name: Run pre-commit hooks - uses: pre-commit/action@v3.0.1 + uses: tox-dev/action-pre-commit-uv@v1 - name: Check spelling - uses: pre-commit/action@v3.0.1 + uses: tox-dev/action-pre-commit-uv@v1 with: extra_args: --all-files --hook-stage manual codespell || true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fef7979a11..21acdbee831 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,32 +39,27 @@ jobs: - "windows-latest" - "macos-latest" - "ubuntu-latest" - # Python 3.9 is on macos-13 but not macos-latest (macos-14-arm64) - # https://github.com/actions/setup-python/issues/696#issuecomment-1637587760 - exclude: - - { python-version: "3.9", os: "macos-latest" } - include: - - { python-version: "3.9", os: "macos-13" } - steps: - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: pip allow-prereleases: true - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U wheel - python -m pip install -U tox + - name: Install uv + uses: hynek/setup-cached-uv@v2 + with: + cache-dependency-path: | + requirements.txt - - name: Run tests + - name: Run tests with tox run: | - tox -e py -- -v --cov-report term + uvx --with tox-uv tox -e py -- -v --cov-report term - name: Upload coverage uses: codecov/codecov-action@v4