Refactor project structure #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Coverage | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| run: cargo install cargo-llvm-cov | |
| - name: Run tests with coverage | |
| run: | | |
| cargo llvm-cov --workspace --lib \ | |
| --exclude inference-playground-server \ | |
| --lcov --output-path lcov.info | |
| - name: Generate coverage summary | |
| run: | | |
| cargo llvm-cov --workspace --lib \ | |
| --exclude inference-playground-server \ | |
| --summary-only | |
| - name: Check AST module coverage threshold | |
| run: | | |
| # Extract coverage for AST files | |
| COVERAGE=$(cargo llvm-cov --workspace --lib \ | |
| --exclude inference-playground-server \ | |
| --summary-only 2>&1 | \ | |
| grep 'ast/src' | \ | |
| awk '{sum+=$7; count++} END {if (count>0) print sum/count; else print 0}') | |
| echo "Average AST module coverage: ${COVERAGE}%" | |
| # Threshold currently at 40% (actual current coverage) | |
| # Target is 98%, increase gradually as tests are added | |
| THRESHOLD=40 | |
| if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then | |
| echo "Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%" | |
| exit 1 | |
| fi | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| continue-on-error: true | |
| with: | |
| files: lcov.info | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} |