Skip to content

Commit 6956ff5

Browse files
committed
Add more tests
1 parent 4924548 commit 6956ff5

File tree

136 files changed

+2506
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+2506
-8
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Coverage
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
coverage:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rust
16+
uses: dtolnay/rust-toolchain@stable
17+
with:
18+
components: llvm-tools-preview
19+
20+
- name: Install cargo-llvm-cov
21+
run: cargo install cargo-llvm-cov
22+
23+
- name: Run tests with coverage
24+
run: |
25+
cargo llvm-cov --workspace --lib \
26+
--exclude wasm-runner \
27+
--exclude inference-playground-server \
28+
--lcov --output-path lcov.info
29+
30+
- name: Generate coverage summary
31+
run: |
32+
cargo llvm-cov --workspace --lib \
33+
--exclude wasm-runner \
34+
--exclude inference-playground-server \
35+
--summary-only
36+
37+
- name: Check AST module coverage threshold
38+
run: |
39+
# Extract coverage for AST files
40+
COVERAGE=$(cargo llvm-cov --workspace --lib \
41+
--exclude wasm-runner \
42+
--exclude inference-playground-server \
43+
--summary-only 2>&1 | \
44+
grep 'ast/src' | \
45+
awk '{sum+=$7; count++} END {if (count>0) print sum/count; else print 0}')
46+
47+
echo "Average AST module coverage: ${COVERAGE}%"
48+
49+
# Threshold currently at 40% (actual current coverage)
50+
# Target is 98%, increase gradually as tests are added
51+
THRESHOLD=40
52+
53+
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
54+
echo "Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
55+
exit 1
56+
fi
57+
58+
- name: Upload coverage to Codecov
59+
uses: codecov/codecov-action@v4
60+
with:
61+
files: lcov.info
62+
fail_ci_if_error: true
63+
token: ${{ secrets.CODECOV_TOKEN }}
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.
66 Bytes
Binary file not shown.

β€Žtest_data/wasm/custom.0.wasmβ€Ž

267 Bytes
Binary file not shown.

β€Žtest_data/wasm/custom.1.wasmβ€Ž

390 Bytes
Binary file not shown.
24 Bytes
Binary file not shown.

β€Žtest_data/wasm/custom.2.wasmβ€Ž

101 Bytes
Binary file not shown.

0 commit comments

Comments
Β (0)