Skip to content

Commit 5393b1b

Browse files
committed
Upgrade CI (clippy, more targets)
1 parent d40f49e commit 5393b1b

File tree

5 files changed

+133
-44
lines changed

5 files changed

+133
-44
lines changed

.travis.yml

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,61 @@
11
language: rust
22
sudo: false
3+
rust: nightly
34

45
matrix:
56
include:
67
- name: "miri"
7-
rust: nightly
8-
install:
9-
- rustup component add rust-src
10-
- cargo +nightly install --force --git https://github.com/rust-lang/miri miri
11-
- cargo install xargo
12-
script:
13-
- cargo clean
14-
- cargo +nightly miri test
15-
- rust: 1.29.0
16-
- rust: stable
17-
- rust: beta
18-
- rust: nightly
19-
- rust: nightly
20-
env:
21-
- FEATURES='nightly'
8+
env: TARGET=x86_64-unknown-linux-gnu
9+
script: sh ci/miri.sh
10+
- name: "rustfmt/clippy"
11+
env: TARGET=x86_64-unknown-linux-gnu
12+
script: sh ci/tools.sh
13+
- name: "docs"
14+
env: TARGET=x86_64-unknown-linux-gnu
15+
script: cargo -vv doc --features nightly,serde,rayon
16+
deploy:
17+
provider: pages
18+
skip-cleanup: true
19+
github-token: $GITHUB_TOKEN
20+
local-dir: target/doc
21+
keep-history: false
22+
on:
23+
branch: master
2224

23-
# test a target without sse2 for raw/generic.rs
24-
- rust: stable
25-
env:
26-
- TARGET=i586-unknown-linux-gnu
27-
addons:
28-
apt:
29-
packages:
30-
- gcc-multilib
31-
install:
32-
- rustup target add $TARGET
33-
script:
34-
- cargo build --verbose --target $TARGET
35-
- cargo test --verbose --target $TARGET
25+
# Tier 1 targets:
26+
- name: "x86_64-unknown-linux-gnu"
27+
env: TARGET=x86_64-unknown-linux-gnu
28+
- name: "x86_64-unknown-linux-gnu (beta)"
29+
rust: beta
30+
env: TARGET=x86_64-unknown-linux-gnu
31+
- name: "x86_64-unknown-linux-gnu (stable)"
32+
rust: stable
33+
env: TARGET=x86_64-unknown-linux-gnu
34+
- name: "x86_64-unknown-linux-gnu (Rust 1.29.0)"
35+
rust: stable
36+
env: TARGET=x86_64-unknown-linux-gnu
37+
- name: "x86_64-apple-darwin"
38+
env: TARGET=x86_64-apple-darwin
39+
os: osx
40+
osx_image: xcode10
41+
- name: "x86_64-pc-windows-msvc"
42+
env: TARGET=x86_64-pc-windows-msvc
43+
os: windows
44+
- name: "x86_64-pc-windows-gnu"
45+
env: TARGET=x86_64-pc-windows-gnu CROSS=1
46+
47+
# Tier 2/3 targets:
48+
- name: "i586-unknown-linux-gnu (no SSE2)"
49+
env: TARGET=i586-unknown-linux-gnu CROSS=1
50+
- name: "aarch64-unknown-linux-gnu"
51+
env: TARGET=aarch64-unknown-linux-gnu CROSS=1
52+
53+
install: travis_retry rustup target add "${TARGET}"
54+
script: sh ci/run.sh
3655

3756
branches:
3857
# Don't build these branches
3958
except:
4059
# Used by bors
4160
- trying.tmp
4261
- staging.tmp
43-
44-
before_script:
45-
- if [ "$TRAVIS_RUST_VERSION" == "stable" ]; then rustup component add rustfmt; fi
46-
47-
script:
48-
- if [ "$TRAVIS_RUST_VERSION" == "stable" ]; then cargo fmt -- --check; fi
49-
50-
- cargo build --verbose --features "$FEATURES"
51-
- cargo test --verbose --features "$FEATURES"
52-
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo bench --verbose --features "$FEATURES"; fi
53-
- cargo doc --verbose --features "$FEATURES"
54-
55-
- cargo build --verbose --features "$FEATURES serde"
56-
- cargo test --verbose --features "$FEATURES serde"
57-
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo bench --verbose --features "$FEATURES serde"; fi
58-
- cargo doc --verbose --features "$FEATURES serde"

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ rustc-hash = "1.0"
2626
serde_test = "1.0"
2727

2828
[features]
29+
default = []
2930
nightly = []

ci/miri.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
export CARGO_NET_RETRY=5
6+
export CARGO_NET_TIMEOUT=10
7+
8+
if cargo install --force --git https://github.com/rust-lang/miri miri ; then
9+
cargo miri setup
10+
cargo miri test
11+
fi

ci/run.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
: "${TARGET?The TARGET environment variable must be set.}"
6+
7+
FEATURES="rayon,serde"
8+
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then
9+
FEATURES="${FEATURES},nightly"
10+
fi
11+
12+
CARGO=cargo
13+
if [ "${CROSS}" = "1" ]; then
14+
export CARGO_NET_RETRY=5
15+
export CARGO_NET_TIMEOUT=10
16+
17+
cargo install cross
18+
CARGO=cross
19+
fi
20+
21+
"${CARGO}" -vv test --target="${TARGET}"
22+
"${CARGO}" -vv test --target="${TARGET}" --features "${FEATURES}"
23+
24+
"${CARGO}" -vv test --target="${TARGET}" --release
25+
"${CARGO}" -vv test --target="${TARGET}" --features "${FEATURES}"
26+
27+
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then
28+
# Run benchmark on native targets, build them on non-native ones:
29+
NO_RUN=""
30+
if [ "${CROSS}" = "1" ]; then
31+
NO_RUN="--no-run"
32+
fi
33+
34+
"${CARGO}" -vv bench "${NO_RUN}" --features "${FEATURES}"
35+
fi

ci/tools.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env sh
2+
3+
set -ex
4+
5+
retry() {
6+
result=0
7+
count=1
8+
max=5
9+
while [ "$count" -le 3 ]; do
10+
[ "$result" -ne 0 ] && {
11+
printf "\nRetrying, %d of %d\n" $count $max >&2
12+
}
13+
"$@"
14+
result=$?
15+
[ $result -eq 0 ] && break
16+
count=$(count + 1)
17+
sleep 1
18+
done
19+
20+
[ "$count" -gt 3 ] && {
21+
printf "\nFailed %d times.\n" $max >&2
22+
}
23+
24+
return $result
25+
}
26+
27+
28+
if retry rustup component add rustfmt ; then
29+
cargo fmt --all -- --check
30+
fi
31+
32+
if retry rustup component add clippy ; then
33+
cargo clippy --all -- -D clippy::pedantic
34+
fi
35+
36+
if command -v shellcheck ; then
37+
shellcheck --version
38+
shellcheck ci/*.sh
39+
fi

0 commit comments

Comments
 (0)