Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

Overview

trust

Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

Features

  • CI test your crate (library or binary) on Linux, macOS and Windows and on more than just the x86 architecture.

  • Cargo artifacts are cached and reused between CI builds.

  • "Deploys": Publish binary releases of your application by just pushing a new (Git) tag.

Requirements

  • Your crate must be hosted on GitHub (free).

  • A Travis CI account (free).

  • An AppVeyor account (free).

How-to

Use this template

Copy the ci directory, and the .travis.yml and appveyor.yml files into the repository where you host your Rust crate.

You'll have to adjust those files to meet your needs. Just look inside those files for comments that start with the word TODO; they'll tell you want needs to be changed.

This is an overview of what must / can be changed:

  • The GitHub token used for deploys.

  • The list of test targets. Trim it down to reduce test times.

  • The Rust channel used for testing / deploys.

  • The "test phase". Tweak how your crate is tested.

  • the "package phase". Tweak what goes into the release tarball / zipfile.

Generate binary releases

You only need to push an annotated tag to kick off the build process.

# Optional: Publish a new version of your crate to crates.io
$ cargo publish

$ git tag -a $TAG

$ git push origin $TAG

Use the binary releases on Travis CI

There's an install.sh script that you can use to quickly install a binary release produced using this CI template.

$ curl -LSfs https://japaric.github.io/trust/install.sh | \
    sh -s -- --git japaric/cross

For more details about this installation script see install.sh -h

How to disable deploys?

If you don't want to generate binary releases at all, perhaps because your Cargo project is a library or you only want to test your project, then you can simply change deploy.on.condition, in .travis.yml, and deploy.on, in appveyor.yml, to always be false. For example:

# .travis.yml
deploy:
  on:
    condition: $DEPLOY = never

How to upgrade your CI configuration?

First, figure out which version of the trust template you are using. The version is written in the header of the .travis.yml and appveyor.yml files. If there's no header, that means you are using version v0.1.0.

Next, look at the change log to check if there's a new release and to learn, at a high level, how the template has changed: what has been fixed, what has been added, etc.

If it makes sense for you to upgrade, you can see the required "code" changes by looking at the "diff" between the version you are using and the version you are going to upgrade to. For example:

https://github.com/japaric/trust/compare/v0.1.0...v0.1.1

As for the upgrade itself, GitHub can generate a patch from the above diff that then you can apply to your repository with git am or similar:

https://github.com/japaric/trust/compare/v0.1.0...v0.1.1.patch

Supported targets

Linux

Courtesy of cross.

If you run into any problem with any of these targets, report them to cross's issue tracker but first check if using a newer release (see ci/install.sh) would fix your problem.

Android

  • aarch64-linux-android

  • arm-linux-androideabi

  • armv7-linux-androideabi

  • i686-linux-android

  • x86_64-linux-android

iOS

  • aarch64-apple-ios

  • armv7-apple-ios

  • armv7s-apple-ios

  • i386-apple-ios

  • x86_64-apple-ios

Linux

  • i686-unknown-linux-gnu

  • i686-unknown-linux-musl

  • x86_64-unknown-linux-gnu

  • x86_64-unknown-linux-musl

  • aarch64-unknown-linux-gnu

  • arm-unknown-linux-gnueabi

  • armv7-unknown-linux-gnueabihf

  • mips-unknown-linux-gnu

  • mips64-unknown-linux-gnuabi64

  • mips64el-unknown-linux-gnuabi64

  • mipsel-unknown-linux-gnu

  • powerpc-unknown-linux-gnu

  • powerpc64-unknown-linux-gnu

  • powerpc64le-unknown-linux-gnu

  • s390x-unknown-linux-gnu

macOS

  • i686-apple-darwin

  • x86_64-apple-darwin

*BSD

  • i686-unknown-freebsd

  • x86_64-unknown-freebsd

  • x86_64-unknown-netbsd

Windows (MinGW)

  • i686-pc-windows-gnu

  • x86_64-pc-windows-gnu

Windows (MSVC)

  • i686-pc-windows-msvc

  • x86_64-pc-windows-msvc

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • projects with a dependency on the openssl crate seem to always fail

    projects with a dependency on the openssl crate seem to always fail

    here's an example - https://travis-ci.org/softprops/bin-test/jobs/192443776

    error: failed to run custom build command for `openssl v0.7.14`
    process didn't exit successfully: `/target/debug/build/openssl-5464f8f6e728c35a/build-script-build` (exit code: 101)
    --- stdout
    TARGET = Some("x86_64-unknown-linux-musl")
    OPT_LEVEL = Some("0")
    PROFILE = Some("debug")
    TARGET = Some("x86_64-unknown-linux-musl")
    debug=true opt-level=0
    HOST = Some("x86_64-unknown-linux-gnu")
    TARGET = Some("x86_64-unknown-linux-musl")
    TARGET = Some("x86_64-unknown-linux-musl")
    HOST = Some("x86_64-unknown-linux-gnu")
    CC_x86_64-unknown-linux-musl = None
    CC_x86_64_unknown_linux_musl = None
    TARGET_CC = None
    CC = None
    HOST = Some("x86_64-unknown-linux-gnu")
    CROSS_COMPILE = None
    TARGET = Some("x86_64-unknown-linux-musl")
    HOST = Some("x86_64-unknown-linux-gnu")
    CFLAGS_x86_64-unknown-linux-musl = None
    CFLAGS_x86_64_unknown_linux_musl = None
    TARGET_CFLAGS = None
    CFLAGS = None
    running: "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-static" "-o" "/target/x86_64-unknown-linux-musl/debug/build/openssl-5464f8f6e728c35a/out/src/c_helpers.o" "-c" "src/c_helpers.c"
    cargo:warning=src/c_helpers.c:1:25: fatal error: openssl/ssl.h: No such file or directory
    cargo:warning=compilation terminated.
    ExitStatus(ExitStatus(256))
    command did not execute successfully, got: exit code: 1
    --- stderr
    thread 'main' panicked at 'explicit panic', /cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.41/src/lib.rs:1018
    note: Run with `RUST_BACKTRACE=1` for a backtrace.```
    opened by softprops 11
  • SSL errors on Travis

    SSL errors on Travis

    I'm switching a small project of mine over to trust. Builds on Travis are failing when they didn't previously. I'm getting SSL errors when testing the crate with TARGET=*-unknown-linux-* on Travis. darwin is fine, and the tests don't run on BSD or Windows. Testing locally on debian and arch linux also works.

    It looks like reqwest can't find certificates:

    Error { kind: Io(Error { repr: Custom(Custom { kind: Other, error: Ssl(ErrorStack([Error { code: 336134278, library: \"SSL routines\", function: \"ssl3_get_server_certificate\", reason: \"certificate verify failed\", file: \"s3_clnt.c\", line: 1264 }])) }) }), url: Some(\"https://inspirehep.net/search?of=hx&p=Higgs%3A2014aqa\")
    

    Example log on Travis Line where the panic happens

    This looks like a related issue: https://github.com/japaric/trust/issues/55 . It's not exactly same though; everything seems to build but there is an error during tests.

    Thanks for this project!

    opened by musoke 7
  • Travis build fails:

    Travis build fails: "Read-only file system"

    Heatseeker has a build script that collects some build-time metadata and writes a version.rs file. After migrating to trust, Travis builds (except for builds targeting Darwin) are failing with the following error:

    error: failed to run custom build command for `heatseeker v1.5.0 (file:///project)`
    process didn't exit successfully: `/target/debug/build/heatseeker-77dc6031b5733332/build-script-build` (exit code: 101)
    --- stderr
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 30, message: "Read-only file system" } }', ../src/libcore/result.rs:837
    

    The custom build command never caused any problems before, and somehow it's still not causing problems for Darwin builds. I'm not sure if the problem is in the trust template, my adaptation of it, or Travis itself.

    opened by rschmitt 7
  • Remove sudo: required.

    Remove sudo: required.

    This is a followup to #48.

    It seems nothing is using sudo in trust, removing this line will default to sudo: false. This means, trust will run on Travis container infrastructure, which has faster boots and probably faster builds.

    My testing showed that my repos run fine without sudo. I furthermore verified:

    • The docker service is brought up, even without sudo: enabled, so we are good there.
    • sudo apt-get no longer works since there is no sudo. But apt packages can be installed using the apt addon. (Example how this looks).
    opened by SirVer 6
  • Remove rust channel

    Remove rust channel

    This is done to prevent a default build from spawning, (it looks weird, its better to have the build as part of the matrix.) Also the default is to run on stable anyways so its even more silly.

    opened by Arzte 6
  • Stop installing rust with rustup.rs twice

    Stop installing rust with rustup.rs twice

    Since https://github.com/travis-ci/travis-ci/issues/7510 Travis now uses rustup.rs to install rust. This change will stop trust from installing rust a second time the exact same way that Travis does.

    opened by Arzte 5
  • Run `cargo clean` before building for target

    Run `cargo clean` before building for target

    Using cross with build scripts breaks sometimes, see https://github.com/japaric/cross/issues/39 . By cleaning first, we ensure we don't fail because of reusing build-scripts.

    Fixes #60 .

    opened by gnunicorn 5
  • Update documentation for travis-ci.com

    Update documentation for travis-ci.com

    travis-ci.com is now the default for opensource projects. However their commandline tool still needs the --pro flag to encrypt the github token correctly.

    I described the reason for this extra flag in more detail in my issue: #104

    opened by flofriday 4
  • Fix latest Git tag detection in install script on GitHub Pages

    Fix latest Git tag detection in install script on GitHub Pages

    Fixes #130 Supersedes #124

    Synopsis

    Explained here: https://github.com/japaric/trust/issues/130#issuecomment-1315085924

    Solution

    Parse latest Git tag name from JSON returned by https://api.github.com/repos/$git/releases/latest.

    opened by tyranron 0
  • When building gnu linux library, seeing an issue

    When building gnu linux library, seeing an issue

    Compiling memchr v2.3.3 Compiling lazy_static v1.4.0 Compiling regex-syntax v0.6.18 Compiling libc v0.2.71 Compiling autocfg v1.0.0 Compiling proc-macro-hack v0.5.16 Compiling cpython v0.5.0 Compiling thread_local v1.0.1 Compiling num-traits v0.2.12 Compiling paste-impl v0.1.17 Compiling paste v0.1.17 Compiling aho-corasick v0.7.10 Compiling regex v1.3.9 Compiling python3-sys v0.5.0 error: failed to run custom build command for python3-sys v0.5.0

    Caused by: process didn't exit successfully: /target/debug/build/python3-sys-ed1507cd27247b52/build-script-build (exit code: 101) --- stderr thread 'main' panicked at 'called Result::unwrap() on an Err value: "No python interpreter found of version 3.*"', /cargo/registry/src/github.com-1ecc6299db9ec823/python3-sys-0.5.0/build.rs:450:35

    opened by skirdey 0
  • Issue running the trust install script with the latest version of cross

    Issue running the trust install script with the latest version of cross

    Hi there. I wonder if you might be able to help me?

    I've noticed the following failure on Travis Linux builds when trying to install the binary release:

    $  curl -LSfs https://japaric.github.io/trust/install.sh | \
    >     sh -s -- --git japaric/cross
    
    install.sh: GitHub repository: https://github.com/japaric/cross
    install.sh: Crate: cross
    install.sh: Tag: latest (latest)
    install.sh: Target: x86_64-unknown-linux-gnu
    install.sh: Installing to: /home/travis/.cargo/bin
    
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    

    It looks to me like the install.sh script might be incompatible with the latest tag of cross because specifying the previous tag works:

    $ curl -LSfs https://japaric.github.io/trust/install.sh | \
    >         sh -s -- \
    >          --git japaric/cross \
    >            --tag v0.1.16
    install.sh: GitHub repository: https://github.com/japaric/cross
    install.sh: Crate: cross
    install.sh: Tag: v0.1.16
    install.sh: Target: x86_64-unknown-linux-gnu
    install.sh: Installing to: /home/travis/.cargo/bin
    

    We also target mac OS and it looks like it has a similar issue:

    $ curl -LSfs https://japaric.github.io/trust/install.sh | \
        sh -s -- --git japaric/cross
    
    install.sh: GitHub repository: https://github.com/japaric/cross
    install.sh: Crate: cross
    install.sh: Tag: latest (latest)
    install.sh: Target: x86_64-apple-darwin
    install.sh: Installing to: /Users/dean/.cargo/bin
    
    tar: Unrecognized archive format
    tar: Error exit delayed from previous errors.
    

    Do you have any ideas what the problem might be here? I'm afraid I'm a bit of a Rust newbie so I must admit I'm not sure what to look for here. Let me know if I can get anything else to help with this, or if I should actually report this on this Cross project?

    Thanks very much, Dean

    opened by cs97dah 5
  • Newer version of Ubuntu for Travis

    Newer version of Ubuntu for Travis

    Hi, I noticed this is using Trusty, which went out of support in April 2019. See .travis.yml line 4: https://github.com/japaric/trust/blob/master/.travis.yml#L4

    Would there be any issues with using a newer Ubuntu version? Thanks!

    opened by AaronM04 0
Releases(v0.1.2)
Owner
Jorge Aparicio
@ferrous-systems engineer. @rust-embedded WG core member. He/they
Jorge Aparicio
Test for crate delay_timer

delay_timer-test some test for crate delay_timer crate link: https://github.com/BinChengZhao/delay-timer here some test for delay_timer,also used for

null 1 Nov 22, 2021
TestDrive automatically scrapes input/output data from BOJ(Baekjoon Online Judge) and runs tests for your executable binary file!

?? TestDrive What does it do? TestDrive automatically scrapes input/output data from BOJ(Baekjoon Online Judge) and runs tests for your executable bin

Hyeonseok Jung 3 Mar 5, 2022
A series of test cases to evaluate async Rust on the nrf52840 in terms of power usage and ergonomics.

A series of test cases to evaluate async Rust on the nrf52840 in terms of power usage and ergonomics. This is an experiment that uses unstable features only available on nightly rust.

Tweede golf 1 Oct 15, 2021
Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

Brendan Molloy 394 Jan 1, 2023
Fluent test assertions for Rust.

This is a fork the unmaintained crate spectral. Spectral as not changed for five years and yet is still very usable, the goal of this fork is to add n

Paul Delafosse 24 Dec 20, 2022
Test for rust-based plugin system for swc

rust-dylib-test Steps Run cargo build in plugin_a Ensure that plugin_a dynamically links to runtime/common by otool -L plugin_a/target/debug/libplugin

Donny/강동윤 1 Apr 6, 2022
Fixture-based test framework for Rust

Fixture-based test framework for Rust Introduction rstest uses procedural macros to help you on writing fixtures and table-based tests. To use it, add

Michele d'Amico 567 Dec 24, 2022
Verdun is a HTTP stress-test/benchmark tool written in Rust.

Verdun is a HTTP stress-test/benchmark tool written in Rust. ?? It supports testing a single URL, loading multiples URLs from a file or automatically navigating a website (auto discovery)

Alex Hortopan 2 Feb 23, 2022
Nextest is a next-generation test runner for Rust.

nextest Nextest is a next-generation test runner for Rust. For more, check out the website. This repository contains the source code for: cargo-nextes

null 1.3k Jan 8, 2023
`mutatis` is a library for writing custom, structure-aware test-case mutators for fuzzers in Rust.

mutatis Easily create custom, structure-aware mutators for fuzzing. Repository | Docs | Guide | Contributing About The most popular fuzzers — includin

Nick Fitzgerald 4 Aug 19, 2024
Test social media cards locally

Share Preview Test social media cards locally Description Preview and debug websites metadata tags for social media share. Third Party Packages Distri

Rafael Mardojai CM 65 Dec 25, 2022
Competitive Programming Stress Test Tools

Competitive Programming Stress Test Tools 競技プログラミング用 ストレステストツール このプログラムの役割 のプログラムに対して,それより実行時間がかかるが確実に できる愚直プログラムと比較することで, となるテストケースを探し出す 最大コーナーケースに対し

Ryusei Ishikawa 7 Aug 28, 2021
A heckin small test generator

heckcheck A heckin small test generator API Docs | Releases | Contributing Installation $ cargo add heckcheck Safety This crate uses #![deny(unsafe_co

Yoshua Wuyts 18 Mar 20, 2022
atttribute macro for running a flaky test multiple times

flaky_test This attribute macro will register and run a test 3 times, erroring only if all three times fail. Useful for situations when a test is flak

Deno Land 23 Mar 23, 2022
a test harness for embedded devices

defmt-test a test harness for embedded devices This crate has been moved to the defmt repository Support defmt-test is part of the Knurling project, F

Knurling 8 Aug 27, 2022
Test cargo crates in different envs & via different methods

Test cargo crates in different envs & via different methods

@Vlad@ 2 Mar 22, 2022
Hopper is a tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing.

Hopper Hopper is an tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing. It transforms the problem of libr

FuzzAnything 118 Nov 15, 2023
Hopper is a tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing.

Hopper Hopper is an tool for generating fuzzing test cases for libraries automatically using interpretative fuzzing. It transforms the problem of libr

FuzzAnything 124 Nov 24, 2023
Rewind is a snapshot-based coverage-guided fuzzer targeting Windows kernel components.

Rewind is a snapshot-based coverage-guided fuzzer targeting Windows kernel components.

Quarkslab 259 Dec 26, 2022