-
Notifications
You must be signed in to change notification settings - Fork 13
230 lines (204 loc) · 8.17 KB
/
ci.yml
File metadata and controls
230 lines (204 loc) · 8.17 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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: CI
on:
merge_group:
pull_request:
push:
branches:
- main
schedule:
# At 04:44 on Monday, see https://crontab.guru/
- cron: "44 4 * * 1"
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.11"
- name: Install lint group
run: uv sync --locked --only-group lint
- name: Run prek
run: |
uv run --locked --only-group lint \
prek -c prek.toml run --all-files --show-diff-on-failure
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14, ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]
exclude:
# Just run macos and windows tests on one Python version
- os: macos-14
python-version: "3.12"
- os: macos-14
python-version: "3.13"
- os: windows-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.13"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: uv sync --locked --group test --no-default-groups
- name: Test console script entry point
run: |
uv run bio2zarr --help
- name: Run basic vcf2zarr example
if: runner.os != 'Windows'
run: |
uv run python -m bio2zarr vcf2zarr convert tests/data/vcf/sample.vcf.gz sample.vcz -f
- name: Run two-pass vcf2zarr example
if: runner.os != 'Windows'
run: |
uv run python -m bio2zarr vcf2zarr explode tests/data/vcf/sample.vcf.gz sample.icf -f
uv run python -m bio2zarr vcf2zarr encode sample.icf sample.vcz -f
- name: Run distributed explode example
if: runner.os != 'Windows'
run: |
uv run python -m bio2zarr vcf2zarr dexplode-init tests/data/vcf/sample.vcf.gz sample.icf -fn 3
uv run python -m bio2zarr vcf2zarr dexplode-partition sample.icf 0
uv run python -m bio2zarr vcf2zarr dexplode-partition sample.icf 1
uv run python -m bio2zarr vcf2zarr dexplode-partition sample.icf 2
uv run python -m bio2zarr vcf2zarr dexplode-finalise sample.icf
- name: Run distributed encode example
if: runner.os != 'Windows'
run: |
uv run python -m bio2zarr vcf2zarr dencode-init sample.icf sample.vcz -fn 3 --variants-chunk-size=3
uv run python -m bio2zarr vcf2zarr dencode-partition sample.vcz 0
uv run python -m bio2zarr vcf2zarr dencode-partition sample.vcz 1
uv run python -m bio2zarr vcf2zarr dencode-partition sample.vcz 2
uv run python -m bio2zarr vcf2zarr dencode-finalise sample.vcz
- name: Run tskit2zarr example
run: |
uv run python -m bio2zarr tskit2zarr convert tests/data/tskit/example.trees sample.vcz -f
- name: Run plink2zarr example
run: |
uv run python -m bio2zarr plink2zarr convert tests/data/plink/example sample.vcz -f
- name: Run tests
run: |
uv run pytest --cov=bio2zarr
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# The first coveralls upload will succeed and others seem to fail now.
# This is a quick workaround for doing a proper "parallel" setup:
# https://github.com/coverallsapp/github-action
fail-on-error: false
optional_dependencies:
name: Optional dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.11"
- name: Test optional dependencies
run: |
uv venv env-tskit
uv pip install --python=env-tskit .
source env-tskit/bin/activate
python -m bio2zarr tskit2zarr convert tests/data/tskit/example.trees ts.vcz > ts.txt 2>&1 || echo $? > ts_exit.txt
test "$(cat ts_exit.txt)" = "1"
grep -q "This process requires the optional tskit module. Install it with: pip install bio2zarr\[tskit\]" ts.txt
deactivate
uv pip install --python=env-tskit '.[tskit]'
source env-tskit/bin/activate
python -m bio2zarr tskit2zarr convert tests/data/tskit/example.trees ts.vcz
deactivate
uv venv env-vcf
uv pip install --python=env-vcf .
source env-vcf/bin/activate
python -m bio2zarr vcf2zarr convert tests/data/vcf/sample.vcf.gz sample.vcz > vcf.txt 2>&1 || echo $? > vcf_exit.txt
test "$(cat vcf_exit.txt)" = "1"
grep -q "This process requires the optional cyvcf2 module. Install it with: pip install bio2zarr\[vcf\]" vcf.txt
deactivate
uv pip install --python=env-vcf '.[vcf]'
source env-vcf/bin/activate
python -m bio2zarr vcf2zarr convert tests/data/vcf/sample.vcf.gz sample.vcz
deactivate
packaging:
name: Packaging
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.12"
- name: Install packaging deps
run: uv sync --locked --group packaging --no-default-groups
- name: Validate pyproject
run: uv run --locked --group packaging --no-default-groups validate-pyproject pyproject.toml -v
- name: Build artefacts
run: uv build
- name: Twine check
run: uv run --locked --group packaging --no-default-groups twine check --strict dist/*
- name: Install into venv
run: |
uv venv cli-test
uv pip install --python=cli-test dist/*.whl
- name: Check bio2zarr CLI
run: |
./cli-test/bin/python -m bio2zarr --help
- name: Check vcf2zarr CLI
run: |
./cli-test/bin/vcf2zarr --help
./cli-test/bin/python -m bio2zarr vcf2zarr --help
- name: Check vcfpartition CLI
run: |
./cli-test/bin/vcfpartition --help
./cli-test/bin/python -m bio2zarr vcfpartition --help
- name: Check tskit2zarr CLI
run: |
./cli-test/bin/tskit2zarr --help
./cli-test/bin/python -m bio2zarr tskit2zarr --help
- name: Check plink2zarr CLI
run: |
./cli-test/bin/plink2zarr --help
./cli-test/bin/python -m bio2zarr plink2zarr --help
test-zarr-version:
name: Test Zarr versions
runs-on: ubuntu-latest
strategy:
matrix:
zarr-format: [2, 3]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv and set the python version
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.11"
- name: Install test dependencies
run: uv sync --locked --group test --no-default-groups
- name: Run tests
run: |
uv run python -m pytest
env:
BIO2ZARR_DEFAULT_ZARR_FORMAT: ${{ matrix.zarr-format }}