Skip to content

Commit

Permalink
Replace pip with uv for test workflow (#877)
Browse files Browse the repository at this point in the history
* replace pip with uv for test workflow

* fix

* fix

* enable uv cache

* rerun uv

* debug: print uv cache hit status

* fix uv cache key

* fix syntax uv

* rerun uv

* rerun uv

* fix restore uv cache

* clean cache, attemp fix optional dependencies

* rerun uv

* fix

* fix; temporarily disable some tests

* fix

* fix

* rerun uv

* add test dependencies explicitly

* add lockfile; always call uv sync

* fix moved test from dep group to extra

* add collect-only for faster ci turnaround

* rerun uv

* fix

* rerun uv

* trying out uv cache without cache-suffix

* rerun uv

* disable cache prune

* rerun uv

* removing caching mechanism

* remove --collect-only from pytest; uv in readthedocs

* went back to using pip in readthedocs
  • Loading branch information
LucaMarconato authored Feb 12, 2025
1 parent 4df1912 commit f7082d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
27 changes: 5 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,20 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
- uses: astral-sh/setup-uv@v5
id: setup-uv
with:
version: "latest"
python-version: ${{ matrix.python }}
cache: pip

- name: Get pip cache dir
id: pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Restore pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-${{ runner.os }}-${{ env.pythonLocation }}-
- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
pip install pytest-cov
- name: Install dependencies
run: |
pip install ${{ matrix.pip-flags }} -e ".[dev,test,torch]"
run: "uv sync --extra test"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
pytest --cov --color=yes --cov-report=xml
uv run pytest --cov --color=yes --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ dependencies = [
dev = [
"bump2version",
]
test = [
"pytest",
"pytest-cov",
"pytest-mock",
"torch",
]
docs = [
"sphinx>=4.5",
"sphinx-autobuild",
Expand All @@ -66,12 +72,6 @@ docs = [
"sphinx-copybutton",
"sphinx-pytest",
]
test = [
"pytest",
"pytest-cov",
"pytest-mock",
"torch",
]
benchmark = [
"asv",
]
Expand Down

0 comments on commit f7082d9

Please sign in to comment.