Skip to content

Commit

Permalink
Merge pull request #183 from r1chardj0n3s/resolution
Browse files Browse the repository at this point in the history
Switch to uv for speed, but also to have an easier time (no duplicati…
  • Loading branch information
adamtheturtle authored Feb 18, 2024
2 parents af8be33 + c278442 commit 41d828b
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ jobs:

strategy:
matrix:
# These versions match the minimum and maximum versions of pip in
# requirements.txt.
# An empty string here represents the latest version.
pip-version: ['==23.2', '']
uv-resolution: ['highest', 'lowest-direct']
# The minimum version should be represented in setup.py.
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest]
Expand All @@ -34,28 +31,29 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v4
with:
path: ~/.cache/pip
# This is like the example but we use ``*requirements.txt`` rather
# than ``requirements.txt`` because we have multiple requirements
# files.
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- 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 dependencies"
run: |
python -m pip install --upgrade 'pip ${{ matrix.pip-version }}'
# We use '--ignore-installed' to avoid GitHub's cache which can cause
# issues - we have seen packages from this cache be cause trouble with
# pip-extra-reqs.
#
# We avoid "--upgrade" as we do version tests for the "pip" dependency.
python -m pip install --ignore-installed --editable .[dev]
${{ steps.venv.outputs.activate }}
uv pip install --resolution=${{ matrix.uv-resolution }} --upgrade --editable .[dev]
- name: "Lint"
run: |
${{ steps.venv.outputs.activate }}
mypy .
ruff check .
ruff format --check .
Expand All @@ -69,7 +67,8 @@ jobs:
- name: "Run tests"
run: |
pytest -s -vvv --cov-fail-under 100 --cov=pip_check_reqs/ --cov=tests tests/
${{ steps.venv.outputs.activate }}
pytest -s -vvv --cov-fail-under 100 --cov=pip_check_reqs/ --cov=tests tests/ --cov-report=xml
- name: "Upload coverage to Codecov"
# The original maintainer of this project is the one with access to the
Expand Down

0 comments on commit 41d828b

Please sign in to comment.