-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.14 KB
/
unit-test.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
name: Rust Unit Tests
on:
workflow_call:
inputs:
upload_coverage:
description: 'Whether to upload coverage report to Codecov'
required: false
type: boolean
default: false
push: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
run: |
rustup toolchain install stable
rustup default stable
rustup component add llvm-tools-preview
- name: Install code coverage tool
uses: taiki-e/install-action@11f460a4042c6aedd95853e41f4eb4f10459fc5d # cargo-llvm-cov
- name: Run tests
run: cargo llvm-cov
- name: Generate coverage report
run: cargo llvm-cov report --lcov --output-path target/lcov.info
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
if: ${{ github.event.inputs == null || github.event.inputs.upload_coverage == true }}
with:
fail_ci_if_error: true
files: ./target/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}