Merge pull request #1476 from rivy/rf.reorg-codecover

refactor ~ improve code coverage implementation
This commit is contained in:
Sylvestre Ledru
2020-04-14 23:28:51 +02:00
committed by GitHub
268 changed files with 736 additions and 538 deletions
+98 -32
View File
@@ -1,10 +1,10 @@
name: CICD
# spell-checker:ignore (acronyms) CICD MSVC musl
# spell-checker:ignore (env/flags) Ccodegen Cinline Coverflow RUSTFLAGS
# spell-checker:ignore (env/flags) Ccodegen Coverflow RUSTFLAGS
# spell-checker:ignore (jargon) SHAs deps softprops toolchain
# spell-checker:ignore (names) CodeCOV MacOS MinGW Peltoche rivy
# spell-checker:ignore (shell/tools) choco clippy dmake esac fakeroot gmake grcov halium libssl mkdir popd printf pushd rustc rustfmt rustup shopt
# spell-checker:ignore (shell/tools) choco clippy dmake esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rustc rustfmt rustup shopt
# spell-checker:ignore (misc) alnum gnueabihf issuecomment maint nullglob onexitbegin onexitend uutils
@@ -254,6 +254,10 @@ jobs:
shell: bash
run: |
# Info
## commit info
echo "## commit"
echo GITHUB_REF=${GITHUB_REF}
echo GITHUB_SHA=${GITHUB_SHA}
## tooling info display
echo "## tooling"
which gcc >/dev/null 2>&1 && (gcc --version | head -1) || true
@@ -317,7 +321,10 @@ jobs:
fail-fast: true
matrix:
# job: [ { os: ubuntu-latest }, { os: macos-latest }, { os: windows-latest } ]
job: [ { os: ubuntu-latest } ] ## cargo-tarpaulin is currently only available on linux
job:
- { os: ubuntu-latest , features: unix }
- { os: macos-latest , features: unix }
- { os: windows-latest , features: windows , toolchain: nightly-x86_64-pc-windows-gnu }
steps:
- uses: actions/checkout@v1
# - name: Reattach HEAD ## may be needed for accurate code coverage info
@@ -326,41 +333,100 @@ jobs:
id: vars
shell: bash
run: |
## VARs setup
# toolchain
TOOLCHAIN="nightly" ## default to "nightly" toolchain (required for certain needed compiler flags)
# * use requested TOOLCHAIN if specified
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
# * use requested TOOLCHAIN if specified
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
echo set-output name=TOOLCHAIN::${TOOLCHAIN}
echo ::set-output name=TOOLCHAIN::${TOOLCHAIN}
# staging directory
STAGING='_staging'
echo set-output name=STAGING::${STAGING}
echo ::set-output name=STAGING::${STAGING}
# check for CODECOV_TOKEN availability (work-around for inaccessible 'secrets' object for 'if'; see <https://github.community/t5/GitHub-Actions/jobs-lt-job-id-gt-if-does-not-work-with-env-secrets/m-p/38549>)
unset HAS_CODECOV_TOKEN
if [ -n $CODECOV_TOKEN ]; then HAS_CODECOV_TOKEN='true' ; fi
echo set-output name=HAS_CODECOV_TOKEN::${HAS_CODECOV_TOKEN}
echo ::set-output name=HAS_CODECOV_TOKEN::${HAS_CODECOV_TOKEN}
## # check for CODECOV_TOKEN availability (work-around for inaccessible 'secrets' object for 'if'; see <https://github.community/t5/GitHub-Actions/jobs-lt-job-id-gt-if-does-not-work-with-env-secrets/m-p/38549>)
## # note: CODECOV_TOKEN / HAS_CODECOV_TOKEN is not needed for public repositories when using AppVeyor, Azure Pipelines, CircleCI, GitHub Actions, Travis (see <https://docs.codecov.io/docs/about-the-codecov-bash-uploader#section-upload-token>)
## unset HAS_CODECOV_TOKEN
## if [ -n $CODECOV_TOKEN ]; then HAS_CODECOV_TOKEN='true' ; fi
## echo set-output name=HAS_CODECOV_TOKEN::${HAS_CODECOV_TOKEN}
## echo ::set-output name=HAS_CODECOV_TOKEN::${HAS_CODECOV_TOKEN}
# target-specific options
# * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='--all-features' ; ## default to '--all-features' for code coverage
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
echo set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION}
echo ::set-output name=CARGO_FEATURES_OPTION::${CARGO_FEATURES_OPTION}
# * CODECOV_FLAGS
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
echo set-output name=CODECOV_FLAGS::${CODECOV_FLAGS}
echo ::set-output name=CODECOV_FLAGS::${CODECOV_FLAGS}
- name: rust toolchain ~ install
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
default: true
profile: minimal # minimal component installation (ie, no documentation)
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
- name: Create all needed build/work directories
CARGO_INCREMENTAL: '0'
RUSTC_WRAPPER: ''
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: "`grcov` ~ install"
uses: actions-rs/install@v0.1
with:
crate: grcov
version: latest
use-tool-cache: true
- name: "`grcov` ~ display coverage files" ## (for debugging)
shell: bash
run: |
## create build/work space
mkdir -p '${{ steps.vars.outputs.STAGING }}/work'
- name: Install required packages
# display coverage files (per `grcov`)
grcov . --output-type files | sort --unique
- name: "`grcov` ~ configure + fixups" ## note: fixups, when needed, must be done *after* testing so that coverage files exist for renaming
shell: bash
run: |
sudo apt-get -y install libssl-dev
pushd '${{ steps.vars.outputs.STAGING }}/work' >/dev/null
wget --no-verbose https://github.com/xd009642/tarpaulin/releases/download/0.9.3/cargo-tarpaulin-0.9.3-travis.tar.gz
tar xf cargo-tarpaulin-0.9.3-travis.tar.gz
cp cargo-tarpaulin "$(dirname -- "$(which cargo)")"/
popd >/dev/null
- name: Generate coverage
# create `grcov` configuration file
GRCOV_CONFIG_DIR="${GITHUB_WORKSPACE}/.github/actions-rs"
mkdir -p "${GRCOV_CONFIG_DIR}"
GRCOV_CONFIG_FILE="${GRCOV_CONFIG_DIR}/grcov.yml"
echo "branch: true" >> "${GRCOV_CONFIG_FILE}"
echo "ignore:" >> "${GRCOV_CONFIG_FILE}"
echo "- \"build.rs\"" >> "${GRCOV_CONFIG_FILE}"
echo "- \"/*\"" >> "${GRCOV_CONFIG_FILE}"
echo "- \"[a-zA-Z]:/*\"" >> "${GRCOV_CONFIG_FILE}"
cat "${GRCOV_CONFIG_FILE}"
# ## 'actions-rs/grcov@v0.1' expects coverage files (*.gc*) to be prefixed with the crate name (using '_' in place of '-')
# ## * uutils workspace packages
# prefix="uu_"
# for f in "target/debug/deps/uu_"*-*.gc* ; do to="${f/uu_/${PROJECT_NAME}-uu_}" ; mv "$f" "$to" ; echo "mv $f $to" ; done
# ## * tests
# for f in "target/debug/deps/tests"-*.gc* ; do to="${f/tests/${PROJECT_NAME}-tests}" ; mv "$f" "$to" ; echo "mv $f $to" ; done
# - name: Generate coverage data (via `grcov`)
# id: coverage
# uses: actions-rs/grcov@v0.1
- name: Generate coverage data (via `grcov`)
id: coverage
shell: bash
run: |
cargo tarpaulin --out Xml
- name: Upload coverage results (CodeCov.io)
# CODECOV_TOKEN (aka, "Repository Upload Token" for REPO from CodeCov.io) ## set via REPO/Settings/Secrets
# if: secrets.CODECOV_TOKEN (not supported {yet?}; see <https://github.community/t5/GitHub-Actions/jobs-lt-job-id-gt-if-does-not-work-with-env-secrets/m-p/38549>)
if: steps.vars.outputs.HAS_CODECOV_TOKEN
run: |
# CodeCov.io
cargo tarpaulin --out Xml
bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
# generate coverage data
COVERAGE_REPORT_DIR="target/debug"
COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info"
mkdir -p "${COVERAGE_REPORT_DIR}"
grcov . --output-type lcov --output-file "${COVERAGE_REPORT_FILE}" --branch ${GRCOV_IGNORE_OPTION} --ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*"
echo ::set-output name=report::${COVERAGE_REPORT_FILE}
- name: Upload coverage results (to Codecov.io)
uses: codecov/codecov-action@v1
# if: steps.vars.outputs.HAS_CODECOV_TOKEN
with:
# token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.coverage.outputs.report }}
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
name: codecov-umbrella
fail_ci_if_error: true
Generated
+163 -125
View File
File diff suppressed because it is too large Load Diff
+94 -94
View File
@@ -194,99 +194,99 @@ feat_common_core = [
[dependencies]
uucore = "0.0.2"
arch = { optional=true, path="src/arch" }
base32 = { optional=true, path="src/base32" }
base64 = { optional=true, path="src/base64" }
basename = { optional=true, path="src/basename" }
cat = { optional=true, path="src/cat" }
chgrp = { optional=true, path="src/chgrp" }
chmod = { optional=true, path="src/chmod" }
chown = { optional=true, path="src/chown" }
chroot = { optional=true, path="src/chroot" }
cksum = { optional=true, path="src/cksum" }
comm = { optional=true, path="src/comm" }
cp = { optional=true, path="src/cp" }
cut = { optional=true, path="src/cut" }
date = { optional=true, path="src/date" }
dircolors= { optional=true, path="src/dircolors" }
dirname = { optional=true, path="src/dirname" }
du = { optional=true, path="src/du" }
echo = { optional=true, path="src/echo" }
env = { optional=true, path="src/env" }
expand = { optional=true, path="src/expand" }
expr = { optional=true, path="src/expr" }
factor = { optional=true, path="src/factor" }
false = { optional=true, path="src/false" }
fmt = { optional=true, path="src/fmt" }
fold = { optional=true, path="src/fold" }
groups = { optional=true, path="src/groups" }
hashsum = { optional=true, path="src/hashsum" }
head = { optional=true, path="src/head" }
hostid = { optional=true, path="src/hostid" }
hostname = { optional=true, path="src/hostname" }
id = { optional=true, path="src/id" }
install = { optional=true, path="src/install" }
join = { optional=true, path="src/join" }
kill = { optional=true, path="src/kill" }
link = { optional=true, path="src/link" }
ln = { optional=true, path="src/ln" }
ls = { optional=true, path="src/ls" }
logname = { optional=true, path="src/logname" }
mkdir = { optional=true, path="src/mkdir" }
mkfifo = { optional=true, path="src/mkfifo" }
mknod = { optional=true, path="src/mknod" }
mktemp = { optional=true, path="src/mktemp" }
more = { optional=true, path="src/more" }
mv = { optional=true, path="src/mv" }
nice = { optional=true, path="src/nice" }
nl = { optional=true, path="src/nl" }
nohup = { optional=true, path="src/nohup" }
nproc = { optional=true, path="src/nproc" }
numfmt = { optional=true, path="src/numfmt" }
od = { optional=true, path="src/od" }
paste = { optional=true, path="src/paste" }
pathchk = { optional=true, path="src/pathchk" }
pinky = { optional=true, path="src/pinky" }
printenv = { optional=true, path="src/printenv" }
printf = { optional=true, path="src/printf" }
ptx = { optional=true, path="src/ptx" }
pwd = { optional=true, path="src/pwd" }
readlink = { optional=true, path="src/readlink" }
realpath = { optional=true, path="src/realpath" }
relpath = { optional=true, path="src/relpath" }
rm = { optional=true, path="src/rm" }
rmdir = { optional=true, path="src/rmdir" }
seq = { optional=true, path="src/seq" }
shred = { optional=true, path="src/shred" }
shuf = { optional=true, path="src/shuf" }
sleep = { optional=true, path="src/sleep" }
sort = { optional=true, path="src/sort" }
split = { optional=true, path="src/split" }
stat = { optional=true, path="src/stat" }
stdbuf = { optional=true, path="src/stdbuf" }
sum = { optional=true, path="src/sum" }
sync = { optional=true, path="src/sync" }
tac = { optional=true, path="src/tac" }
tail = { optional=true, path="src/tail" }
tee = { optional=true, path="src/tee" }
test = { optional=true, path="src/test" }
timeout = { optional=true, path="src/timeout" }
touch = { optional=true, path="src/touch" }
tr = { optional=true, path="src/tr" }
true = { optional=true, path="src/true" }
truncate = { optional=true, path="src/truncate" }
tsort = { optional=true, path="src/tsort" }
tty = { optional=true, path="src/tty" }
uname = { optional=true, path="src/uname" }
unexpand = { optional=true, path="src/unexpand" }
uniq = { optional=true, path="src/uniq" }
unlink = { optional=true, path="src/unlink" }
uptime = { optional=true, path="src/uptime" }
users = { optional=true, path="src/users" }
wc = { optional=true, path="src/wc" }
who = { optional=true, path="src/who" }
whoami = { optional=true, path="src/whoami" }
yes = { optional=true, path="src/yes" }
arch = { optional=true, path="src/uu/arch" }
base32 = { optional=true, path="src/uu/base32" }
base64 = { optional=true, path="src/uu/base64" }
basename = { optional=true, path="src/uu/basename" }
cat = { optional=true, path="src/uu/cat" }
chgrp = { optional=true, path="src/uu/chgrp" }
chmod = { optional=true, path="src/uu/chmod" }
chown = { optional=true, path="src/uu/chown" }
chroot = { optional=true, path="src/uu/chroot" }
cksum = { optional=true, path="src/uu/cksum" }
comm = { optional=true, path="src/uu/comm" }
cp = { optional=true, path="src/uu/cp" }
cut = { optional=true, path="src/uu/cut" }
date = { optional=true, path="src/uu/date" }
dircolors= { optional=true, path="src/uu/dircolors" }
dirname = { optional=true, path="src/uu/dirname" }
du = { optional=true, path="src/uu/du" }
echo = { optional=true, path="src/uu/echo" }
env = { optional=true, path="src/uu/env" }
expand = { optional=true, path="src/uu/expand" }
expr = { optional=true, path="src/uu/expr" }
factor = { optional=true, path="src/uu/factor" }
false = { optional=true, path="src/uu/false" }
fmt = { optional=true, path="src/uu/fmt" }
fold = { optional=true, path="src/uu/fold" }
groups = { optional=true, path="src/uu/groups" }
hashsum = { optional=true, path="src/uu/hashsum" }
head = { optional=true, path="src/uu/head" }
hostid = { optional=true, path="src/uu/hostid" }
hostname = { optional=true, path="src/uu/hostname" }
id = { optional=true, path="src/uu/id" }
install = { optional=true, path="src/uu/install" }
join = { optional=true, path="src/uu/join" }
kill = { optional=true, path="src/uu/kill" }
link = { optional=true, path="src/uu/link" }
ln = { optional=true, path="src/uu/ln" }
ls = { optional=true, path="src/uu/ls" }
logname = { optional=true, path="src/uu/logname" }
mkdir = { optional=true, path="src/uu/mkdir" }
mkfifo = { optional=true, path="src/uu/mkfifo" }
mknod = { optional=true, path="src/uu/mknod" }
mktemp = { optional=true, path="src/uu/mktemp" }
more = { optional=true, path="src/uu/more" }
mv = { optional=true, path="src/uu/mv" }
nice = { optional=true, path="src/uu/nice" }
nl = { optional=true, path="src/uu/nl" }
nohup = { optional=true, path="src/uu/nohup" }
nproc = { optional=true, path="src/uu/nproc" }
numfmt = { optional=true, path="src/uu/numfmt" }
od = { optional=true, path="src/uu/od" }
paste = { optional=true, path="src/uu/paste" }
pathchk = { optional=true, path="src/uu/pathchk" }
pinky = { optional=true, path="src/uu/pinky" }
printenv = { optional=true, path="src/uu/printenv" }
printf = { optional=true, path="src/uu/printf" }
ptx = { optional=true, path="src/uu/ptx" }
pwd = { optional=true, path="src/uu/pwd" }
readlink = { optional=true, path="src/uu/readlink" }
realpath = { optional=true, path="src/uu/realpath" }
relpath = { optional=true, path="src/uu/relpath" }
rm = { optional=true, path="src/uu/rm" }
rmdir = { optional=true, path="src/uu/rmdir" }
seq = { optional=true, path="src/uu/seq" }
shred = { optional=true, path="src/uu/shred" }
shuf = { optional=true, path="src/uu/shuf" }
sleep = { optional=true, path="src/uu/sleep" }
sort = { optional=true, path="src/uu/sort" }
split = { optional=true, path="src/uu/split" }
stat = { optional=true, path="src/uu/stat" }
stdbuf = { optional=true, path="src/uu/stdbuf" }
sum = { optional=true, path="src/uu/sum" }
sync = { optional=true, path="src/uu/sync" }
tac = { optional=true, path="src/uu/tac" }
tail = { optional=true, path="src/uu/tail" }
tee = { optional=true, path="src/uu/tee" }
test = { optional=true, path="src/uu/test" }
timeout = { optional=true, path="src/uu/timeout" }
touch = { optional=true, path="src/uu/touch" }
tr = { optional=true, path="src/uu/tr" }
true = { optional=true, path="src/uu/true" }
truncate = { optional=true, path="src/uu/truncate" }
tsort = { optional=true, path="src/uu/tsort" }
tty = { optional=true, path="src/uu/tty" }
uname = { optional=true, path="src/uu/uname" }
unexpand = { optional=true, path="src/uu/unexpand" }
uniq = { optional=true, path="src/uu/uniq" }
unlink = { optional=true, path="src/uu/unlink" }
uptime = { optional=true, path="src/uu/uptime" }
users = { optional=true, path="src/uu/users" }
wc = { optional=true, path="src/uu/wc" }
who = { optional=true, path="src/uu/who" }
whoami = { optional=true, path="src/uu/whoami" }
yes = { optional=true, path="src/uu/yes" }
#
# * transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0
backtrace = ">= 0.3.3, <= 0.3.30"
@@ -308,7 +308,7 @@ unix_socket = "0.5.0"
[[bin]]
name = "uutils"
path = "src/uutils/uutils.rs"
path = "src/bin/uutils.rs"
[[test]]
name = "tests"
@@ -3,11 +3,11 @@ name = "arch"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_arch"
path = "arch.rs"
path = "src/arch.rs"
[dependencies]
platform-info = "0.0.1"
@@ -15,4 +15,4 @@ uucore = "0.0.2"
[[bin]]
name = "arch"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"
@@ -3,11 +3,11 @@ name = "base32"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_base32"
path = "base32.rs"
path = "src/base32.rs"
[dependencies]
uucore = { version = "0.0.2", features = ["encoding"] }
@@ -16,4 +16,4 @@ clippy = { version = "0.0.212", optional = true }
[[bin]]
name = "base32"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"
@@ -12,7 +12,7 @@
extern crate uucore;
use uucore::encoding::Format;
#[path = "../base64/base_common.rs"]
#[path = "../../base64/src/base_common.rs"]
mod base_common;
static SYNTAX: &str = "[OPTION]... [FILE]";
@@ -3,15 +3,15 @@ name = "base64"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_base64"
path = "base64.rs"
path = "src/base64.rs"
[dependencies]
uucore = { version = "0.0.2", features = ["encoding"] }
[[bin]]
name = "base64"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"
@@ -3,15 +3,15 @@ name = "basename"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_basename"
path = "basename.rs"
path = "src/basename.rs"
[dependencies]
uucore = "0.0.2"
[[bin]]
name = "basename"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"
+3 -3
View File
@@ -3,11 +3,11 @@ name = "cat"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_cat"
path = "cat.rs"
path = "src/cat.rs"
[dependencies]
quick-error = "1.2.3"
@@ -18,4 +18,4 @@ unix_socket = "0.5.0"
[[bin]]
name = "cat"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"
View File
@@ -3,11 +3,11 @@ name = "chgrp"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_chgrp"
path = "chgrp.rs"
path = "src/chgrp.rs"
[dependencies]
uucore = { version = "0.0.2", features = ["entries", "fs"] }
@@ -15,4 +15,4 @@ walkdir = "2.2.8"
[[bin]]
name = "chgrp"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"
@@ -3,11 +3,11 @@ name = "chmod"
version = "0.0.1"
authors = []
license = "MIT"
build = "../#common/mkmain.rs"
build = "../../common/mkmain.rs"
[lib]
name = "uu_chmod"
path = "chmod.rs"
path = "src/chmod.rs"
[dependencies]
libc = "0.2.42"
@@ -16,4 +16,4 @@ walker = "1.0.0"
[[bin]]
name = "chmod"
path = "../#common/uumain.rs"
path = "../../common/uumain.rs"

Some files were not shown because too many files have changed in this diff Show More