Skip to content

Use setup-uv github action in CI #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 18 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -26,51 +26,33 @@ 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 .
uv sync --python=${{ matrix.python-version }} --all-extras --resolution=${{ matrix.uv-resolution }}

- 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
Expand Down
Loading