-
Notifications
You must be signed in to change notification settings - Fork 11
170 lines (166 loc) · 6.02 KB
/
Copy pathci.yml
File metadata and controls
170 lines (166 loc) · 6.02 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
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: Generate toy dataset
run: python3 scripts/generate_toy_data.py examples/data/illumina_toy
- name: Verify checksums
run: sha256sum --check SHA256SUMS
working-directory: examples/data/illumina_toy
- 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