From 3d9b1529587d5eb0974242dd57243091eec87989 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sat, 31 May 2025 19:06:40 +0100 Subject: [PATCH 1/2] Use setup-uv github action in CI --- .github/workflows/ci.yml | 49 +++++++++++++++------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d16619a..c49473c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - uv-resolution: ['highest', 'lowest'] + uv-resolution: ['highest', 'lowest-direct'] # The minimum version should be represented in pyproject.toml. python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] os: [ubuntu-latest, windows-latest] @@ -26,51 +26,38 @@ jobs: steps: - uses: actions/checkout@v4 + - name: "Set up Python" uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: "Install uv" - run: "pip install --upgrade uv" - - - name: "Create virtual environment" - id: venv - run: | - if [ "${{ matrix.os }}" = "windows-latest" ]; then - uv venv C:/Users/runner/.venv - echo "activate=C:/Users/runner/.venv/Scripts/Activate.ps1" >> "$GITHUB_OUTPUT" - else - uv venv /home/runner/.venv - echo "activate=source /home/runner/.venv/bin/activate" >> "$GITHUB_OUTPUT" - fi - shell: bash + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + cache-dependency-glob: '**/pyproject.toml' - name: "Install dependencies" run: | - ${{ steps.venv.outputs.activate }} - # We want the latest dev requirements, but the lowest install requirements. - uv pip install --upgrade --editable .[dev] uv pip install --resolution=${{ matrix.uv-resolution }} --upgrade --editable . - name: "Lint" run: | - ${{ steps.venv.outputs.activate }} - mypy . - ruff check . - ruff format --check . - pip-extra-reqs pip_check_reqs - pip-missing-reqs pip_check_reqs - pylint pip_check_reqs tests - pyroma --min=10 . - pyproject-fmt --check . - pyright . - actionlint + uv run mypy . + uv run ruff check . + uv run ruff format --check . + uv run pip-extra-reqs pip_check_reqs + uv run pip-missing-reqs pip_check_reqs + uv run pylint pip_check_reqs tests + uv run pyroma --min=10 . + uv run pyproject-fmt --check . + uv run pyright . + uv run actionlint - name: "Run tests" run: | - ${{ steps.venv.outputs.activate }} - pytest -s -vvv --cov-fail-under 100 --cov=pip_check_reqs/ --cov=tests tests/ --cov-report=xml + uv run pytest -s -vvv --cov-fail-under 100 --cov=pip_check_reqs/ --cov=tests tests/ --cov-report=xml completion-ci: needs: build From 32a6c8b463906a1076f132295ea87268cbc07219 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sat, 31 May 2025 19:11:51 +0100 Subject: [PATCH 2/2] Use uv sync --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c49473c..52a9532 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,11 +27,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: "Set up Python" - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install uv uses: astral-sh/setup-uv@v5 with: @@ -40,7 +35,7 @@ jobs: - name: "Install dependencies" run: | - uv pip install --resolution=${{ matrix.uv-resolution }} --upgrade --editable . + uv sync --python=${{ matrix.python-version }} --all-extras --resolution=${{ matrix.uv-resolution }} - name: "Lint" run: |