Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Add Codecov integration for code coverage reporting (#159)

Maximilian Roosc59308101875
diff --git a/.github/.codecov.yaml b/.github/.codecov.yaml
new file mode 100644
index 000000000..456a22e89
--- /dev/null
+++ b/.github/.codecov.yaml
@@ -0,0 +1,17 @@
+comment: false
+
+ignore:
+ - "**/tests/**"
+
+coverage:
+ status:
+ project:
+ default:
+ removed_code_behavior: adjust_base
+ # This disables report a success/failure. That's not helpful on `main`
+ # and we get the success/failure from the patch status on PRs.
+ informational: true
+
+ patch:
+ default:
+ only_pulls: true
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 5d01b373c..8d6d6b1e6 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -166,3 +166,44 @@ jobs:
command: bench
# Run completion benchmarks (list has slow real_repo tests)
args: --bench completion -- --warm-up-time 0.3 --measurement-time 1
+
+ code-coverage:
+ runs-on: ubuntu-latest
+ steps:
+ - name: πŸ“‚ Checkout code
+ uses: actions/checkout@v6
+
+ - uses: baptiste0928/cargo-install@v3
+ with:
+ crate: cargo-llvm-cov
+
+ - name: πŸ’° Cache
+ uses: Swatinem/rust-cache@v2
+ with:
+ save-if: ${{ github.ref == 'refs/heads/main' }}
+
+ - name: Install shells (zsh, fish)
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y zsh fish
+
+ # Ensure nothing remains from caching
+ - run: cargo llvm-cov clean --workspace
+
+ - name: πŸ“Š Generate coverage report
+ run: cargo llvm-cov --cobertura --output-path=cobertura.xml
+
+ - name: Upload code coverage results
+ uses: actions/upload-artifact@v4
+ with:
+ name: code-coverage-report
+ path: cobertura.xml
+
+ - name: Upload to codecov.io
+ # Codecov action raises errors on forks; allow running on PRs to main repo
+ if: github.repository_owner == 'max-sixty'
+ uses: codecov/codecov-action@v5
+ with:
+ files: cobertura.xml
+ fail_ci_if_error: true
+ token: ${{ secrets.CODECOV_TOKEN }}