Skip to content

Commit c34d0bb

Browse files
committed
Add CI based on trust
1 parent 7c5e2ae commit c34d0bb

File tree

5 files changed

+183
-23
lines changed

5 files changed

+183
-23
lines changed

.travis.yml

+106-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,115 @@
1+
# Based on the "trust" template v0.1.1
2+
# https://github.com/japaric/trust/tree/v0.1.1
3+
4+
dist: trusty
15
language: rust
2-
sudo: false
3-
before_script:
4-
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
6+
services: docker
7+
sudo: required
8+
9+
# TODO Rust builds on stable by default, this can be
10+
# overridden on a case by case basis down below.
11+
12+
env:
13+
global:
14+
# TODO Update this to match the name of your project.
15+
- CRATE_NAME=trust
516

617
matrix:
18+
# TODO These are all the build jobs. Adjust as necessary. Comment out what you
19+
# don't need
720
include:
8-
- rust: 1.18.0
9-
- rust: stable
10-
- rust: stable
21+
# Android
22+
# - env: TARGET=aarch64-linux-android DISABLE_TESTS=1
23+
# - env: TARGET=arm-linux-androideabi DISABLE_TESTS=1
24+
- env: TARGET=armv7-linux-androideabi DISABLE_TESTS=1
25+
# - env: TARGET=i686-linux-android DISABLE_TESTS=1
26+
# - env: TARGET=x86_64-linux-android DISABLE_TESTS=1
27+
28+
# iOS
29+
# - env: TARGET=aarch64-apple-ios DISABLE_TESTS=1
30+
# os: osx
31+
- env: TARGET=armv7-apple-ios DISABLE_TESTS=1
1132
os: osx
12-
- rust: beta
13-
- rust: nightly
14-
script:
15-
- cargo test --all
16-
- cargo test --all --features nightly
17-
- cargo test --all --benches
18-
- cargo build --all --no-default-features
19-
- cargo doc --no-deps --features nightly
33+
# - env: TARGET=armv7s-apple-ios DISABLE_TESTS=1
34+
# os: osx
35+
# - env: TARGET=i386-apple-ios DISABLE_TESTS=1
36+
# os: osx
37+
# - env: TARGET=x86_64-apple-ios DISABLE_TESTS=1
38+
# os: osx
39+
40+
# Linux
41+
# - env: TARGET=aarch64-unknown-linux-gnu
42+
# - env: TARGET=arm-unknown-linux-gnueabi
43+
# - env: TARGET=armv7-unknown-linux-gnueabihf
44+
- env: TARGET=i686-unknown-linux-gnu
45+
# - env: TARGET=i686-unknown-linux-musl
46+
- env: TARGET=mips-unknown-linux-gnu
47+
- env: TARGET=mips64-unknown-linux-gnuabi64
48+
# - env: TARGET=mips64el-unknown-linux-gnuabi64
49+
# - env: TARGET=mipsel-unknown-linux-gnu
50+
# - env: TARGET=powerpc-unknown-linux-gnu
51+
# - env: TARGET=powerpc64-unknown-linux-gnu
52+
# - env: TARGET=powerpc64le-unknown-linux-gnu
53+
# - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1
54+
- env: TARGET=x86_64-unknown-linux-gnu
55+
# - env: TARGET=x86_64-unknown-linux-musl
56+
57+
# OSX
58+
- env: TARGET=i686-apple-darwin
59+
os: osx
60+
- env: TARGET=x86_64-apple-darwin
61+
os: osx
62+
63+
# *BSD
64+
- env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
65+
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
66+
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
67+
68+
# Windows
69+
# - env: TARGET=x86_64-pc-windows-gnu
70+
71+
# Bare metal
72+
# These targets don't support std and as such are likely not suitable for
73+
# most crates.
74+
# - env: TARGET=thumbv6m-none-eabi
75+
# - env: TARGET=thumbv7em-none-eabi
76+
# - env: TARGET=thumbv7em-none-eabihf
77+
# - env: TARGET=thumbv7m-none-eabi
78+
79+
# Testing other channels
80+
- env: TARGET=x86_64-unknown-linux-gnu NIGHTLY=1
81+
rust: nightly
82+
- env: TARGET=x86_64-apple-darwin NIGHTLY=1
83+
os: osx
84+
rust: nightly
85+
86+
before_install:
87+
- set -e
88+
- rustup self update
89+
90+
install:
91+
- sh ci/install.sh
92+
- source ~/.cargo/env || true
93+
2094
script:
21-
- cargo test --all
22-
- cargo build --all --no-default-features
23-
after_success:
24-
- travis-cargo --only nightly doc-upload
25-
env:
26-
global:
27-
secure: "BdDntVHSompN+Qxz5Rz45VI4ZqhD72r6aPl166FADlnkIwS6N6FLWdqs51O7G5CpoMXEDvyYrjmRMZe/GYLIG9cmqmn/wUrWPO+PauGiIuG/D2dmfuUNvSTRcIe7UQLXrfP3yyfZPgqsH6pSnNEVopquQKy3KjzqepgriOJtbyY="
95+
- bash ci/script.sh
96+
97+
after_script: set +e
98+
99+
before_deploy:
100+
- sh ci/before_deploy.sh
101+
102+
cache: cargo
103+
before_cache:
104+
# Travis can't cache files that are not readable by "others"
105+
- chmod -R a+r $HOME/.cargo
106+
107+
# after_success:
108+
# - travis-cargo --only nightly doc-upload
109+
110+
# env:
111+
# global:
112+
# secure: "BdDntVHSompN+Qxz5Rz45VI4ZqhD72r6aPl166FADlnkIwS6N6FLWdqs51O7G5CpoMXEDvyYrjmRMZe/GYLIG9cmqmn/wUrWPO+PauGiIuG/D2dmfuUNvSTRcIe7UQLXrfP3yyfZPgqsH6pSnNEVopquQKy3KjzqepgriOJtbyY="
28113

29114
notifications:
30115
email:

ci/install.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
set -ex
2+
3+
main() {
4+
local target=
5+
if [ $TRAVIS_OS_NAME = linux ]; then
6+
target=x86_64-unknown-linux-musl
7+
sort=sort
8+
else
9+
target=x86_64-apple-darwin
10+
sort=gsort # for `sort --sort-version`, from brew's coreutils.
11+
fi
12+
13+
# Builds for iOS are done on OSX, but require the specific target to be
14+
# installed.
15+
case $TARGET in
16+
aarch64-apple-ios)
17+
rustup target install aarch64-apple-ios
18+
;;
19+
armv7-apple-ios)
20+
rustup target install armv7-apple-ios
21+
;;
22+
armv7s-apple-ios)
23+
rustup target install armv7s-apple-ios
24+
;;
25+
i386-apple-ios)
26+
rustup target install i386-apple-ios
27+
;;
28+
x86_64-apple-ios)
29+
rustup target install x86_64-apple-ios
30+
;;
31+
esac
32+
33+
# This fetches latest stable release
34+
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
35+
| cut -d/ -f3 \
36+
| grep -E '^v[0.1.0-9.]+$' \
37+
| $sort --version-sort \
38+
| tail -n1)
39+
curl -LSfs https://japaric.github.io/trust/install.sh | \
40+
sh -s -- \
41+
--force \
42+
--git japaric/cross \
43+
--tag $tag \
44+
--target $target
45+
}
46+
47+
main

ci/script.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This script takes care of testing your crate
2+
3+
set -ex
4+
5+
# TODO This is the "test phase", tweak it as you see fit
6+
main() {
7+
cross build --target $TARGET
8+
cross build --all --no-default-features --target $TARGET --release
9+
if [ ! -z $NIGHTLY ]; then
10+
cross doc --no-deps --features nightly
11+
fi
12+
13+
if [ ! -z $DISABLE_TESTS ]; then
14+
return
15+
fi
16+
17+
cross test --all --target $TARGET
18+
19+
if [ ! -z $NIGHTLY ]; then
20+
cross test --all --features nightly --target $TARGET
21+
cross test --all --benches --target $TARGET
22+
fi
23+
}
24+
25+
# we don't run the "test phase" when doing deploys
26+
if [ -z $TRAVIS_TAG ]; then
27+
main
28+
fi

rand_core/src/impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ macro_rules! impl_uint_from_fill {
9090
let slice = slice::from_raw_parts_mut(ptr, $N);
9191
$self.fill_bytes(slice);
9292
}
93-
int.to_le()
93+
int
9494
});
9595
}
9696

src/os.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Rng for OsRng {
8181
struct ReadRng<R> (R);
8282

8383
impl<R: Read> ReadRng<R> {
84-
fn try_fill(&mut self, mut dest: &mut [u8]) -> Result<(), Error> {
84+
fn try_fill(&mut self, dest: &mut [u8]) -> Result<(), Error> {
8585
if dest.len() == 0 { return Ok(()); }
8686
// Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`.
8787
self.0.read_exact(dest).map_err(|err| {

0 commit comments

Comments
 (0)