Skip to content

Commit 0672d61

Browse files
authored
ci(coverage): add coverage reporting
Refs: #415
1 parent 852bf4c commit 0672d61

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: coverage
2+
on: ["push", "pull_request"]
3+
env:
4+
# increment this manually to force cache eviction
5+
RUST_CACHE_PREFIX: "v0-rust"
6+
7+
jobs:
8+
test:
9+
name: coverage
10+
runs-on: ubuntu-latest
11+
env:
12+
clang: "17"
13+
php_version: "8.4"
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ env.php_version }}
23+
env:
24+
debug: true
25+
- name: Setup Rust
26+
uses: dtolnay/rust-toolchain@master
27+
with:
28+
components: rustfmt, clippy
29+
toolchain: stable
30+
- name: Cache cargo dependencies
31+
uses: Swatinem/rust-cache@v2
32+
with:
33+
prefix-key: ${{ env.RUST_CACHE_PREFIX }}
34+
- name: Cache LLVM and Clang
35+
id: cache-llvm
36+
uses: actions/cache@v4
37+
with:
38+
path: ${{ runner.temp }}/llvm-${{ env.clang }}
39+
key: ubuntu-latest-llvm-${{ env.clang }}
40+
- name: Setup LLVM & Clang
41+
id: clang
42+
uses: KyleMayes/install-llvm-action@v2
43+
with:
44+
version: ${{ env.clang }}
45+
directory: ${{ runner.temp }}/llvm-${{ env.clang }}
46+
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
47+
- name: Configure Clang
48+
run: |
49+
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/lib" >> $GITHUB_ENV
50+
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
51+
echo "LLVM_CONFIG_PATH=${{ runner.temp }}/llvm-${{ env.clang }}/bin/llvm-config" >> $GITHUB_ENV
52+
- name: Install tarpaulin
53+
run: |
54+
cargo install cargo-tarpaulin --locked
55+
cargo tarpaulin --version
56+
- name: Run tests
57+
run: |
58+
cargo tarpaulin --engine llvm --workspace --all-features --tests --exclude tests --exclude-files docsrs_bindings.rs --timeout 120 --out Xml
59+
- name: Upload coverage
60+
uses: coverallsapp/github-action@v2

0 commit comments

Comments
 (0)