forked from Meta-A/bpm
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 1.79 KB
/
code-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Code Coverage
on:
pull_request:
paths:
- '**/*.rs'
- '!LICENSE'
- '!README.md'
- '!**/*.md'
jobs:
code-coverage:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
# Directories to cache
path: |
~/.cargo/registry
~/.cargo/bin
target
# Key based on OS and Cargo.lock hash
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Fallback keys
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup default stable
- name: Install cargo-tarpaulin if not cached
run: |
if ! command -v cargo-tarpaulin &> /dev/null; then
echo "cargo-tarpaulin not found, installing..."
cargo install cargo-tarpaulin
else
echo "cargo-tarpaulin is cached."
fi
- name: Install protoc (Protocol Buffers compiler)
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install coveralls
run: |
curl -L https://coveralls.io/coveralls-linux.tar.gz | sudo tar -xz -C /usr/local/bin
- name: Run code coverage using external script
# Define repo level variable
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
SKIP_CRATE: ${{ vars.SKIP_CRATE }}
run: |
chmod u+x scripts/run_coverage.sh
./scripts/run_coverage.sh