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:
workflow_dispatch:
pull_request:
branches:
- main
@ -11,48 +12,33 @@ on:
jobs:
coverage:
name: Coverage
name: Coverage (+nightly)
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v2.4.0
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7
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
profile: minimal
components: llvm-tools-preview
- name: Install rustfilt symbol demangler
run: |
cargo install rustfilt
- name: Install cargo-llvm-cov cargo command
run: cargo install cargo-llvm-cov
- name: Rerun tests for coverage
env:
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: Run tests
run: cargo llvm-cov --lcov --no-report
- name: Merge coverage data
run: |
$(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: Generate coverage report
run: cargo llvm-cov --lcov --no-run --output-path lcov.info
- 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
macro: yes
# comment:
# layout: "diff"
# # if true: only post the comment if coverage changes
# require_changes: true
# This turns off the extra comment; the coverage %'s are still
# reported on the main PR page as check results
comment: false
comment:
layout: "diff"
# post a coverage comment, even if coverage hasn't changed
require_changes: false
github_checks:
annotations: false

View File

@ -8,10 +8,8 @@
// - Deirdre Connolly <deirdre@zfnd.org>
// - 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)]
#![doc = include_str!("../README.md")]
//! Docs require the `nightly` feature until RFC 1990 lands.