From 5507252bb43ef5a7d4a30bc7b0ba10960affe76f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 22:21:27 +0000 Subject: [PATCH 1/4] Initial plan From e57a1d72f50cba5887ea7b163074799d2e20697a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 22:23:31 +0000 Subject: [PATCH 2/4] feat: add Tarpaulin-based code coverage report Agent-Logs-Url: https://github.com/webarkit/WebARKitLib-rs/sessions/35a9fc77-080b-4a3e-bb0c-207f12ce02ff Co-authored-by: kalwalt <1275858+kalwalt@users.noreply.github.com> --- .github/workflows/coverage.yml | 53 ++++++++++++++++++++++++++++++++++ .tarpaulin.toml | 5 ++++ README.md | 31 ++++++++++++++++++++ scripts/coverage.sh | 39 +++++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 .github/workflows/coverage.yml create mode 100644 .tarpaulin.toml create mode 100755 scripts/coverage.sh diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..b781631 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,53 @@ +name: Code Coverage + +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + +env: + CARGO_TERM_COLOR: always + +jobs: + coverage: + runs-on: ubuntu-latest + name: Generate Coverage Report + steps: + - uses: actions/checkout@v5 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + + - name: Install cargo-tarpaulin + run: cargo install cargo-tarpaulin + + - name: Generate coverage report + run: | + cargo tarpaulin \ + --workspace \ + --out Xml \ + --output-dir coverage \ + --timeout 300 \ + --exclude-files "tests/*" \ + --ignore-panics \ + --ignore-timeouts + + - name: Upload to Codecov + uses: codecov/codecov-action@v5 + with: + files: ./coverage/cobertura.xml + flags: rust + name: coverage-report + fail_ci_if_error: false + verbose: true + + - name: Archive coverage report + if: always() + uses: actions/upload-artifact@v5 + with: + name: coverage-report + path: coverage/ diff --git a/.tarpaulin.toml b/.tarpaulin.toml new file mode 100644 index 0000000..6a0146b --- /dev/null +++ b/.tarpaulin.toml @@ -0,0 +1,5 @@ +[coverage] +timeout = 300 +ignore-panics = true +ignore-timeouts = true +exclude-files = ["tests/*", "benches/*"] diff --git a/README.md b/README.md index 06a3ce0..5decf97 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ![WebARKitLib-rs](./assets/WebARKitLib-Rust-banner.jpg) [![CI](https://github.com/webarkit/WebARKitLib-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/webarkit/WebARKitLib-rs/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/webarkit/WebARKitLib-rs/branch/main/graph/badge.svg)](https://codecov.io/gh/webarkit/WebARKitLib-rs) [![Crates.io](https://img.shields.io/crates/v/webarkitlib-rs.svg)](https://crates.io/crates/webarkitlib-rs) [![npm](https://img.shields.io/npm/v/@webarkit/webarkitlib-wasm.svg)](https://www.npmjs.com/package/@webarkit/webarkitlib-wasm) [![GitHub stars](https://img.shields.io/github/stars/webarkit/WebARKitLib-rs.svg?style=social)](https://github.com/webarkit/WebARKitLib-rs/stargazers) @@ -263,6 +264,36 @@ Because it's the `log` crate facade, any compatible backend works: No library code change is needed โ€” pick the backend in your application's entry point. +## ๐Ÿ“ˆ Code Coverage + +Coverage reports are generated automatically on every push and pull request via the [coverage workflow](.github/workflows/coverage.yml) using [cargo-tarpaulin](https://github.com/xd009642/tarpaulin) and uploaded to [Codecov](https://codecov.io/gh/webarkit/WebARKitLib-rs). + +### Generate a Coverage Report Locally + +```bash +# Install tarpaulin (once) +cargo install cargo-tarpaulin + +# Run the helper script โ€” produces coverage/index.html +./scripts/coverage.sh +``` + +Or run tarpaulin directly: + +```bash +cargo tarpaulin --workspace --out Html --output-dir coverage --timeout 300 +``` + +### Coverage Targets + +| Area | Target | +|------|--------| +| Minimum overall | 75 % | +| Desirable overall | 85 %+ | +| Marker tracking (critical path) | 95 %+ | + +--- + ## ๐Ÿ“Š Benchmarking We maintain a strict performance comparison with the original C library to ensure our Rust port remains competitive. diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100755 index 0000000..5e798ae --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# coverage.sh โ€” Generate a local HTML code coverage report using cargo-tarpaulin. +# +# Usage: +# ./scripts/coverage.sh +# +# Requires cargo-tarpaulin to be installed: +# cargo install cargo-tarpaulin +set -e + +echo "๐Ÿงช Generating Code Coverage Report..." +echo "" + +# Clean previous coverage output +rm -rf coverage/ +mkdir -p coverage/ + +echo "Using Tarpaulin for coverage..." +cargo tarpaulin \ + --workspace \ + --out Html \ + --output-dir coverage \ + --timeout 300 \ + --exclude-files "tests/*" \ + --ignore-panics \ + --ignore-timeouts \ + --verbose + +echo "" +echo "โœ… Coverage report generated!" +echo "" +echo "๐Ÿ“Š Open the report:" +if command -v open &> /dev/null; then + open coverage/index.html # macOS +elif command -v xdg-open &> /dev/null; then + xdg-open coverage/index.html # Linux +else + echo " $(pwd)/coverage/index.html" +fi From 7bf5a31d61bdb30b989be5079f5d8e8f4392b976 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 22:28:46 +0000 Subject: [PATCH 3/4] fix(ci): remove invalid --ignore-timeouts flag from tarpaulin config Agent-Logs-Url: https://github.com/webarkit/WebARKitLib-rs/sessions/32188d90-5f00-44bd-ad39-4a98050af63a Co-authored-by: kalwalt <1275858+kalwalt@users.noreply.github.com> --- .github/workflows/coverage.yml | 3 +-- .tarpaulin.toml | 1 - scripts/coverage.sh | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b781631..17eecbf 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -33,8 +33,7 @@ jobs: --output-dir coverage \ --timeout 300 \ --exclude-files "tests/*" \ - --ignore-panics \ - --ignore-timeouts + --ignore-panics - name: Upload to Codecov uses: codecov/codecov-action@v5 diff --git a/.tarpaulin.toml b/.tarpaulin.toml index 6a0146b..30a15fb 100644 --- a/.tarpaulin.toml +++ b/.tarpaulin.toml @@ -1,5 +1,4 @@ [coverage] timeout = 300 ignore-panics = true -ignore-timeouts = true exclude-files = ["tests/*", "benches/*"] diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 5e798ae..0ca6ed9 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -23,7 +23,6 @@ cargo tarpaulin \ --timeout 300 \ --exclude-files "tests/*" \ --ignore-panics \ - --ignore-timeouts \ --verbose echo "" From aab3b361578701684a87cd927cea0e335a906d77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 24 May 2026 11:50:01 +0000 Subject: [PATCH 4/4] fix(ci): add CODECOV_TOKEN to codecov upload step Agent-Logs-Url: https://github.com/webarkit/WebARKitLib-rs/sessions/de06767f-d0ae-472b-a938-b53237851263 Co-authored-by: kalwalt <1275858+kalwalt@users.noreply.github.com> --- .github/workflows/coverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 17eecbf..ad750a0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -35,9 +35,10 @@ jobs: --exclude-files "tests/*" \ --ignore-panics - - name: Upload to Codecov + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 with: + token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage/cobertura.xml flags: rust name: coverage-report