Skip to content

Commit ae88782

Browse files
use pyproject and pin deps fully
1 parent 1940f12 commit ae88782

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

.github/workflows/c-tests.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: Reusable C unit tests
33
on:
44
workflow_call:
55
inputs:
6+
pyproject-directory:
7+
description: 'Directory to find pyproject.toml'
8+
required: false
9+
type: string
10+
default: '.'
611
additional-apt-packages:
712
description: 'Additional APT packages to install'
813
required: false
@@ -29,7 +34,7 @@ jobs:
2934
with:
3035
submodules: true
3136

32-
- name: Install dev tools
37+
- name: Install system deps
3338
run: |
3439
sudo apt-get update
3540
sudo apt-get install -y libcunit1-dev libconfig-dev \
@@ -41,11 +46,13 @@ jobs:
4146
version: "0.10.2"
4247

4348
- name: Install uv deps
44-
run: uv tool install gcovr; uv tool install meson
49+
run: uv sync --project=${{ inputs.pyproject-directory }} --locked --only-group cdev
4550

4651
- name: Configure code
4752
working-directory: ${{ inputs.library-directory }}
48-
run: CC=gcc meson setup build-cov -Db_coverage=true
53+
run: |
54+
CC=gcc uv run --locked --project=${{ inputs.pyproject-directory }} --only-group cdev \
55+
meson setup build-cov -Db_coverage=true
4956
5057
- name: Compile
5158
working-directory: ${{ inputs.library-directory }}
@@ -57,7 +64,9 @@ jobs:
5764

5865
- name: Build coverage report
5966
working-directory: ${{ inputs.library-directory }}
60-
run: ninja -C build-cov coverage-xml
67+
run: |
68+
GCOVR='uv run --locked --project=${{ inputs.pyproject-directory }} --only-group cdev gcovr'\
69+
ninja -C build-cov coverage-xml
6170
6271
- name: Upload coverage to Codecov
6372
uses: codecov/codecov-action@v5.4.0
@@ -71,12 +80,15 @@ jobs:
7180
- name: Compile and test with clang
7281
working-directory: ${{ inputs.library-directory }}
7382
run: |
74-
CC=clang meson setup build-clang
75-
meson test -C build-clang
83+
CC=clang uv run --locked --project=${{ inputs.pyproject-directory }} --only-group cdev \
84+
meson setup build-clang
85+
ninja -C build-clang test
7686
7787
- name: Run tests with valgrind
7888
working-directory: ${{ inputs.library-directory }}
7989
run: |
80-
meson setup build-valgrind
81-
meson test -C build-valgrind -t-1 \
82-
--wrapper='valgrind --leak-check=full --error-exitcode=1'
90+
uv run --locked --project=${{ inputs.pyproject-directory }} --only-group cdev \
91+
meson setup build-valgrind
92+
uv run --locked --project=${{ inputs.pyproject-directory }} --only-group cdev \
93+
meson test -C build-valgrind -t-1 \
94+
--wrapper='valgrind --leak-check=full --error-exitcode=1'

0 commit comments

Comments
 (0)