-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (62 loc) · 2.09 KB
/
python-c-tests.yml
File metadata and controls
74 lines (62 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Reusable Python C interface unit tests
on:
workflow_call:
inputs:
additional-apt-packages:
description: 'Additional APT packages to install'
required: false
type: string
default: ''
pyproject-directory:
description: 'Directory to find pyproject.toml'
required: false
type: string
default: '.'
tests:
description: 'Low-level tests to run'
required: false
type: string
default: 'tests/test_python_c.py'
jobs:
python-c-tests:
name: Python-C unit tests
runs-on: ubuntu-24.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v6.0.2
with:
submodules: true
- name: Install dev tools
if: ${{ inputs.additional-apt-packages != '' }}
run: |
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional-apt-packages }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.10.0"
- name: Install Python dependencies
run: uv sync --project=${{ inputs.pyproject-directory }} --locked --group test --no-default-groups
- name: Install gcovr
run: uv tool install gcovr==8.6
- name: Build module
working-directory: ${{ inputs.pyproject-directory }}
run: CFLAGS=--coverage uv run --no-default-groups python setup.py build_ext --inplace
- name: Run low-level tests
run: |
uv run --project=${{ inputs.pyproject-directory }} --locked --group test --no-default-groups \
pytest ${{ inputs.tests }}
- name: Run gcovr
run: uv tool run gcovr --clover coverage.xml --txt
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
disable_search: true
verbose: true
flags: c-python
fail_ci_if_error: true