Skip to content

Commit 39a16d8

Browse files
Try general python test workflow
1 parent e470639 commit 39a16d8

1 file changed

Lines changed: 99 additions & 82 deletions

File tree

.github/workflows/tests.yml

Lines changed: 99 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -33,94 +33,111 @@ 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
114-
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
50+
51+
52+
53+
# test:
54+
# name: Python
55+
# runs-on: ${{ matrix.os }}
56+
# strategy:
57+
# fail-fast: false
58+
# matrix:
59+
# python: [ 3.11, 3.13 ]
60+
# os: [ macos-latest, ubuntu-24.04, windows-latest ]
61+
# defaults:
62+
# run:
63+
# shell: bash
64+
# steps:
65+
# - name: Cancel Previous Runs
66+
# uses: styfle/cancel-workflow-action@0.13.0
67+
# with:
68+
# access_token: ${{ github.token }}
69+
70+
# - name: Checkout
71+
# uses: actions/checkout@v6.0.2
72+
73+
# - name: Install OSX libs
74+
# if: matrix.os == 'macos-latest'
75+
# run: |
76+
# brew install libxml2 libxslt
77+
78+
# - name: Fix windows symlinks
79+
# working-directory: python
80+
# if: matrix.os == 'windows-latest'
81+
# run: |
82+
# rm -r lib
83+
# mkdir lib
84+
# cp -r --dereference ../c/subprojects lib/.
85+
# cp -r --dereference ../c/tskit lib/.
86+
# cp ../c/tskit.h lib/.
87+
88+
# - name: Install uv and set the python version
89+
# uses: astral-sh/setup-uv@v7
90+
# with:
91+
# python-version: ${{ matrix.python }}
92+
# version: "0.8.15"
93+
94+
# - name: Install dependencies
95+
# working-directory: python
96+
# run: uv sync --locked --group test
97+
98+
# - name: Minidom test
99+
# working-directory: python
100+
# # Importing either IPython or pytest causes import of xml.dom.minidom
101+
# # So to actually test that tskit imports it, we need a minimal test
102+
# run: |
103+
# uv run python -c "import tskit;tskit.Tree.generate_star(5).tree_sequence.draw_svg(path='test.svg')"
104+
105+
# - name: Run JIT code coverage
106+
# run: |
107+
# NUMBA_DISABLE_JIT=1 uv run --project=python \
108+
# pytest --cov=tskit --cov-report=xml --cov-branch -n2 \
109+
# python/tests/test_jit.py
110+
111+
# - name: Upload coverage to Codecov
112+
# uses: codecov/codecov-action@v5.5.2
113+
# with:
114+
# token: ${{ secrets.CODECOV_TOKEN }}
115+
# working-directory: python
116+
# fail_ci_if_error: false
117+
# files: coverage.xml
118+
# disable_search: true
119+
# verbose: true
120+
# flags: python-tests-no-jit
121+
122+
# - name: Run tests
123+
# run: |
124+
# if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
125+
# uv run --project=python \
126+
# pytest --cov=tskit --skip-slow --cov-report=xml --cov-branch -n2 python/tests
127+
# else
128+
# uv run --project=python \
129+
# pytest --cov=tskit --cov-report=xml --cov-branch -n2 python/tests
130+
# fi
131+
132+
# - name: Upload coverage to Codecov
133+
# uses: codecov/codecov-action@v5.5.2
134+
# with:
135+
# token: ${{ secrets.CODECOV_TOKEN }}
136+
# fail_ci_if_error: false
137+
# flags: python-tests
138+
# files: coverage.xml
139+
# disable_search: true
140+
# verbose: true
124141

125142
msys2:
126143
runs-on: windows-latest

0 commit comments

Comments
 (0)