Skip to content

Merge pull request #309 from Chucks1093/feat/htlc-clients-matching-so… #66

Merge pull request #309 from Chucks1093/feat/htlc-clients-matching-so…

Merge pull request #309 from Chucks1093/feat/htlc-clients-matching-so… #66

Workflow file for this run

name: Code Coverage
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
rust-coverage:
name: Rust Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: llvm-tools-preview
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
smartcontract/target
key: ${{ runner.os }}-cargo-cov-${{ hashFiles('**/Cargo.lock') }}
- name: Generate coverage report
run: |
cd smartcontract
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./smartcontract/lcov.info
flags: rust
name: rust-coverage
fail_ci_if_error: false
python-coverage:
name: Python Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
if [ -f backend/requirements.txt ]; then pip install -r backend/requirements.txt; fi
- name: Run tests with coverage
run: |
cd backend
pytest --cov=app --cov-report=xml --cov-report=term -v || true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./backend/coverage.xml
flags: python
name: python-coverage
fail_ci_if_error: false
frontend-coverage:
name: Frontend Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: |
cd frontend
npm ci
- name: Run tests with coverage
run: |
cd frontend
npm test -- --coverage --coverageReporters=text --coverageReporters=lcov || true
continue-on-error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./frontend/coverage/lcov.info
flags: frontend
name: frontend-coverage
fail_ci_if_error: false
coverage-report:
name: Coverage Report
runs-on: ubuntu-latest
needs: [rust-coverage, python-coverage, frontend-coverage]
if: always()
steps:
- name: Create coverage summary
run: |
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Coverage reports have been uploaded to Codecov." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Visit the [Codecov dashboard](https://codecov.io/gh/floxxih/ChainBridge) for detailed coverage reports." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Component | Coverage Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|-----------------|" >> $GITHUB_STEP_SUMMARY
echo "| Smart Contracts | ✅ Uploaded |" >> $GITHUB_STEP_SUMMARY
echo "| Backend | ✅ Uploaded |" >> $GITHUB_STEP_SUMMARY
echo "| Frontend | ✅ Uploaded |" >> $GITHUB_STEP_SUMMARY