Update the include_str support to fix CI on nightly (#12)

* Update the include_str support to fix CI on nightly

* Upgrade coverage.yaml to use cargo-llvm-cov

* Show CodeCov comment on PRs
This commit is contained in:
Deirdre Connolly 2022-01-19 17:42:12 -05:00 committed by GitHub
parent 7b1229a692
commit 093087eb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 44 deletions

View File

@ -1,6 +1,7 @@
name: CI name: Coverage
on: on:
workflow_dispatch:
pull_request: pull_request:
branches: branches:
- main - main
@ -11,48 +12,33 @@ on:
jobs: jobs:
coverage: coverage:
name: Coverage name: Coverage (+nightly)
timeout-minutes: 30 timeout-minutes: 30
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.4.0
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7 - uses: actions-rs/toolchain@v1.0.7
with: with:
toolchain: nightly # Pinned to workaround issue making cargo-llvm-cov fail, see
# https://github.com/taiki-e/cargo-llvm-cov/issues/128
# TODO: restore to just `nightly` after it's fixed
toolchain: nightly-2022-01-14
override: true override: true
profile: minimal profile: minimal
components: llvm-tools-preview components: llvm-tools-preview
- name: Install rustfilt symbol demangler - name: Install cargo-llvm-cov cargo command
run: | run: cargo install cargo-llvm-cov
cargo install rustfilt
- name: Rerun tests for coverage - name: Run tests
env: run: cargo llvm-cov --lcov --no-report
RUSTFLAGS: -Zinstrument-coverage -C link-dead-code -C debuginfo=2
LLVM_PROFILE_FILE: "${{ github.workspace }}/test.%p.profraw"
ZEBRA_SKIP_NETWORK_TESTS: 1
run: |
cargo test
cargo test --no-run --message-format=json | jq -r "select(.profile.test == true) | .filenames[]" | grep -v dSYM - > filenames.txt
- name: Merge coverage data - name: Generate coverage report
run: | run: cargo llvm-cov --lcov --no-run --output-path lcov.info
$(rustc --print target-libdir)/../bin/llvm-profdata merge test.*.profraw -o test.profdata
- name: Generate detailed html coverage report for github artifact
run: |
$(rustc --print target-libdir)/../bin/llvm-cov show -format=html -ignore-filename-regex=".*/.cargo/registry/.*" -ignore-filename-regex=".*/.cargo/git/.*" -ignore-filename-regex=".*/.rustup/.*" -Xdemangler=rustfilt -show-instantiations -output-dir=./coverage -instr-profile=./test.profdata $(printf -- "-object %s " $(cat filenames.txt))
- uses: actions/upload-artifact@v2
with:
name: coverage
path: ./coverage
- name: Generate lcov coverage report for codecov
run: |
$(rustc --print target-libdir)/../bin/llvm-cov export -format=lcov -instr-profile=test.profdata $(printf -- "-object %s " $(cat filenames.txt)) > "lcov.info"
- name: Upload coverage report to Codecov - name: Upload coverage report to Codecov
uses: codecov/codecov-action@v1.5.2 uses: codecov/codecov-action@v2.1.0

View File

@ -16,14 +16,10 @@ parsers:
method: yes method: yes
macro: yes macro: yes
# comment: comment:
# layout: "diff" layout: "diff"
# # if true: only post the comment if coverage changes # post a coverage comment, even if coverage hasn't changed
# require_changes: true require_changes: false
# This turns off the extra comment; the coverage %'s are still
# reported on the main PR page as check results
comment: false
github_checks: github_checks:
annotations: false annotations: false

View File

@ -8,10 +8,8 @@
// - Deirdre Connolly <deirdre@zfnd.org> // - Deirdre Connolly <deirdre@zfnd.org>
// - Henry de Valence <hdevalence@hdevalence.ca> // - Henry de Valence <hdevalence@hdevalence.ca>
#![doc(html_root_url = "https://docs.rs/reddsa/0.1.0")]
#![cfg_attr(feature = "nightly", feature(external_doc))]
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
#![deny(missing_docs)] #![deny(missing_docs)]
#![doc = include_str!("../README.md")]
//! Docs require the `nightly` feature until RFC 1990 lands. //! Docs require the `nightly` feature until RFC 1990 lands.