-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (56 loc) · 1.69 KB
/
rust-test.yml
File metadata and controls
68 lines (56 loc) · 1.69 KB
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
66
67
68
---
name: Rust
"on":
workflow_call:
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
outputs:
collect_coverage: ${{ steps.coverage.outputs.enable }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache build artifacts
uses: swatinem/rust-cache@v2.7.8
- name: Determine whether to measure test coverage
id: coverage
run: |
if [[ "${{ secrets.CODECOV_TOKEN }}" != "" ]]; then
echo "Enable collection of test coverage"
echo "::set-output name=enable::true"
else
echo "Run tests without coverage"
echo "::set-output name=enable::false"
fi
- name: Run tests
uses: actions-rs/cargo@v1
if: ${{ steps.coverage.outputs.enable != 'true' }}
with:
command: test
args: --verbose
- name: Run tests with test coverage
uses: actions-rs/tarpaulin@master
if: ${{ steps.coverage.outputs.enable == 'true' }}
with:
args: --skip-clean
version: 0.20.0
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
if: ${{ steps.coverage.outputs.enable == 'true' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive code coverage results
uses: actions/upload-artifact@v4
if: ${{ steps.coverage.outputs.enable == 'true' }}
with:
name: code-coverage-report
path: cobertura.xml