Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,60 @@ jobs:
- name: Cache cargo
uses: Swatinem/rust-cache@v2

- name: Install coverage tools
run: |
cargo install cargo-llvm-cov
cargo install cargo-tarpaulin

- name: Format
run: cargo fmt --all -- --check

- name: Clippy
run: cargo clippy --workspace --all-features -- -D warnings

- name: Build WASM (release)
run: cargo build --target wasm32-unknown-unknown --release

- name: Run tests with coverage
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: Check coverage thresholds
run: |
COVERAGE=$(cargo llvm-cov --workspace --lib --bins --tests --all-features --json | jq -r '.data[0].totals.percent_covered')
echo "Current coverage: ${COVERAGE}%"
THRESHOLD=80
if (( $(echo "$COVERAGE >= $THRESHOLD" | bc -l) )); then
echo "βœ… Coverage threshold met: ${COVERAGE}% >= ${THRESHOLD}%"
else
echo "❌ Coverage threshold NOT met: ${COVERAGE}% < ${THRESHOLD}%"
exit 1
fi

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: lcov.info
flags: unittests
name: codecov-umbrella

- name: Upload coverage artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: target/llvm-cov/html/

- name: Run integration tests
run: cargo test --workspace --test cross_chain_integration

- name: Run comprehensive integration tests
run: |
cd testing/integration
cargo test --lib

- name: Security audit
run: cargo audit --ignore RUSTSEC-2023-0052

- name: Check dependencies
run: cargo deny check
90 changes: 90 additions & 0 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
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
});
Loading
Loading