forked from DSRCorporation/cargo-test-xunit
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 1.78 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
name: Test
"on":
pull_request:
push:
branches:
- master
jobs:
test:
name: Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
# coverage action needs a nightly toolchain
# @Swatinem/fucov needs with llvm-tools
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
# components: llvm-tools-preview
# runs cargo with defaults flags, using the default `lcov` output
# uses: Swatinem/fucov@v1
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast # Customize args for your own needs
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- name: Run coverage
id: coverage
uses: actions-rs/grcov@v0.1
- name: Fix coverage action output
id: strip-linefeed
run: |
export stripped=$(echo ${{ steps.coverage.outputs.report }} | tr -d '\n')
echo ::set-output name=filename::$stripped
- name: Move coverage file
run: |
mv ${{ steps.strip-linefeed.outputs.filename }} ./coverage.xml
- name: Report test coverage to DeepSource
uses: deepsourcelabs/test-coverage-action@master
with:
key: rust
coverage-file: coverage.xml
dsn: ${{ secrets.DEEPSOURCE_DSN }}
fail-ci-on-error: true