Skip to content

Commit

Permalink
CI: Use uv and test lowest-direct dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Sep 24, 2024
1 parent 01bad31 commit 562ca11
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 36 deletions.
85 changes: 52 additions & 33 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ jobs:

strategy:
matrix:
python-version: ["3.10", "3.12"]
include:
- python-version: "3.10"
resolution: "lowest-direct"
- python-version: 3.12
resolution: "highest"

steps:
- name: Checkout Code
Expand All @@ -30,18 +34,22 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Make uv use system python
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
pip install -e ".[test]"
# Install as an editable so that the coverage path is predicable
run: uv pip install --resolution=${{ matrix.resolution }} -e ".[test]"

- name: Environment Information
shell: bash
run: |
pip list
run: uv pip list

- name: Run Tests
shell: bash
run: |
coverage erase
make test
Expand All @@ -61,7 +69,8 @@ jobs:

strategy:
matrix:
python-version: ["3.11"]
python-version: [3.12]

steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -71,22 +80,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Make uv use system python
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Linting & Formatting Packages
shell: bash
run: |
pip install ruff
pip install black
run: uv pip install ruff

- name: Environment Information
shell: bash
run: pip list
run: uv pip list

- name: Check lint with Ruff
shell: bash
- name: Check lint with ruff
run: make lint

- name: Check format with Black
shell: bash
- name: Check format with ruff format
run: make format

typecheck:
Expand All @@ -98,7 +109,7 @@ jobs:

strategy:
matrix:
python-version: [3.11]
python-version: [3.12]

steps:
- name: Checkout Code
Expand All @@ -109,17 +120,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Make uv use system python
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
pip install ".[extra, typing]"
run: uv pip install ".[extra, typing]"

- name: Environment Information
shell: bash
run: pip list
run: uv pip list

- name: Run Tests
shell: bash
run: make typecheck

documentation:
Expand All @@ -131,7 +146,7 @@ jobs:

strategy:
matrix:
python-version: ["3.12"]
python-version: [3.12]

steps:
- name: Checkout Code
Expand All @@ -142,17 +157,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Make uv use system python
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV

- name: Install Packages
shell: bash
run: |
pip install -e ".[doc]"
run: uv pip install -e ".[doc]"

- name: Environment Information
shell: bash
run: pip list
run: uv pip list

- name: Build Documentation
shell: bash
run: |
pushd doc
SPHINXOPTS=-W
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ dist: build
ls -l dist

develop: clean-pyc
pip install -e ".[all]"
uv pip install -e ".[all]"

install: clean
ls -l dist
pip install .
uv pip install .
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ lint = [
]

test = [
"pytest-cov"
"pytest-cov>=4.0.0"
]

dev = [
Expand Down

0 comments on commit 562ca11

Please sign in to comment.