summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Sitkevich <1553398+sitkevij@users.noreply.github.com>2020-11-07 20:49:58 -0800
committerGitHub <noreply@github.com>2020-11-07 20:49:58 -0800
commit57810e290468b3d9fedee51e8653b1260d865bfd (patch)
tree97f5236147322a5ae2d8ae14b2ca1718f271306a
parentdbc277273a62daf7d8f86cf917ad540a783be437 (diff)
parent1f750bbdb4be35311e73e5d87ba5acc784f35c79 (diff)
Merge pull request #45 from sitkevij/release/0.3.2
#44 add tarpaulin support
-rw-r--r--.github/workflows/ci.yml66
-rw-r--r--.gitignore4
-rw-r--r--.tarpaulin.toml5
-rw-r--r--Makefile11
-rw-r--r--src/lib.rs2
-rw-r--r--src/main.rs2
6 files changed, 86 insertions, 4 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..e4cd193
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,66 @@
+name: CI
+on:
+ pull_request:
+ push:
+ branches:
+ - develop
+ - main
+ - master
+
+env:
+ RUST_BACKTRACE: full
+
+jobs:
+ test:
+ name: Test Rust ${{ matrix.rust }} on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ continue-on-error: ${{ matrix.experimental }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - { rust: stable, os: ubuntu-latest, experimental: false }
+ - { rust: stable, os: macos-latest, experimental: false }
+ - { rust: stable, os: windows-latest, experimental: true }
+ - { rust: stable-i686-msvc, os: windows-latest, experimental: true }
+ - { rust: beta, os: ubuntu-latest, experimental: true }
+ - { rust: nightly, os: ubuntu-latest, experimental: true }
+ steps:
+ - uses: actions/checkout@v2
+ - uses: hecrj/setup-rust-action@v1
+ with:
+ rust-version: ${{ matrix.rust }}
+
+ - run: cargo build --verbose --all
+ - run: cargo build --release
+ - run: cargo test --verbose --all -- --nocapture
+ - run: cargo install hyperfine
+ - run: echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." | target/release/hx
+ - run: hyperfine --warmup 20 "echo 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' | target/release/hx"
+ # - run: cargo test --verbose --all -- --nocapture
+ # - run: cargo test --verbose --workspace --all-features
+ # - run: cargo test --verbose --workspace --no-default-features
+
+ clippy:
+ name: Lint with clippy
+ runs-on: ubuntu-latest
+ env:
+ RUSTFLAGS: -Dwarnings
+ steps:
+ - uses: actions/checkout@v2
+ - uses: hecrj/setup-rust-action@v1
+ with:
+ components: clippy
+ - run: cargo clippy --workspace --all-targets --verbose
+ - run: cargo clippy --workspace --all-targets --verbose --no-default-features
+ - run: cargo clippy --workspace --all-targets --verbose --all-features
+
+ rustfmt:
+ name: Verify code formatting
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: hecrj/setup-rust-action@v1
+ with:
+ components: rustfmt
+ - run: cargo fmt --all -- --check
diff --git a/.gitignore b/.gitignore
index f6d549f..e87a0b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,7 @@
**/*.rs.bk
.DS_Store
+
+# ci code coverage
+tarpaulin-report.html
+cobertura.xml \ No newline at end of file
diff --git a/.tarpaulin.toml b/.tarpaulin.toml
new file mode 100644
index 0000000..d0e55d3
--- /dev/null
+++ b/.tarpaulin.toml
@@ -0,0 +1,5 @@
+[default]
+# Expected one of `Tests`, `Doctests`, `Benchmarks`, `Examples`, `Lib`, `Bins`, `AllTargets`
+run-types = ["Tests"]
+[report]
+out = ["Html", "Xml"]
diff --git a/Makefile b/Makefile
index 4f1d1df..975df64 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,15 @@ release: test
test:
cargo test --verbose --all -- --nocapture
+geiger:
+ # cargo install cargo-geiger
+ cargo geiger
+
+tarpaulin:
+ # use docker as tarpaulin only supports x86_64 processors running linux
+ docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin
+ open tarpaulin-report.html
+
grcov:
# grcov requires rust nightly for now
rm -rf target/debug/
@@ -35,9 +44,7 @@ grcov:
export RUSTDOCFLAGS="-Cpanic=abort" && \
cargo +nightly build
cargo +nightly test --verbose
- # generate html report
grcov ./target/debug/ -s . -t html --llvm --branch --ignore-not-existing -o ./target/debug/coverage/
- # open report
open target/debug/coverage/index.html
diff --git a/src/lib.rs b/src/lib.rs
index d53be51..04d1fde 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -335,11 +335,11 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<dyn Error>> {
/// # Arguments
///
/// * `matches` - argument matches.
+#[allow(clippy::absurd_extreme_comparisons)]
pub fn is_stdin(matches: ArgMatches) -> Result<bool, Box<dyn Error>> {
let mut is_stdin = false;
if DBG > 0 {
dbg!(env::args().len(), matches.args.len());
- dbg!(env::args().nth(0).unwrap());
}
if let Some(file) = matches.value_of(ARG_INP) {
if DBG > 0 {
diff --git a/src/main.rs b/src/main.rs
index bb14e61..d4a1063 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -92,7 +92,7 @@ fn main() {
ErrorKind::BrokenPipe => process::exit(0),
_ => false,
};
- if suppress_error == false {
+ if !suppress_error {
eprintln!(
"{} {}",
ansi_term::Colour::Fixed(9).bold().paint("error:"),