@@ -33,94 +33,21 @@ jobs:
3333 pyproject-directory : python
3434 secrets : inherit
3535
36+
3637 test :
3738 name : Python
38- runs-on : ${{ matrix.os }}
39+ uses : tskit-dev/.github/.github/workflows/python-tests.yml@main
40+ with :
41+ os : ${{ matrix.os }}
42+ python-version : ${{ matrix.python }}
43+ pyproject-directory : python
44+ coverage-directory : python/tskit
45+ secrets : inherit
3946 strategy :
40- fail-fast : false
4147 matrix :
4248 python : [ 3.11, 3.13 ]
4349 os : [ macos-latest, ubuntu-24.04, windows-latest ]
44- defaults :
45- run :
46- shell : bash
47- steps :
48- - name : Cancel Previous Runs
49- uses : styfle/cancel-workflow-action@0.13.0
50- with :
51- access_token : ${{ github.token }}
52-
53- - name : Checkout
54- uses : actions/checkout@v6.0.2
55-
56- - name : Install OSX libs
57- if : matrix.os == 'macos-latest'
58- run : |
59- brew install libxml2 libxslt
60-
61- - name : Fix windows symlinks
62- working-directory : python
63- if : matrix.os == 'windows-latest'
64- run : |
65- rm -r lib
66- mkdir lib
67- cp -r --dereference ../c/subprojects lib/.
68- cp -r --dereference ../c/tskit lib/.
69- cp ../c/tskit.h lib/.
70-
71- - name : Install uv and set the python version
72- uses : astral-sh/setup-uv@v7
73- with :
74- python-version : ${{ matrix.python }}
75- version : " 0.8.15"
76-
77- - name : Install dependencies
78- working-directory : python
79- run : uv sync --locked --group test
80-
81- - name : Minidom test
82- working-directory : python
83- # Importing either IPython or pytest causes import of xml.dom.minidom
84- # So to actually test that tskit imports it, we need a minimal test
85- run : |
86- uv run python -c "import tskit;tskit.Tree.generate_star(5).tree_sequence.draw_svg(path='test.svg')"
87-
88- - name : Run JIT code coverage
89- run : |
90- NUMBA_DISABLE_JIT=1 uv run --project=python \
91- pytest --cov=tskit --cov-report=xml --cov-branch -n2 \
92- python/tests/test_jit.py
93-
94- - name : Upload coverage to Codecov
95- uses : codecov/codecov-action@v5.5.2
96- with :
97- token : ${{ secrets.CODECOV_TOKEN }}
98- working-directory : python
99- fail_ci_if_error : false
100- files : coverage.xml
101- disable_search : true
102- verbose : true
103- flags : python-tests-no-jit
104-
105- - name : Run tests
106- run : |
107- if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
108- uv run --project=python \
109- pytest --cov=tskit --skip-slow --cov-report=xml --cov-branch -n2 python/tests
110- else
111- uv run --project=python \
112- pytest --cov=tskit --cov-report=xml --cov-branch -n2 python/tests
113- fi
11450
115- - name : Upload coverage to Codecov
116- uses : codecov/codecov-action@v5.5.2
117- with :
118- token : ${{ secrets.CODECOV_TOKEN }}
119- fail_ci_if_error : false
120- flags : python-tests
121- files : coverage.xml
122- disable_search : true
123- verbose : true
12451
12552 msys2 :
12653 runs-on : windows-latest
@@ -164,3 +91,53 @@ jobs:
16491 working-directory : c
16592 run : |
16693 ninja -C build test
94+
95+ bespoke-python-test :
96+ name : Bespoke Python tests
97+ runs-on : ubuntu-24.04
98+
99+ steps :
100+ - name : Cancel Previous Runs
101+ uses : styfle/cancel-workflow-action@0.13.0
102+ with :
103+ access_token : ${{ github.token }}
104+
105+ - name : Checkout
106+ uses : actions/checkout@v6.0.2
107+ with :
108+ submodules : true
109+
110+ - name : Install uv and set the python version
111+ uses : astral-sh/setup-uv@v6
112+ with :
113+ python-version : 3.11
114+ version : " 0.8.15"
115+
116+ - name : Install Python dependencies
117+ working-directory : python
118+ run : uv sync --locked --group test --no-default-groups
119+
120+ - name : Minidom test
121+ working-directory : python
122+ # Importing either IPython or pytest causes import of xml.dom.minidom
123+ # So to actually test that tskit imports it, we need a minimal test
124+ run : |
125+ uv run --locked --group test --no-default-groups \
126+ python -c "import tskit;tskit.Tree.generate_star(5).tree_sequence.draw_svg(path='test.svg')"
127+
128+ - name : Run JIT code coverage
129+ run : |
130+ NUMBA_DISABLE_JIT=1 uv run --locked --project=python --no-default-groups\
131+ pytest --cov=python/tskit --cov-report=xml --cov-branch \
132+ python/tests/test_jit.py
133+
134+ - name : Upload coverage to Codecov
135+ uses : codecov/codecov-action@v5.5.2
136+ with :
137+ token : ${{ secrets.CODECOV_TOKEN }}
138+ fail_ci_if_error : true
139+ files : coverage.xml
140+ disable_search : true
141+ verbose : true
142+ flags : python-tests-no-jit
143+
0 commit comments