-
Notifications
You must be signed in to change notification settings - Fork 11
179 lines (175 loc) · 6.83 KB
/
Copy pathci.yml
File metadata and controls
179 lines (175 loc) · 6.83 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
name: CI
on:
push:
branches: [ main ]
pull_request:
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo test
run: cargo test
- name: Build examples
run: cargo build --examples
- name: Build docs
run: cargo doc --no-deps
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install maturin and cffi
run: pip install maturin cffi
- name: Build python bindings
run: maturin build --features python-bindings
cli-e2e:
runs-on: ubuntu-latest
env:
PYO3_PYTHON: python3
steps:
- uses: actions/checkout@v4
- name: Cache cargo artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Verify the committed toy reference is intact (pinned hash)
# A real anti-corruption gate, not the old self-referential check: pin the
# COMMITTED reference.fa (the one the release bundle + every other job
# ships) to a known hash. The previous step regenerated reference.fa at
# 1 Mbp without --length, overwriting the committed 4 kbp fixture and
# checking freshly-generated files against freshly-generated sums (a
# tautology that also tested a different reference than ships).
run: |
echo "ce8a6df801e836f4eda0b7661a68dcd7b7a9ab247c66d4582a89dbc207554efa examples/data/illumina_toy/reference.fa" \
| sha256sum --check
- name: Generate reads from the committed toy reference
# --reference simulates reads FROM the committed reference (does not invent
# or overwrite one), so cli-e2e exercises exactly the fixture that ships.
run: python3 scripts/generate_toy_data.py examples/data/illumina_toy --reference examples/data/illumina_toy/reference.fa
- name: Align to SAM
run: |
cargo run --release -- align \
--reference examples/data/illumina_toy/reference.fa \
--reads examples/data/illumina_toy/reads_R1.fastq \
--format sam \
--output examples/data/illumina_toy/alignments.sam
- name: Align to BAM
run: |
cargo run --release -- align \
--reference examples/data/illumina_toy/reference.fa \
--reads examples/data/illumina_toy/reads_R1.fastq \
--format bam \
--output examples/data/illumina_toy/alignments.bam
- name: Call variants
run: |
cargo run --release -- variants \
--reference examples/data/illumina_toy/reference.fa \
--alignments examples/data/illumina_toy/alignments.sam \
--mapq-threshold 5 \
--output examples/data/illumina_toy/variants.vcf
- name: Sanity-check outputs
run: |
test -s examples/data/illumina_toy/alignments.sam
test -s examples/data/illumina_toy/alignments.bam
grep -q '^#CHROM' examples/data/illumina_toy/variants.vcf
grep -q -v '^#' examples/data/illumina_toy/variants.vcf || echo \"warning: no variant lines emitted\"
- name: Build index for the bounded contract path
run: |
cargo run --release -- index \
--reference examples/data/illumina_toy/reference.fa \
--output examples/data/illumina_toy/reference.idx
- name: Sort the BAM for the contract path
run: |
cargo run --release -- sort \
--input examples/data/illumina_toy/alignments.bam \
--output examples/data/illumina_toy/sorted.bam
- name: Contract gate — fits / verify / refuse (bounded --index path)
run: |
set -e
# (1) Generous budget fits -> exit 0 + "contract: OK".
cargo run --release -- variants --index examples/data/illumina_toy/reference.idx \
--alignments examples/data/illumina_toy/sorted.bam \
--memory-budget-mb 4096 --enforce \
-o examples/data/illumina_toy/contract.vcf 2> ok.log
grep -q "contract: OK" ok.log
# (2) Verify the receipt without re-running -> exit 0.
cargo run --release -- verify \
--manifest examples/data/illumina_toy/contract.vcf.manifest.json | grep -q "verify: OK"
# (3) 1 MiB budget refuses up front -> exit 3, and writes no VCF.
rm -f examples/data/illumina_toy/refused.vcf
set +e
cargo run --release -- variants --index examples/data/illumina_toy/reference.idx \
--alignments examples/data/illumina_toy/sorted.bam \
--memory-budget-mb 1 --enforce \
-o examples/data/illumina_toy/refused.vcf 2> refuse.log
code=$?
set -e
test "$code" -eq 3
grep -q "REFUSE" refuse.log
test ! -f examples/data/illumina_toy/refused.vcf
- name: Exercise the rosalind-budget Action (local, from-source binary)
uses: ./
with:
index: examples/data/illumina_toy/reference.idx
alignments: examples/data/illumina_toy/sorted.bam
budget-mb: 4096
binary-path: target/release/rosalind
output: examples/data/illumina_toy/action.vcf