Skip to content

Commit

Permalink
ci: Use uv for pip replacement in workflow
Browse files Browse the repository at this point in the history
requirements.txt is removed, yet pip can't extract dependency from pyproject.toml directly
  • Loading branch information
abelcheung committed Oct 26, 2024
1 parent 992638c commit e701d46
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ jobs:
fail-fast: false
matrix:
myver:
- 1.10.0
- 1.10.1
- 1.11.0
- 1.11.1
- 1.11.2
Expand All @@ -20,14 +18,24 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: '3.10'
cache: 'pip'

- uses: astral-sh/setup-uv@v3
with:
version: '0.4.27'
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
- name: Install requirements
run: |
pip install --progress-bar=off -r requirements.txt
pip install --progress-bar=off 'mypy == ${{ matrix.myver }}'
uv pip install -r pyproject.toml
uv pip install 'mypy == ${{ matrix.myver }}'
- name: Perform check on source
run: mypy lxml-stubs

Expand Down Expand Up @@ -70,15 +78,28 @@ jobs:
- 1.1.382
- 1.1.383
- 1.1.384
- 1.1.385
- 1.1.386
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: '3.10'
cache: 'pip'

- uses: astral-sh/setup-uv@v3
with:
version: '0.4.27'
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
- name: Install requirements
run: pip install --progress-bar=off -r requirements.txt
run: |
uv pip install -r pyproject.toml
- uses: jakebailey/pyright-action@v2
with:
version: ${{ matrix.prver }}
18 changes: 13 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: '3.10'
cache: 'pip'

- name: Install dependencies
run: pip install --progress-bar=off -r requirements.txt
- uses: astral-sh/setup-uv@v3
with:
version: '0.4.27'
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
- name: Install requirements
run: |
uv pip install -r pyproject.toml
- name: Mypy review
id: mypy
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ excludes = [
'/*.py',
]
source-includes = [
'requirements.txt',
'test-rt/',
'test-stub/',
'tox.ini',
Expand Down

0 comments on commit e701d46

Please sign in to comment.