+79 -0 +/-2 browse
1 | diff --git a/.github/grcov.yml b/.github/grcov.yml |
2 | new file mode 100644 |
3 | index 0000000..0d3400d |
4 | --- /dev/null |
5 | +++ b/.github/grcov.yml |
6 | @@ -0,0 +1,5 @@ |
7 | + ignore-not-existing: true |
8 | + branch: true |
9 | + output-type: html |
10 | + binary-path: ./target/debug/ |
11 | + output-path: ./target/debug/coverage/ |
12 | diff --git a/.github/workflows/grcov.yaml b/.github/workflows/grcov.yaml |
13 | new file mode 100644 |
14 | index 0000000..1974f0a |
15 | --- /dev/null |
16 | +++ b/.github/workflows/grcov.yaml |
17 | @@ -0,0 +1,74 @@ |
18 | + name: Code coverage |
19 | + |
20 | + env: |
21 | + RUST_BACKTRACE: 1 |
22 | + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
23 | + |
24 | + on: |
25 | + workflow_dispatch: |
26 | + workflow_run: |
27 | + workflows: [Tests] |
28 | + types: [completed] |
29 | + branches: [main] |
30 | + |
31 | + jobs: |
32 | + on-success: |
33 | + runs-on: ubuntu-latest |
34 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
35 | + steps: |
36 | + - uses: actions/checkout@v1 |
37 | + - id: cache-rustup |
38 | + name: Cache Rust toolchain |
39 | + uses: actions/cache@v3 |
40 | + with: |
41 | + path: ~/.rustup |
42 | + key: toolchain-grcov |
43 | + - id: cache-cargo |
44 | + name: Cache Cargo |
45 | + uses: actions/cache@v3 |
46 | + with: |
47 | + path: ~/.cargo |
48 | + key: cargo-grcov |
49 | + - uses: actions-rs/toolchain@v1 |
50 | + with: |
51 | + toolchain: nightly |
52 | + override: true |
53 | + - uses: actions-rs/cargo@v1 |
54 | + with: |
55 | + command: test |
56 | + args: --all --all-features --no-fail-fast |
57 | + env: |
58 | + CARGO_INCREMENTAL: '0' |
59 | + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
60 | + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' |
61 | + - uses: actions-rs/grcov@v0.1 |
62 | + with: |
63 | + config: .github/grcov.yml |
64 | + - name: Copy artifacts |
65 | + run: | |
66 | + mkdir -p "_site" |
67 | + cp -r target/debug/coverage _site/ |
68 | + - name: Upload report |
69 | + uses: actions/upload-pages-artifact@v1 |
70 | + deploy: |
71 | + # Add a dependency to the build job |
72 | + needs: on-success |
73 | + |
74 | + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment |
75 | + permissions: |
76 | + pages: write # to deploy to Pages |
77 | + id-token: write # to verify the deployment originates from an appropriate source |
78 | + |
79 | + # Deploy to the github-pages environment |
80 | + environment: |
81 | + name: github-pages |
82 | + url: ${{ steps.deployment.outputs.page_url }} |
83 | + |
84 | + # Specify runner + deployment step |
85 | + runs-on: ubuntu-latest |
86 | + steps: |
87 | + - name: Deploy to GitHub Pages |
88 | + id: deployment |
89 | + uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action |
90 | + |
91 | + |