Skip to content

Commit 9e2f17f

Browse files
Merge pull request #22 from tskit-dev/low-level-c-shared
Add Python-C tests workflow
2 parents c089b97 + 3dbe22f commit 9e2f17f

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Reusable Python C interface unit tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
additional-apt-packages:
7+
description: 'Additional APT packages to install'
8+
required: false
9+
type: string
10+
default: ''
11+
12+
jobs:
13+
c-tests:
14+
name: Python-C unit tests
15+
runs-on: ubuntu-24.04
16+
17+
steps:
18+
- name: Cancel Previous Runs
19+
uses: styfle/cancel-workflow-action@0.13.0
20+
with:
21+
access_token: ${{ github.token }}
22+
23+
- name: Checkout
24+
uses: actions/checkout@v6.0.2
25+
with:
26+
submodules: true
27+
28+
- name: Install dev tools
29+
run: sudo apt-get update && sudo apt-get install -y \
30+
gcovr ${{ inputs.additional-apt-packages }}
31+
32+
- name: Install uv and set the python version
33+
uses: astral-sh/setup-uv@v6
34+
with:
35+
python-version: 3.11
36+
version: "0.8.15"
37+
38+
- name: Install Python dependencies
39+
run: uv sync --locked --group test
40+
41+
- name: Build module
42+
run: CFLAGS=--coverage uv run python setup.py build_ext --inplace
43+
44+
- name: Run low-level tests
45+
run: uv run pytest -vs -n0 tests/test_lowlevel.py
46+
47+
- name: Upload coverage to Codecov
48+
uses: codecov/codecov-action@v5.4.0
49+
with:
50+
token: ${{ secrets.CODECOV_TOKEN }}
51+
flags: c-python
52+
fail_ci_if_error: true

0 commit comments

Comments
 (0)