@@ -23,6 +23,13 @@ permissions:
2323 packages : read
2424 pull-requests : write
2525
26+ # GLOBAL ENV: Applies to ALL jobs (Linux & macOS)
27+ env :
28+ # Strict lockfile checks for everyone, equivalent to passing --frozen to every command
29+ UV_FROZEN : " 1"
30+ # Needed for coverage/multiprocessing reliability
31+ PYTHONSTARTMETHOD : spawn
32+
2633jobs :
2734 test-ubuntu :
2835 name : ubuntu-python-${{ matrix.python-version }}
3946 steps :
4047 - name : Checkout repository
4148 uses : actions/checkout@v4
49+
4250 - name : Get dependencies
4351 run : |
4452 rpm -q daps \
@@ -67,37 +75,29 @@ jobs:
6775
6876 - name : Install uv
6977 id : setup-uv
70- run : |
71- python3 -m venv .venv
72- source .venv/bin/activate
73- pip install uv
74-
75- - name : Print the installed version
76- run : echo "Installed uv version is $(.venv/bin/uv --version)"
78+ uses : astral-sh/setup-uv@v7
79+ with :
80+ enable-cache : true
81+ cache-dependency-glob : " uv.lock"
7782
7883 - name : Install dependencies and Coverage Tools
79- run : |
80- source .venv/bin/activate
81- uv sync --frozen --group devel
82- # CRITICAL FIX: Ensure coverage tools are installed for the CI runner
83- pip install coverage pytest-cov
84+ run : uv sync --group tests
8485
8586 - name : Run tests and Report Coverage
87+ env :
88+ UV_NO_SYNC : " 1" # Disable uv sync during test runs
8689 run : |
87- source .venv/bin/activate
88- # 1. Run tests and collect coverage for src/ and tests/
89- pytest --cov=src --cov=tests --cov-report=term-missing -vv
90+ # Using 'uv run' avoids the need to manually source .venv/bin/activate
91+ uv run pytest --cov=src --cov=tests --cov-report=term-missing -vv
9092
91- # 2. Combine data
92- python -m coverage combine --append || true
93+ # Combine data
94+ uv run python -m coverage combine --append || true
9395
94- # 3. Generate report and save to file (using tee to see it in logs too)
95- python -m coverage report | tee coverage.txt
96+ # Generate report
97+ uv run python -m coverage report | tee coverage.txt
9698
97- # 4. Cleanup coverage data
98- python -m coverage erase # Final cleanup
99- env :
100- PYTHONSTARTMETHOD : spawn
99+ # Cleanup
100+ uv run python -m coverage erase
101101
102102 - name : Create Coverage Comment for ${{ github.event.pull_request.head.sha || github.sha }}
103103 if : success() && github.event_name == 'pull_request' && matrix.python-version == '3.12'
@@ -183,6 +183,8 @@ jobs:
183183
184184 # Install uv and project dependencies inside a virtual environment
185185 - name : Install uv and dependencies
186+ env :
187+ UV_NO_SYNC : " 1" # Disable uv sync during test runs
186188 run : |
187189 python3 -m venv .venv
188190 source .venv/bin/activate
0 commit comments