From 339e2c64c2ce542eff513324d7ab2100f816548f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Thu, 28 Mar 2024 18:22:37 +0100 Subject: [PATCH] feat: Run tests with direct dependencies resolved to their lowest version Issue-22: https://github.com/pawamoy/copier-uv/issues/22 --- project/.github/workflows/ci.yml.jinja | 16 +++++++++++++++- project/scripts/make | 10 +++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/project/.github/workflows/ci.yml.jinja b/project/.github/workflows/ci.yml.jinja index 896c55c..77bdb08 100644 --- a/project/.github/workflows/ci.yml.jinja +++ b/project/.github/workflows/ci.yml.jinja @@ -74,7 +74,10 @@ jobs: {"python-version": "3.13"} ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT else - echo 'jobs=[]' >> $GITHUB_OUTPUT + echo 'jobs=[ + {"os": "macos-latest", "resolution": "lowest-direct"}, + {"os": "windows-latest", "resolution": "lowest-direct"} + ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT fi {% endif -%} @@ -96,8 +99,17 @@ jobs: - "3.11" - "3.12" - "3.13" + resolution: + - highest + - lowest-direct {%- if insiders %} exclude: {% raw %}${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}{% endraw %} + {%- else %} + exclude: + - os: macos-latest + resolution: lowest-direct + - os: windows-latest + resolution: lowest-direct {%- endif %} runs-on: {% raw %}${{ matrix.os }}{% endraw %} continue-on-error: {% raw %}${{ matrix.python-version == '3.13' }}{% endraw %} @@ -116,6 +128,8 @@ jobs: run: pip install uv - name: Install dependencies + env: + UV_RESOLUTION: {% raw %}${{ matrix.resolution }}{% endraw %} run: make setup - name: Run the test suite diff --git a/project/scripts/make b/project/scripts/make index 4597643..314e57e 100755 --- a/project/scripts/make +++ b/project/scripts/make @@ -10,11 +10,15 @@ prefix="" # Install runtime and development dependencies, # as well as current project in editable mode. uv_install() { - uv pip compile pyproject.toml devdeps.txt | uv pip install -r - + local uv_opts + if [ -n "${UV_RESOLUTION}" ]; then + uv_opts="--resolution=${UV_RESOLUTION}" + fi + uv pip compile ${uv_opts} pyproject.toml devdeps.txt | uv pip install -r - if [ -z "${CI}" ]; then - uv pip install -e . + uv pip install --no-deps -e . else - uv pip install . + uv pip install --no-deps . fi }