Repository navigation
348 lines (339 loc) · 13.8 KB
/
Copy pathtests.yml
File metadata and controls
348 lines (339 loc) · 13.8 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Tests
on:
push:
branches: [master]
pull_request:
jobs:
weirdo-integration:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install the released WEIRDO integration
run: |
bash scripts/pip_install.sh pytest pytest-cov pytest-xdist -e .
python -m pip check
python -c "from mhctools import WEIRDO; print(WEIRDO().predictor_version)"
- name: Exercise scoring, mixed ranking, and cache replay
run: ./test.sh -m weirdo --strict-markers
vaxrank-candidate-workflow:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install the coordinated downstream consumer
run: |
# Exercise the published consumer with normal dependency resolution.
# 3.56.1 uses Variant.genome instead of the deprecated ensembl alias.
bash scripts/pip_install.sh pytest 'vaxrank==3.56.1' -e .
python -m pip check
- name: Verify table features through DSL scoring and vaccine construction
run: python -m pytest scripts/check_vaxrank_candidates.py -q
build:
runs-on: ubuntu-22.04
outputs:
coverage-jobs: ${{ strategy.job-total }}
env:
HAS_NETMHC_TOKEN: ${{ secrets.NETMHC_BUNDLE_ACCESS_TOKEN != '' }}
# Pin pyensembl's data directory rather than trusting its default.
# The cache below is only useful if it names the directory pyensembl
# actually writes to, and "~/.pyensembl" was not it.
PYENSEMBL_CACHE_DIR: ${{ github.workspace }}/pyensembl-data
# Tests read Sid alignments from the shared openvax-v1 test data.
OSTEOSARC_CACHE: ${{ github.workspace }}/osteosarc-cache
strategy:
fail-fast: true
matrix:
include:
# Test the declared pandas floor as well as current 3.x releases.
- python-version: "3.11"
pandas: "pandas==3.0.0"
- python-version: "3.11"
pandas: "pandas>=3,<4"
- python-version: "3.12"
pandas: "pandas>=3,<4"
- python-version: "3.13"
pandas: "pandas>=3,<4"
- python-version: "3.14"
pandas: "pandas>=3,<4"
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
pyproject.toml
- name: Checkout private netmhc-bundle repo
if: env.HAS_NETMHC_TOKEN == 'true'
uses: actions/checkout@v7
with:
repository: openvax/netmhc-bundle
token: ${{ secrets.NETMHC_BUNDLE_ACCESS_TOKEN }}
path: netmhc-bundle
- name: Install netmhc-bundle dependencies
if: env.HAS_NETMHC_TOKEN == 'true'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: tcsh gawk
version: 1.0
- name: Verify netmhc-bundle tools
if: env.HAS_NETMHC_TOKEN == 'true'
run: |
export NETMHC_BUNDLE_HOME=$PWD/netmhc-bundle
mkdir -p $PWD/netmhc-bundle-tmp
export NETMHC_BUNDLE_TMPDIR=$PWD/netmhc-bundle-tmp
export PATH=$PATH:$NETMHC_BUNDLE_HOME/bin
echo `which netMHC` && netMHC -h
echo `which netMHCpan` && netMHCpan -h
echo `which netMHCcons` && netMHCcons -h
- name: Install dependencies
env:
PANDAS_REQUIREMENT: ${{ matrix.pandas }}
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
bash scripts/pip_install.sh -e . "$PANDAS_REQUIREMENT"
python -m pip check
python -m pip show pandas pyensembl gtfparse
- name: Resolve the installed default Ensembl release
id: ensembl-release
run: |
python - <<'PY' >> "$GITHUB_OUTPUT"
from pyensembl import ensembl_grch38
release = ensembl_grch38.release
print(f"release={release}")
print(f"cache-key=pyensembl-GRCh37.75-GRCh38.{release}-v5")
PY
- name: Cache pyensembl data
id: ensembl-cache
uses: actions/cache@v6
with:
path: ${{ github.workspace }}/pyensembl-data
key: ${{ steps.ensembl-release.outputs.cache-key }}
restore-keys: |
pyensembl-GRCh37.75-GRCh38.${{ steps.ensembl-release.outputs.release }}-v4
pyensembl-GRCh37.75-GRCm38.102-GRCh38.93-GRCm38.93-v2
- name: Verify core integrations are installed
run: |
python -c "import isovar, pirlygenes, oncoref, weirdo"
- name: Install samtools for Osteosarc extraction
run: |
sudo apt-get update
sudo apt-get install -y samtools
- name: Verify Osteosarc is installed in the base environment
run: |
python -c "from importlib.metadata import version; import osteosarc, pysam; print('Osteosarc', version('osteosarc'))"
- name: Key the openvax-v1 test reads by their manifest
id: openvax-v1
run: |
echo "manifest=$(python -c 'from osteosarc.shared import published; print(published("openvax-v1")["manifest_sha256"])')" >> "$GITHUB_OUTPUT"
- name: Cache the openvax-v1 test reads
uses: actions/cache@v6
with:
path: ${{ env.OSTEOSARC_CACHE }}/osteosarc/bundles
key: openvax-v1-${{ steps.openvax-v1.outputs.manifest }}
- name: Lint with ruff
run: |
./lint.sh
- name: Install required Ensembl references
run: |
echo "Before installing Ensembl releases" && df -h
# Install the canonical sources used by the test consumers (#499).
# New mirror caches have distinct identities. Always run the
# idempotent installer: a restored directory can be incomplete.
# Retry with backoff: the failures seen in practice are 504s and
# transient DNS, both of which a second attempt clears.
install_release() {
local attempt
for attempt in 1 2 3; do
if pyensembl install --release "$1" --species "$2"; then
return 0
fi
echo "::warning::pyensembl install $2 $1 failed (attempt $attempt/3)"
sleep $((attempt * 15))
done
echo "::error::pyensembl install $2 $1 failed after 3 attempts"
return 1
}
install_release 75 human
install_release '${{ steps.ensembl-release.outputs.release }}' human
- name: Verify Ensembl data is present
run: |
# Exercise both runtime references, including their protein data,
# after cache hits and new installs.
python scripts/check_default_ensembl.py
- name: Test with pytest
run: |
if [[ "$HAS_NETMHC_TOKEN" == "true" ]]; then
export NETMHC_BUNDLE_HOME=$PWD/netmhc-bundle
echo "NetMHC-bundle dir:" && ls -l "$NETMHC_BUNDLE_HOME"
mkdir -p "$PWD/netmhc-bundle-tmp"
export NETMHC_BUNDLE_TMPDIR=$PWD/netmhc-bundle-tmp
export PATH=$PATH:$NETMHC_BUNDLE_HOME/bin
fi
if [[ "$HAS_NETMHC_TOKEN" == "true" ]]; then
./test.sh
else
./test.sh -m 'not netmhc' --strict-markers
fi
- name: Save verified Ensembl data for the installed wheel
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v7
with:
name: ensembl-test-references
path: ${{ env.PYENSEMBL_CACHE_DIR }}
include-hidden-files: true
if-no-files-found: error
compression-level: 1
retention-days: 7
overwrite: true
- name: Save coverage for the upload job
uses: actions/upload-artifact@v7
with:
name: coverage-python-${{ matrix.python-version }}-${{ strategy.job-index }}
path: .coverage
include-hidden-files: true
if-no-files-found: error
# A retried matrix member replaces only its own data. Successful
# members' artifacts remain available on a failed-jobs-only rerun.
overwrite: true
isovar-integration:
runs-on: ubuntu-22.04
env:
PYENSEMBL_CACHE_DIR: ${{ github.workspace }}/empty-ensembl-cache
OSTEOSARC_CACHE: ${{ github.workspace }}/osteosarc-cache
strategy:
fail-fast: false
matrix:
# Exercise the high-depth support-reconciliation floor and the latest
# compatible release with the same original-read consumer regressions.
isovar: ["isovar==1.78.0", "isovar<2"]
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.12
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: |
requirements.txt
pyproject.toml
- name: Install Topiary with Isovar (minimum and latest)
run: |
sudo apt-get update
sudo apt-get install -y samtools
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov pytest-xdist
bash scripts/pip_install.sh -e . '${{ matrix.isovar }}'
- name: Verify Isovar imports
run: |
python -c "import sys; from importlib.metadata import version; import topiary; assert 'isovar' not in sys.modules; import isovar; print('Isovar', version('isovar'))"
- name: Key the openvax-v1 test reads by their manifest
id: openvax-v1
run: |
echo "manifest=$(python -c 'from osteosarc.shared import published; print(published("openvax-v1")["manifest_sha256"])')" >> "$GITHUB_OUTPUT"
- name: Cache the openvax-v1 test reads
uses: actions/cache@v6
with:
path: ${{ env.OSTEOSARC_CACHE }}/osteosarc/bundles
key: openvax-v1-${{ steps.openvax-v1.outputs.manifest }}
- name: Test Isovar integration
run: |
./test.sh -m 'isovar or osteosarc' --strict-markers
installed-wheel:
needs: build
runs-on: ubuntu-22.04
env:
PYENSEMBL_CACHE_DIR: ${{ github.workspace }}/pyensembl-data
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- uses: actions/download-artifact@v8
with:
name: ensembl-test-references
path: ${{ env.PYENSEMBL_CACHE_DIR }}
- name: Install the normal wheel
run: |
python -m pip install build
python -m build
bash scripts/pip_install.sh dist/*.whl pytest
python -m pip check
- name: Exercise installed RNA, reference, CTA, ranking and cache workflows
run: |
mkdir -p "$RUNNER_TEMP/topiary-wheel-check"
cp -R tests scripts pyproject.toml "$RUNNER_TEMP/topiary-wheel-check/"
cd "$RUNNER_TEMP/topiary-wheel-check"
python -c "import topiary; assert 'site-packages' in topiary.__file__, topiary.__file__"
python -m pytest -q --strict-markers \
tests/test_sources.py \
tests/test_consumer_workflows.py::test_weirdo_model_mixed_ranking_and_cache_replay \
tests/test_consumer_workflows.py::test_osteosarc_numpy_custom_creator_survives_serialization
packaging:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Build distributions
run: |
python -m pip install build twine
python -m build
- name: Check distribution contents and metadata
run: |
python tests/check_distributions.py dist
python -m twine check --strict dist/*
coverage:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Download successful matrix coverage
uses: actions/download-artifact@v8
with:
pattern: coverage-python-*
path: coverage-data
- name: Combine the complete test matrix
env:
EXPECTED_COVERAGE_JOBS: ${{ needs.build.outputs.coverage-jobs }}
run: |
python -m pip install coverage
python tests/combine_coverage.py coverage-data "$EXPECTED_COVERAGE_JOBS" coverage.xml
- name: Install verified Coveralls reporter
run: |
# Pin the release and its published binary digest together. Avoid
# racing separate "latest" archive and checksum downloads.
bash scripts/download_verified.sh \
https://github.com/coverallsapp/coverage-reporter/releases/download/v0.6.22/coveralls-linux-x86_64 \
34fcaf347627307e505ec207acd617c3bfc6c3e2684b22e760be29eb339c36d5 \
"$RUNNER_TEMP/coveralls"
chmod +x "$RUNNER_TEMP/coveralls"
- name: Publish coverage to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# One non-parallel report: no finish webhook can close a build while
# other jobs still need it. Give every rerun a distinct build number.
"$RUNNER_TEMP/coveralls" report coverage.xml --format=cobertura \
--build-number="$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"