Switch to uv for speed, but also to have an easier time (no duplicati… #1749
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# Run at 1:00 every day | |
- cron: '0 1 * * *' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
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] | |
runs-on: ${{ matrix.os }} | |
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 dependencies" | |
run: | | |
${{ 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 . | |
pip-extra-reqs pip_check_reqs | |
pip-missing-reqs pip_check_reqs | |
pylint pip_check_reqs tests | |
pyroma --min=10 . | |
pyproject-fmt --check --keep-full-version . | |
pyright . | |
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 | |
- name: "Upload coverage to Codecov" | |
# The original maintainer of this project is the one with access to the | |
# Codecov token and GitHub settings which will allow us to bump to the | |
# v4 action. | |
uses: "codecov/codecov-action@v3" | |
with: | |
fail_ci_if_error: true |