2828 if : always()
2929
3030 test :
31+ needs : lint
3132 runs-on : ubuntu-latest
3233 strategy :
3334 fail-fast : false
@@ -36,19 +37,47 @@ jobs:
3637
3738 steps :
3839 - uses : actions/checkout@v4
39- # https://github.com/actions/setup-python
40- - name : Set up Python ${{ matrix.python-version }}
41- uses : actions/setup-python@v5
40+
41+ - name : Install uv and set the python version
42+ id : setup-uv
43+ uses : astral-sh/setup-uv@v6
4244 with :
45+ # https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
4346 python-version : ${{ matrix.python-version }}
44- cache : ' pip' # caching pip dependencies
45- # Manually set 'dev-requirements.txt' as the file to use for dependencies, since `requirements.txt` contains runtime dependencies.
46- cache-dependency-path : ' dev-requirements.txt'
47- - name : Install dependencies
48- run : |
49- python -m pip install --upgrade pip
50- pip install -r dev-requirements.txt
51- - name : Test with pytest
47+ version : " 0.7.19" # It is considered best practice to pin to a specific uv version
48+ # https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
49+ enable-cache : true
50+ cache-dependency-glob : |
51+ **/*requirements*.txt
52+ **/pyproject.toml
53+ **/uv.lock
54+
55+ - name : Do something if the cache was restored
56+ if : steps.setup-uv.outputs.cache-hit == 'true'
57+ run : echo "Cache was restored"
58+
59+ - name : Install the project
60+ run : uv sync --locked --all-extras --dev
61+
62+ - name : Run tests
63+ # For example, using `pytest`
5264 run : |
53- python -m pytest tests/unit
54- python -m pytest -m ci
65+ uv run pytest tests/unit
66+ uv run pytest ci
67+
68+ # # https://github.com/actions/setup-python
69+ # - name: Set up Python ${{ matrix.python-version }}
70+ # uses: actions/setup-python@v5
71+ # with:
72+ # python-version: ${{ matrix.python-version }}
73+ # cache: 'pip' # caching pip dependencies
74+ # # Manually set 'dev-requirements.txt' as the file to use for dependencies, since `requirements.txt` contains runtime dependencies.
75+ # cache-dependency-path: 'dev-requirements.txt'
76+ # - name: Install dependencies
77+ # run: |
78+ # python -m pip install --upgrade pip
79+ # pip install -r dev-requirements.txt
80+ # - name: Test with pytest
81+ # run: |
82+ # python -m pytest tests/unit
83+ # python -m pytest -m ci
0 commit comments