-
Notifications
You must be signed in to change notification settings - Fork 73
194 lines (174 loc) · 5.44 KB
/
tests.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Tests
on:
pull_request:
push:
branches: [main, test]
jobs:
pre-commit:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: install clang-format
if: steps.clang_format.outputs.cache-hit != 'true'
run: |
python -m venv env
source env/bin/activate
pip install clang-format==6.0.1
- uses: pre-commit/action@v3.0.0
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: python/requirements/benchmark.txt
- name: Install deps
run: pip install -r python/requirements/benchmark.txt
- name: Build module
run: |
cd python
python setup.py build_ext --inplace
- name: Run benchmarks
run: |
cd python/benchmark
pip uninstall -y tskit
python run.py
- name: Upload Results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: python/benchmark
test:
name: Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [ 3.9, 3.12 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- name: Install OSX libs
if: matrix.os == 'macos-latest'
run: |
brew install libxml2 libxslt
- name: Cache conda and dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.python}}-conda-v1-${{ hashFiles('python/requirements/CI-tests-conda/requirements.txt') }}-${{ hashFiles('python/requirements/CI-tests-pip/requirements.txt') }}
- name: Install Conda
uses: conda-incubator/setup-miniconda@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
activate-environment: anaconda-client-env
python-version: ${{ matrix.python }}
channels: conda-forge
channel-priority: strict
auto-update-conda: true
- name: Fix windows symlinks
working-directory: python
if: matrix.os == 'windows-latest'
run: |
rm -r lib
mkdir lib
cp -r --dereference ../c/subprojects lib/.
cp -r --dereference ../c/tskit lib/.
cp ../c/tskit.h lib/.
- name: Fix windows .profile
if: steps.cache.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
run: |
cp ~/.bash_profile ~/.profile
- name: Install conda deps
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0} #We need a login shell to get conda
run: |
conda install --yes --file=python/requirements/CI-tests-conda/requirements.txt
- name: Install pip deps
if: steps.cache.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
pip install -r python/requirements/CI-tests-pip/requirements.txt
# Remove tskit installed by conda
pip uninstall -y tskit
- name: Build module
working-directory: python
run: |
source ~/.profile
conda activate anaconda-client-env
python setup.py build_ext --inplace
- name: Run tests
working-directory: python
run: |
source ~/.profile
conda activate anaconda-client-env
python -m pytest -x --cov=tskit --cov-report=xml --cov-branch -n2 --durations=20 tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: python
fail_ci_if_error: false
flags: python-tests
name: codecov-umbrella
verbose: true
msys2:
runs-on: windows-latest
strategy:
matrix:
include:
- { sys: mingw32, env: i686 }
- { sys: mingw64, env: x86_64 }
name: Windows (${{ matrix.sys }}, ${{ matrix.env }})
defaults:
run:
shell: msys2 {0}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: 'Checkout'
uses: actions/checkout@v4
- name: Setup MSYS2 ${{matrix.sys}}
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
git
mingw-w64-${{matrix.env}}-toolchain
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-meson
mingw-w64-${{matrix.env}}-cunit
- name: Build
working-directory: c
run: |
meson build -Dbuild_examples=false
ninja -C build
- name: Run tests
working-directory: c
run: |
ninja -C build test