Merge pull request #428 from dreamgene/feat/share-consolidation #349
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: Test Coverage | ||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| pull_request: | ||
| branches: [main, develop] | ||
| jobs: | ||
| coverage: | ||
| name: Test Coverage Report | ||
| if: false | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt, clippy | ||
| - name: Cache cargo registry | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
| - name: Install cargo-tarpaulin | ||
| run: cargo install cargo-tarpaulin | ||
| - name: Run tests with coverage | ||
| run: | | ||
| cargo tarpaulin --all-features --workspace --timeout 300 --exclude-files '*/tests/*' --exclude-files '*/target/*' --exclude-files '*/indexer/*' --exclude-pattern '**/observer.rs' --exclude-pattern '**/event_bus.rs' --out Xml --out Html --output-dir coverage 2>&1 || true | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage/coverage.xml | ||
| flags: unittests | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
| - name: Check coverage threshold | ||
| run: | | ||
| COVERAGE=$(grep -oP 'coverage: \K[0-9.]+' coverage/tarpaulin-report.html | head -1 || echo "0") | ||
| THRESHOLD=95.0 | ||
| echo "Current coverage: ${COVERAGE}%" | ||
| echo "Required threshold: ${THRESHOLD}%" | ||
| if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then | ||
| echo "ERROR: Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%" | ||
| exit 1 | ||
| fi | ||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: coverage/ | ||