Giter VIP home page Giter VIP logo

cargo-travis's Introduction

Cargo Travis

Record total test coverage across in-crate and external tests, and upload to coveralls.io.

The goal is to eventually have feature parity with the assumed-dead travis-cargo

To avoid problems like this one, we link against the cargo crate directly and use its low-level operations. This should be much more reliable than the stdout capture approach. On the other hand, the cargo crate isn't stable, leading to things like this.

Installation

cargo install cargo-travis
export PATH=$HOME/.cargo/bin:$PATH

Example

A possible travis.yml configuration is:

sudo: required
language: rust

# Cache cargo symbols for faster build
cache: cargo

# Dependencies of kcov, used by coverage
addons:
  apt:
    packages:
      - libcurl4-openssl-dev
      - libelf-dev
      - libdw-dev
      - binutils-dev
      - cmake # also required for cargo-update
    sources:
      - kalakris-cmake

# run builds for all the trains (and more)
rust:
  - nightly
  - beta
  # check it compiles on the latest stable compiler
  - stable
  # and the first stable one (this should be bumped as the minimum
  # Rust version required changes)
  - 1.0.0

before_script:
  - export PATH=$HOME/.cargo/bin:$PATH
  - cargo install cargo-update || echo "cargo-update already installed"
  - cargo install cargo-travis || echo "cargo-travis already installed"
  - cargo install-update -a # update outdated cached binaries

# the main build
script:
  - |
      cargo build &&
      cargo test &&
      cargo bench &&
      cargo doc

after_success:
# measure code coverage and upload to coveralls.io
  - cargo coveralls
# upload documentation to github.io (gh-pages branch)
  - cargo doc-upload

See the cargo-update repository for details on cargo-update.

Note that sudo: required is necessary to use kcov. See this issue for more information.

Help

coverage

Record coverage of `cargo test`, this runs all binaries that `cargo test` runs
but not doc tests. The results of all tests are merged into a single directory

Usage:
    cargo coverage [options] [--] [<args>...]

Coverage Options:
    -V, --version                Print version info and exit
    -m PATH, --merge-into PATH   Path to the directory to put the final merged
                                 kcov result into [default: target/kcov]
    --exclude-pattern PATTERN    Comma-separated path patterns to exclude from the report
    --kcov-build-location PATH   Path to the directory in which to build kcov (into a new folder)
                                 [default: target] -- kcov ends up in target/kcov-master

Test Options:
    -h, --help                   Print this message
    --lib                        Test only this package's library
    --bin NAME                   Test only the specified binary
    --bins                       Test all binaries
    --test NAME                  Test only the specified integration test target
    --tests                      Test all tests
    --bench NAME ...             Test only the specified bench target
    --benches                    Test all benches
    --all-targets                Test all targets (default)
    -p SPEC, --package SPEC ...  Package to run tests for
    --all                        Test all packages in the workspace
    --exclude SPEC ...           Exclude packages from the test
    -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
    --release                    Build artifacts in release mode, with optimizations
    --features FEATURES          Space-separated list of features to also build
    --all-features               Build all available features
    --no-default-features        Do not build the `default` feature
    --target TRIPLE              Build for the target triple
    --manifest-path PATH         Path to the manifest to build tests for
    -v, --verbose ...            Use verbose output
    -q, --quiet                  No output printed to stdout
    --color WHEN                 Coloring: auto, always, never
    --no-fail-fast               Run all tests regardless of failure
    --frozen                     Require Cargo.lock and cache are up to date
    --locked                     Require Cargo.lock is up to date
    -Z FLAG ...                  Unstable (nightly-only) flags to Cargo

coveralls

Record coverage of `cargo test`, this runs all binaries that `cargo test` runs
but not doc tests. The results of all tests are sent to coveralls.io

Usage:
    cargo coveralls [options] [--] [<args>...]

Coveralls Options:
    -V, --version                Print version info and exit
    --exclude-pattern PATTERN    Comma-separated  path patterns to exclude from the report
    --kcov-build-location PATH   Path to the directory in which to build kcov (into a new folder)
                                 [default: target] -- kcov ends up in target/kcov-master

Test Options:
    -h, --help                   Print this message
    --lib                        Test only this package's library
    --bin NAME                   Test only the specified binary
    --bins                       Test all binaries
    --test NAME                  Test only the specified integration test target
    --tests                      Test all tests
    --bench NAME ...             Test only the specified bench target
    --benches                    Test all benches
    --all-targets                Test all targets (default)
    -p SPEC, --package SPEC ...  Package to run tests for
    --all                        Test all packages in the workspace
    --exclude SPEC ...           Exclude packages from the test
    -j N, --jobs N               Number of parallel jobs, defaults to # of CPUs
    --release                    Build artifacts in release mode, with optimizations
    --features FEATURES          Space-separated list of features to also build
    --all-features               Build all available features
    --no-default-features        Do not build the `default` feature
    --target TRIPLE              Build for the target triple
    --manifest-path PATH         Path to the manifest to build tests for
    -v, --verbose ...            Use verbose output
    -q, --quiet                  No output printed to stdout
    --color WHEN                 Coloring: auto, always, never
    --no-fail-fast               Run all tests regardless of failure
    --frozen                     Require Cargo.lock and cache are up to date
    --locked                     Require Cargo.lock is up to date
    -Z FLAG ...                  Unstable (nightly-only) flags to Cargo

doc-upload

Upload built rustdoc documentation to GitHub pages.

Usage:
    cargo doc-upload [options] [--] [<args>...]

Options:
    -V, --version                Print version info and exit
    --branch NAME ...            Only publish documentation for these branches
                                 Defaults to only the `master` branch
    --token TOKEN                Use the specified GitHub token to publish documentation
                                 If unspecified, checks $GH_TOKEN then attempts to use SSH endpoint
    --message MESSAGE            The message to include in the commit
    --deploy BRANCH              Deploy to the given branch [default: gh-pages]
    --path PATH                  Upload the documentation to the specified remote path [default: /$TRAVIS_BRANCH/]
    --clobber-index              Delete `index.html` from repo
    --target TRIPLE              Fetch the documentation for the target triple

The branch used for doc pushes may be protected, as force-push is not used. Documentation is maintained per-branch in subdirectories, so user.github.io/repo/PATH is where the master branch's documentation lives. PATH is by default the name of the branch, you can overwrite that behavior by passing a custom path into --path. A badge is generated too, like docs.rs, that is located at user.github.io/repo/master/badge.svg. Additionally a badge.json is generated, that corresponds to shields.io's endpoint. By default only master has documentation built, but you can build other branches' docs by passing any number of --branch NAME arguments (the presence of which will disable the default master branch build). Documentation is deployed from target/doc, the default target for rustdoc, so make sure to run cargo doc before cargo doc-upload, and you can build up whatever directory structure you want in there if you want to document with alternate configurations. If you need the documentation from a non-default target, you can pass the target triple into --target, which will then fetch it from target/TRIPLE/doc instead.

We suggest setting up a index.html in the root directory of documentation to redirect to the actual content. For this purpose we don't touch the root of the gh-pages branch (except to create the branch folders) and purposefully ignore index.html in the branch folders. You can opt out of this behaviour by passing --clobber-index. An index.html file might be created by using cargo rustdoc -- -Z unstable-options --enable-index-page (works only in rust nightly) or look like this:

<meta http-equiv="refresh" content="0; url=my_crate/index.html">
<a href="my_crate/index.html">Redirect</a>

This requires Travis to have write-access to your repository. The simplest (and reasonably secure) way to achieve this is to create a Personal API Access Token with public_repo scope. Then on travis, define the secure environment variable GH_TOKEN with the value being the new token.

This gives any script running on Travis permission to read/write public repositories that you can if they use it (on non-PR builds only, though keep in mind that bors staging/trying is not a PR build), so be aware of that. This does work for organization repositories as well, so long as the user's token has permission to write to it.

If you want more security, you can use a deploy key for repo-specific access. If you do not provide a token, the script will use SSH to clone from/write to the repository. Travis Pro handles the deploy key automatically, and regular users can use Travis encrypt-file plus a script to move the private key to the correct location.

cargo-travis's People

Contributors

cad97 avatar daxpedda avatar huonw avatar kurnevsky avatar petr-tik avatar roblabla avatar spease avatar tomasvdw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cargo-travis's Issues

Force debuginfo for `cargo coverage --release`

kcov relies on DWARF debuginfo, meaning that if one has a release profile with no debuginfo (like the default) cargo coverage --release won't be able to get any information at all. Thus, it's probably good for all coverage and coveralls builds to automatically pass -g or -C debuginfo=2.

Unfortunately, this seems to be difficult to work-around due to #44: something like RUSTFLAGS="-g" cargo coverage --release doesn't work.

Use cargo-metadata

Discussed in #34.

Instead of using cargo as a library (leading to problems like #51), we should use a cargo wrapper (like escargot). This will give us all the benefits of using cargo-as-a-library (proper error codes, no parsing of stdout/stderr stream) without the downside of it going stale.

README.md should suggest libiberty-dev as and apt addon package

The example in README.md lists several packages as dependencies of kcov, but does not list "libiberty-dev". The CMake.txt script used to configure the kcov build looks for "libiberty" as a part of finding the "BFD" library (see FindBfd.cmake at line 48).

This manifests as messages in the build log saying that "Could NOT find LIBBFD (missing: LIBBFD_IBERTY_LIBRARY)" when configuring kcov, and "WARNING: kcov has been built without libbfd-dev (or binutils-dev), so the --verify option will not do anything." when cargo coveralls runs kcov.

This is resolved by adding "libiberty-dev" as a package to be installed by the apt addon (see here).

If cargo coveralls requires the "--verify" flag on kcov then the example "travis.yml" file in README.md should list "libiberty-dev" as an apt package in the addon section.

fails to build on windows in cygwin64

Here the error using CARGO_TRACE=1

   Compiling syn v0.14.4
error: failed to run custom build command for `curl-sys v0.4.5`
process didn't exit successfully: `C:\Users\DRAGON~1\AppData\Local\Temp\cargo-installtFLJ6z\release\build\curl-sy
s-1bf5f2fbc00a73f8\build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=C:\Users\DRAGON~1\AppData\Local\Temp\cargo-installtFLJ6z\release\build\curl-sys-d3
c1fde99e11b48b\out/lib
cargo:rustc-link-lib=static=curl
cargo:root=C:\Users\DRAGON~1\AppData\Local\Temp\cargo-installtFLJ6z\release\build\curl-sys-d3c1fde99e11b48b\out
cargo:include=C:\Users\DRAGON~1\AppData\Local\Temp\cargo-installtFLJ6z\release\build\curl-sys-d3c1fde99e11b48b\ou
t/include
cargo:rustc-link-lib=ws2_32
cargo:rustc-link-lib=crypt32
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "sh" "/c/Users/Dragonaire/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/configure"
 "--with-winssl" "--enable-static=yes" "--enable-shared=no" "--enable-optimize" "--prefix=/c/Users/DRAGON~1/AppDa
ta/Local/Temp/cargo-installtFLJ6z/release/build/curl-sys-d3c1fde99e11b48b/out" "--without-nghttp2" "--without-lib
rtmp" "--without-libidn2" "--without-libssh2" "--without-libpsl" "--disable-ldap" "--disable-ldaps" "--disable-ft
p" "--disable-rtsp" "--disable-dict" "--disable-telnet" "--disable-tftp" "--disable-pop3" "--disable-imap" "--dis
able-smtp" "--disable-gopher" "--disable-manual" "--disable-smb" "--disable-sspi" "--disable-manual" "--disable-u
nix-sockets" "--disable-versioned-symbols" "--enable-hidden-symbols" "--disable-libcurl-option"

--- stderr
fatal: not a git repository (or any parent up to mount point /cygdrive)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
/usr/bin/sh: /c/Users/Dragonaire/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/configure: N
o such file or directory
thread 'main' panicked at '
command did not execute successfully, got: exit code: 127

build script failed, must exit now', C:\Users\Dragonaire\.cargo\registry\src\github.com-1ecc6299db9ec823\curl-sys
-0.4.5\build.rs:224:5
stack backtrace:
   0: std::sys::windows::backtrace::unwind_backtrace
             at libstd\sys\windows\backtrace/mod.rs:65
   1: std::sys_common::backtrace::print
             at libstd\sys_common/backtrace.rs:71
             at libstd\sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:511
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:426
   6: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:413
   7: build_script_build::fail
   8: build_script_build::run
   9: build_script_build::main
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  12: _rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  13: std::panic::catch_unwind
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
  14: std::rt::lang_start_internal
             at libstd/rt.rs:58
  15: main
  16: _tmainCRTStartup
  17: mainCRTStartup
  18: unit_addrs_search
  19: unit_addrs_search

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-travis v0.0.9`, intermediate artifacts can be found at `C:\Users\DRAGON~1\AppData
\Local\Temp\cargo-installtFLJ6z`

Caused by:
  build failed

cargo doc-upload fails but build succeeds?

See https://travis-ci.org/gnzlbg/slice_deque/jobs/330604987#L1460

I get this error:

GitHub Personal Access Token was not provided in $GH_TOKEN or --token
Falling back to using the SSH endpoint
Cloning into 'target/doc-upload'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

yet my build succeeds? :/

Also, I have a GH_TOKEN in my travis.yml file, any idea what could be going wrong?

binutils-dev isn't used

I copy pasted the required packages from the readme to my .travis.yml.

Coverage seems to work fine, but in the output I can see:

kcov: warning: kcov: WARNING: kcov has been built without libbfd-dev (or
kcov: binutils-dev), so the --verify option will not do anything.

even thought there should be binutils-dev installed.

travis log: https://travis-ci.org/WaDelma/poisson/jobs/276394285

Figure a way to not rebuild everything

This crate specifies a cargo version (0.13) in order to use its internal state instead of relying on stdout/stderr and hoping its output format stays the same.

This causes problems, however, since versions of cargo are not compatible with eachother. Meaning if, with cargo 0.12 installed, I did a cargo build followed by a cargo coverage, the coverage will trash all the work done by the build and recompile the world. This is because cargo versions are incompatible.

This wouldn't be a problem if I could specify the cargo version. But across releases, cargo versions are wildly incompatible.

It'd be nice if cargo had a stable core we could build tooling with.

Cargo-coverage will blow up if cargo build wasn't ran once

How to reproduce:

roblabla@roblab ~/tmp $ cargo new meh
     Created library `meh` project
roblabla@roblab ~/tmp $ cd meh/
roblabla@roblab ~/tmp/meh $ cargo coverage

Trace:

roblabla@roblab ~/tmp/meh $ env RUST_BACKTRACE=1 cargo coverage
Downloading kcov
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:402
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:349
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:72
   8: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::unwrap
             at /checkout/src/libcore/result.rs:782
  10: cargo_travis::build_kcov
             at /home/roblabla/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-travis-0.0.9/src/lib.rs:141
  11: cargo_coverage::execute
             at src/bin/cargo-coverage.rs:107
  12: cargo::call_main_without_stdin
             at /home/roblabla/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.22.0/src/cargo/lib.rs:128
  13: cargo_coverage::main::{{closure}}
             at src/bin/cargo-coverage.rs:194
  14: cargo_coverage::main
             at src/bin/cargo-coverage.rs:185
  15: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  16: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:306
  17: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  18: std::rt::lang_start_internal
             at libstd/panicking.rs:285
             at libstd/panic.rs:361
             at libstd/rt.rs:58
  19: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  20: main
  21: __libc_start_main
  22: _start

release pre-built binaries that work on travis

It would be awesome if we would have a script like rustup does for installing itself, that would just download pre-compiled binaries of cargo-travis that "just work" so that one does not have to compile it.

Github supports hosting binaries on releases (when a build is tagged as such), so maybe the script could just download the binary from here. The x86_64-unknown-linux-gnu target with everything statically linked would probably "just work".

Gather coverage from non-test runs

WebRender needs to test the coverage from (cd wrench && cargo run -- reftest) run under headless environment. We need a way to include this data. Just putting those tests into independent tests is not a good option, since recreating the context and reloading the shaders takes time.

Remove Docopt hack to avoid silent breaking change

Travis must have dumped my caches because it tried to rebuild and failed with 0.0.6.

I then went to install 0.0.7 but it failed in a similar manner:

error[E0277]: the trait bound `for<'de> Flags: serde::Deserialize<'de>` is not satisfied
   --> /home/epage/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.22.0/src/cargo/lib.rs:123:24
    |
123 |     let flags = docopt.deserialize().map_err(|e| {
    |                        ^^^^^^^^^^^ the trait `for<'de> serde::Deserialize<'de>` is not implemented for `Flags`
    |
    = help: consider adding a `where for<'de> Flags: serde::Deserialize<'de>` bound
    = note: required because of the requirements on the impl of `serde::de::DeserializeOwned` for `Flags`

error: aborting due to previous error

error: failed to compile `cargo-travis v0.0.7`, intermediate artifacts can be found at `/tmp/cargo-install.IOT9kQ0LNqB9`

For versions used:

   Updating registry `https://github.com/rust-
Downloading cargo-travis v0.0.7               
 Installing cargo-travis v0.0.7               
Downloading serde v1.0.27                     
Downloading log v0.3.9                        
Downloading serde_derive v1.0.27              
Downloading cargo v0.22.0                     
Downloading regex v0.2.5                      
Downloading log v0.4.1                        
Downloading regex-syntax v0.4.2               
Downloading serde_derive_internals v0.19.0    
Downloading libgit2-sys v0.6.18               
Downloading jobserver v0.1.8                  
Downloading git2 v0.6.10                      
Downloading num_cpus v1.8.0                   
Downloading tar v0.4.14                       
Downloading serde_json v1.0.9                 
Downloading docopt v0.8.2                     
Downloading crates-io v0.11.0                 
Downloading home v0.3.0                       
Downloading cmake v0.1.29                     
Downloading openssl v0.9.23                   
Downloading openssl-sys v0.9.23               
Downloading openssl-probe v0.1.2              
Downloading foreign-types v0.3.2              
Downloading foreign-types-shared v0.1.1       
  Compiling semver-parser v0.7.0              
  Compiling termcolor v0.3.3                  
  Compiling percent-encoding v1.0.1           
  Compiling void v1.0.2                       
  Compiling openssl-probe v0.1.2              
  Compiling home v0.3.0                       
  Compiling bitflags v0.9.1                   
  Compiling scoped-tls v0.1.0                 
  Compiling lazy_static v1.0.0                
  Compiling quote v0.3.15                     
  Compiling lazy_static v0.2.11               
  Compiling pkg-config v0.3.9                 
  Compiling matches v0.1.6                    
  Compiling unicode-xid v0.0.4                
  Compiling openssl v0.9.23                   
  Compiling same-file v0.1.3                  
  Compiling utf8-ranges v1.0.0                
  Compiling dtoa v0.4.2                       
  Compiling regex-syntax v0.4.2               
  Compiling libc v0.2.34                      
  Compiling shell-escape v0.1.3               
  Compiling crossbeam v0.2.10                 
  Compiling glob v0.2.11                      
  Compiling serde v1.0.27                     
  Compiling fnv v1.0.6                        
  Compiling hex v0.2.0                        
  Compiling strsim v0.6.0                     
  Compiling cfg-if v0.1.2                     
  Compiling rustc-demangle v0.1.5             
  Compiling num-traits v0.1.41                
  Compiling cc v1.0.3                         
  Compiling foreign-types-shared v0.1.1       
  Compiling unicode-normalization v0.1.5      
  Compiling itoa v0.3.4                       
  Compiling unreachable v1.0.0                
  Compiling unicode-bidi v0.3.4               
  Compiling synom v0.11.3                     
  Compiling walkdir v1.0.7                    
  Compiling fs2 v0.4.2                        
  Compiling memchr v2.0.1                     
  Compiling atty v0.2.6                       
  Compiling rand v0.3.19                      
  Compiling num_cpus v1.8.0                   
  Compiling memchr v1.0.2                     
  Compiling jobserver v0.1.8                  
  Compiling log v0.4.1                        
  Compiling filetime v0.1.14                  
  Compiling socket2 v0.2.4                    
  Compiling foreign-types v0.3.2              
  Compiling semver v0.7.0                     
  Compiling serde_ignored v0.0.3              
  Compiling toml v0.4.5                       
  Compiling serde_json v1.0.9                 
  Compiling thread_local v0.3.5               
  Compiling curl-sys v0.3.15                  
  Compiling backtrace-sys v0.1.16             
  Compiling cmake v0.1.29                     
  Compiling openssl-sys v0.9.23               
  Compiling libz-sys v1.0.18                  
  Compiling miniz-sys v0.1.10                 
  Compiling syn v0.11.11                      
  Compiling aho-corasick v0.6.4               
  Compiling idna v0.1.4                       
  Compiling tempdir v0.3.5                    
  Compiling log v0.3.9                        
  Compiling tar v0.4.14                       
  Compiling libssh2-sys v0.2.6                
  Compiling libgit2-sys v0.6.18               
  Compiling regex v0.2.5                      
  Compiling url v1.6.0                        
  Compiling serde_derive_internals v0.19.0    
  Compiling flate2 v0.2.20                    
  Compiling serde_derive v1.0.27              
  Compiling env_logger v0.4.3                 
  Compiling globset v0.2.1                    
  Compiling curl v0.4.8                       
  Compiling ignore v0.2.2                     
  Compiling docopt v0.8.2                     
  Compiling backtrace v0.3.4                  
  Compiling error-chain v0.11.0               
  Compiling crates-io v0.11.0                 
  Compiling git2 v0.6.10                      
  Compiling git2-curl v0.7.0                  
  Compiling cargo v0.22.0                     

Update to cargo 0.22

Is there eta when to expect update of this crate to cargo 0.22? currently running coverage on a project with a virtual workspace results in an error:

error: manifest path `/home/travis/build/paritytech/ethabi/Cargo.toml` is a virtual manifest, but this command requires running against an actual package in this workspace

this has been fixed in the latest cargo

Handle doc-tests

Potential (hacky) way to do so:

xd009642/tarpaulin#13 (comment)

I was able to run kcov on doctests in the past. My quick and dirty solution was to use LD_PRELOAD and inject a execvp function.

Here is the code that I used to create a .so file:

#[macro_use]
extern crate redhook;
extern crate libc;

use libc::c_char;
use std::ffi::CString;
use std::slice;
use std::env;

hook! {
    unsafe fn execvp(filename: *const c_char, argv: *const *const c_char) => my_execvp {
        let file = slice::from_raw_parts(filename as *const u8, libc::strlen(filename));
        if let Ok(run) = env::var("TEST_WRAPPER") {
            if let Ok(cmd) = run.split_whitespace()
                                .map(|s| CString::new(s))
                                .collect::<Result<Vec<_>, _>>() {
                if !cmd.is_empty() &&
                    file.starts_with(b"/tmp/rustdoctest") &&
                    file.ends_with(b"rust_out")
                {
                    let mut args: Vec<_> = cmd.iter().map(|s| s.as_ptr()).collect();
                    let mut x = argv;
                    while !(*x).is_null() {
                        args.push(*x);
                        x = x.offset(1);
                    }
                    args.push(*x);
                    real!(execvp)(cmd[0].as_ptr(), args.as_ptr());
                    return;
                }
            }
        }

        real!(execvp)(filename, argv);
    }
}

To run doctests with kcov, execute LD_PRELOAD=path-to-lib.so TEST_WRAPPER=kcov cargo test --doc

Coverage error: failed to parse lock file

Thanks for creating this @roblabla! I use it all the time :)
Today, however I have started seeing an error after the compilation of kcov:

error: failed to parse lock file at: /home/travis/build/eldruin/bmi160-rs/Cargo.lock

Caused by:
  invalid serialized PackageId for key `package.dependencies`

See the build log here

Do you know how to solve this?

cargo doc-upload reports "already up-to-date" after auth failure

Hey, thanks for making such a cool cargo plugin. We use it at tantivy to auto-update docs for the searcher/indexer library that we are developing.

I was reviewing the travis log from our recent build and noticed an inconsistency between the authentication error and the last thing printed by doc-upload

remote: Invalid username or password.
fatal: Authentication failed for 'https://[secure]@github.com/tantivy-search/tantivy.git/'
Documentation already up-to-date.

I think the last line is from

println!("Documentation already up-to-date.");

The if/else logic implies that if documentation wasn't successfully updated, it must be already up to date, instead of reporting an error.

In our case, we had an authentication error, which prevented us from updating documentation.

I think we should parse and log the exit status of the command, so logs can show people the real reason for failure.

Will it help if I send a PR or are you too busy to review?

Reduce CI setup time with binary releases

Instead of cargo install cargo-travis, it'd be helpful to have pre-compiled releases.

For example, you can do the following to install rustfmt:
curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --force --crate rustfmt --git japaric/rustfmt-bin --tag v0.6.3-20161120

Ignore tests folder by default

You can ignore it manually, but there shouldn't be need for calculating coverage for it and I would expect ignoring it would be the default behaviour.

Build Fails for Missing File Panic

I have been having issues with multiple repos on my projects failing for the following error

Cloning into 'target/doc-upload'...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1165:5
note: r

I have the GH_TOKEN. Even with filling in all env vars locally i get the same error. Not sure where the error is occurring.

Make a new release?

The last release was a while ago. It'd convenient to support 2018 edition in released version.

Join `crate-ci` org?

Would you be willing to join forces and move development of your crate to the crate-ci org?

I think this quote from killercup explains the value of a shared org:

There is no reason why so many popular crates should live in user-repos instead of in community-managed organizations (speaking in Github terms). Writing and then publishing a bunch of code as a crate one thing, but maintaining it, fixing bugs, replying to issues and pull requests, that takes up a lot of time as well. Time, that a lot of developers don't have, or don't want to invest. cargo-edit, for example, which lives under my Github username, has two wonderful maintainers, who are more active than I am. But should I create a cargo-edit organization and move the repo there? If there was a good and definitive answer, which would neither make me deal with the organizational aspects not result in accumulating lot of junk code, I'd be really happy.

You can see more about my goal for this new org on my rust2018 post

We still need to work out the governance model but you can maintain as much control over your crate as you wish.

Specifically for this project, things I think could be nice to cargo-coverage renamed to cargo-kcov to recognize there are multiple ways to gather coverage information and to allow them to be installed.

consider doxidize support

doxidize comes with a publish subcommand: https://steveklabnik.github.io/doxidize/users-guide/publish.html

It might be worth it to start thinking about how to integrate that in cargo-travis. It could detect the Doxidize.toml file, and if so, use doxidize publish to publish the documentation instead of using cargo doc, maybe.

It is unclear to me how API documentation for different targets can be generated using this approach.

Test cargo-travis

cargo-travis is currently manually tested. This kinda sucks. I should create a few test projects (with different cargo structures) to make sure at least cargo-coverage works (it might be harder to test cargo-coveralls, but it shares most of its code with cargo-coverage so it should be fine).

cargo install cargo-travis fails

Hi,

I've tried to install cargo-travis (using cargo install cargo-travis) on a Travis CI machine and then on my machine and I got the same error:

   Compiling cargo-travis v0.0.11
error[E0277]: a value of type `[_]` cannot be built from an iterator over elements of type `PathBuf`
   --> /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-travis-0.0.11/src/lib.rs:307:53
    |
307 |             &doc.map(|entry| entry.unwrap().path()).collect(),
    |                                                     ^^^^^^^ value of type `[_]` cannot be built from `std::iter::Iterator<Item=PathBuf>`
    |
    = help: the trait `FromIterator<PathBuf>` is not implemented for `[_]`

error: aborting due to previous error

I am using the following (stable) toolchain:
rustc 1.48.0 (7eac88abb 2020-11-16)
cargo 1.48.0 (65cbdd2dc 2020-10-14)

Consider support for llvm profile compiler runtime library

The approach described here uses llvm profile compiler runtime library, which has several benefits.
Most interestingly, it seems to me like the coverage results are more accurate and can even include branch coverage.
See for yourself:

However, the scripts are not that trivial and letting them duplicate through rust crates would not be very good for the ecosystem.
Is there any intention to integrate this method into cargo-travis?

can't install on Mac

I run the command

"cargo install cargo-travis"

the result message is

"Undefined symbols for architecture x86_64:"

Error: cargo coverage - Invalid arguments.

on rustc 1.25.0-beta.11 (acbd43371 2018-03-17) after reinstalling cargo-travis:

error[E0275]: overflow evaluating the requirement `Inner: std::panic::RefUnwindSafe`
 |
 = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
 = note: required because it appears within the type `alloc::arc::ArcInner<Inner>`
 = note: required because it appears within the type `*const alloc::arc::ArcInner<Inner>`
 = note: required because it appears within the type `core::nonzero::NonZero<*const alloc::arc::ArcInner<Inner>>`
 = note: required because it appears within the type `std::ptr::NonNull<alloc::arc::ArcInner<Inner>>`
 = note: required because it appears within the type `std::sync::Weak<Inner>`
 = note: required because it appears within the type `ScheduledTimer`
 = note: required because it appears within the type `std::marker::PhantomData<ScheduledTimer>`
 = note: required because it appears within the type `arc_list::ArcList<ScheduledTimer>`
 = note: required because it appears within the type `Inner`

error: aborting due to previous error

error: Could not compile `futures-timer`.

On nightly rustc 1.25.0-beta.11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.