Skip to content

feat: add LSP config, validation tests, and contract test files #23

feat: add LSP config, validation tests, and contract test files

feat: add LSP config, validation tests, and contract test files #23

Workflow file for this run

name: Test Coverage Report
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Generate coverage report
run: |
cargo llvm-cov --workspace --lib --bins --tests --all-features --lcov --output-path lcov.info
cargo llvm-cov --workspace --lib --bins --tests --all-features --html
- name: Coverage threshold check
run: |
COVERAGE=$(cargo llvm-cov --workspace --lib --bins --tests --all-features --json | jq -r '.data[0].totals.percent_covered')
echo "📊 Current Coverage: ${COVERAGE}%"
# Set minimum coverage threshold
THRESHOLD=80
if (( $(echo "$COVERAGE >= $THRESHOLD" | bc -l) )); then
echo "✅ Coverage threshold met: ${COVERAGE}% >= ${THRESHOLD}%"
echo "coverage=${COVERAGE}" >> $GITHUB_OUTPUT
else
echo "❌ Coverage threshold NOT met: ${COVERAGE}% < ${THRESHOLD}%"
echo "coverage=${COVERAGE}" >> $GITHUB_OUTPUT
exit 1
fi
id: coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Upload coverage artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-report-${{ github.sha }}
path: target/llvm-cov/html/
retention-days: 30
- name: Coverage comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const coverage = '${{ steps.coverage.outputs.coverage }}';
const threshold = 80;
const comment = `## 📊 Test Coverage Report
**Current Coverage:** ${coverage}%
**Required Threshold:** ${threshold}%
**Status:** ${coverage >= threshold ? '✅ PASS' : '❌ FAIL'}
${coverage >= threshold ?
'Great job! The test coverage meets the minimum requirements.' :
'Test coverage is below the minimum threshold. Please add more tests to improve coverage.'}
---
*This comment was automatically generated by the coverage check workflow.*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});