Author: Manos Pitsidianakis [manos@pitsidianak.is]
Hash: 090b72711ba2dcc2baff8634970a59312a751e37
Timestamp: Mon, 24 Apr 2023 17:17:36 +0000 (1 year ago)

+100 -0 +/-2 browse
Add grcov workflow
1diff --git a/.github/grcov.yml b/.github/grcov.yml
2new file mode 100644
3index 0000000..7318d94
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: ./coverage/
12 diff --git a/.github/workflows/grcov.yaml b/.github/workflows/grcov.yaml
13new file mode 100644
14index 0000000..88f9544
15--- /dev/null
16+++ b/.github/workflows/grcov.yaml
17 @@ -0,0 +1,95 @@
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 #if: ${{ github.event.workflow_run.conclusion == 'success' }}
34+ steps:
35+ - uses: actions/checkout@v1
36+ - id: cache-rustup
37+ name: Cache Rust toolchain
38+ uses: actions/cache@v3
39+ with:
40+ path: ~/.rustup
41+ key: toolchain-grcov
42+ - id: cache-cargo
43+ name: Cache Cargo
44+ uses: actions/cache@v3
45+ with:
46+ path: ~/.cargo
47+ key: cargo-grcov
48+ - uses: actions-rs/toolchain@v1
49+ with:
50+ toolchain: nightly
51+ override: true
52+ - uses: actions-rs/cargo@v1
53+ with:
54+ command: test
55+ args: --all --all-features --no-fail-fast
56+ env:
57+ CARGO_INCREMENTAL: '0'
58+ RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
59+ RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
60+ - uses: actions-rs/grcov@v0.1
61+ with:
62+ config: .github/grcov.yml
63+ - name: Upload report artifacts
64+ uses: actions/upload-artifact@v3
65+ with:
66+ name: report
67+ path: coverage
68+
69+ deploy:
70+ # Add a dependency to the build job
71+ needs: on-success
72+
73+ # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
74+ permissions:
75+ pages: write # to deploy to Pages
76+ id-token: write # to verify the deployment originates from an appropriate source
77+
78+ # Deploy to the github-pages environment
79+ environment:
80+ name: github-pages
81+ url: ${{ steps.deployment.outputs.page_url }}
82+
83+ # Specify runner + deployment step
84+ runs-on: ubuntu-latest
85+ steps:
86+ - name: Deploy to GitHub Pages
87+ id: deployment
88+ uses: actions/checkout@v3
89+ with:
90+ ref: 'gh-pages'
91+ token: ${{ secrets.GRCOVGHPAGES }}
92+ - name: Download coverage data
93+ id: download
94+ uses: actions/download-artifact@v3
95+ with:
96+ name: report
97+ path: coverage
98+ - name: 'Echo download path'
99+ run: echo ${{steps.download.outputs.download-path}}
100+ - name: Display structure of downloaded files
101+ run: ls -R
102+ - name: Push
103+ run: |
104+ git config --global user.name 'Github Actions'
105+ git config --global user.email 'actions@users.noreply.github.com'
106+ git show-ref
107+ git add coverage
108+ git commit -m "Update grcov report"
109+ git show-ref
110+ git branch --verbose
111+ git remote set-url origin "https://${{github.actor}}:${{ secrets.GRCOVGHPAGES }}@github.com/${{github.repository}}.git"
112+ git push