-
Notifications
You must be signed in to change notification settings - Fork 10
64 lines (53 loc) · 2.13 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
name: Code Coverage
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
env:
CARGO_TERM_COLOR: always
jobs:
code-coverage:
permissions:
contents: write
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'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use nightly toolchain
run: |
rustup toolchain install nightly
rustup override set nightly
- name: Caching cargo dependencies
id: project-cache
uses: Swatinem/rust-cache@v2
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
name: Install grcov
run: cargo install grcov
- name: Make the USER own the working directory
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo chown -R $USER:$USER ${{ github.workspace }}
- name: Run tests
working-directory: zork++
run: |
cargo test --all-features --no-fail-fast --target=x86_64-unknown-linux-gnu -- --show-output --test-threads=1
- name: Generate code coverage report
working-directory: zork++
run: |
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage
grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore-not-existing -o ./target/debug/coverage/code_cov.xml
- name: Publish Test Results
uses: actions/upload-artifact@v3
with:
name: Unit Test Results
path: |
./zork++/target/debug/coverage/code_cov.xml
./zork++/target/debug/coverage/index.html
- name: Publish coverage report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./zork++/target/debug/coverage
token: ${{ secrets.GITHUB_TOKEN }}