Merge pull request #103 from jonhoo/tuned-ci

Refine Travis CI build and add rustfmt/clippy
This commit is contained in:
Jon Gjengset 2018-11-24 15:12:51 -05:00 committed by GitHub
commit cb83d0d26c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 112 deletions

View file

@ -1,51 +1,101 @@
language: rust
sudo: required
dist: trusty
addons:
apt:
packages:
- libssl-dev
cache: cargo
rust:
- stable
- beta
- nightly
os:
- linux
- osx
matrix:
allow_failures:
- rust: nightly
services:
- docker
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# only test master on push
# always test things that aren't pushes (like PRs)
if: type != push OR branch = master
before_script:
- if [[ "$INTEGRATION" == "true" ]]; then
docker pull greenmail/standalone:1.5.8 &&
docker run -d -e GREENMAIL_OPTS='-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose' -p 3025:3025 -p 3110:3110 -p 3143:3143 -p 3465:3465 -p 3993:3993 -p 3995:3995 greenmail/standalone:1.5.8;
fi
script:
- cargo clean
- cargo check --all-targets
- cargo test --doc
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
cargo test --tests;
else
cargo test --lib;
fi
before_cache: |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == nightly ]]; then
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin
fi
# an entry in stage=test will be generated for each rust/os combination.
# each entry will run these commands.
script:
- cargo test --examples
- cargo test --doc
- cargo test --lib
jobs:
allow_failures:
- rust: nightly
include:
- &check
stage: check # do a pre-screen to make sure this is even worth testing
script: cargo check --all-targets
rust: stable
os: linux
# <1.24 doesn't work because of lazy-static 1.2.0
# <1.26.2 doesn't work because of nom 4.1.1
- <<: *check # also test oldest known-good stable
rust: 1.26.2
- stage: test
rust: stable
os: osx
- rust: stable
os: windows
- &integration
stage: integration # make integration tests its own stage
script: cargo test --tests
sudo: required
services:
- docker
addons:
apt:
packages:
- libssl-dev
env: INTEGRATION=true
rust: stable
os: linux
- <<: *integration
rust: beta
- <<: *integration
rust: nightly
- stage: lint # we lint on beta to future-proof
name: "Rust: beta, rustfmt"
rust: beta
os: linux
script:
- rustup component add rustfmt-preview
- cargo fmt -v -- --check
- name: "Rust: nightly, rustfmt" # and on nightly with allow_fail
rust: nightly
os: linux
script:
- rustup component add rustfmt-preview
- cargo fmt -v -- --check
- name: "Rust: beta, clippy"
rust: beta
os: linux
script:
- rustup component add clippy-preview
- touch ./src/lib.rs && cargo clippy -- -D warnings
- name: "Rust: nightly, clippy"
rust: nightly
os: linux
script:
- rustup component add clippy-preview
- touch ./src/lib.rs && cargo clippy -- -D warnings
- <<: *integration
stage: coverage
rust: nightly
env: CACHE_NAME=coverage INTEGRATION=true
script:
- RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin || true
- cargo tarpaulin --out Xml
- bash <(curl -s https://codecov.io/bash)
- cargo clean # ensure we don't cache build for coverage
stages:
- check
- test
- integration
- lint
- coverage
after_failure:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker logs (docker ps -q); fi
after_success: |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_RUST_VERSION" == nightly ]]; then
docker restart -t 1 (docker ps -q);
cargo tarpaulin --out Xml;
bash <(curl -s https://codecov.io/bash);
fi
- if [[ "$INTEGRATION" == "true" ]]; then docker logs (docker ps -q); fi

View file

@ -16,7 +16,6 @@ categories = ["email", "network-programming"]
[badges]
travis-ci = { repository = "jonhoo/rust-imap" }
appveyor = { repository = "jonhoo/rust-imap", branch = "master", service = "github" }
codecov = { repository = "jonhoo/rust-imap", branch = "master", service = "github" }
maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "jonhoo/rust-imap" }

View file

@ -7,7 +7,6 @@
[![Documentation](https://docs.rs/imap/badge.svg)](https://docs.rs/imap/)
[![Crate License](https://img.shields.io/crates/l/imap.svg)](https://crates.io/crates/imap)
[![Build Status](https://travis-ci.org/jonhoo/rust-imap.svg)](https://travis-ci.org/jonhoo/rust-imap)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/jonhoo/rust-imap?svg=true)](https://ci.appveyor.com/api/projects/status/github/jonhoo/rust-imap)
[![Coverage Status](https://codecov.io/gh/jonhoo/rust-imap/branch/master/graph/badge.svg)](https://codecov.io/gh/jonhoo/rust-imap)
This crate lets you connect to and interact with servers that implement the IMAP protocol ([RFC

View file

@ -7,7 +7,6 @@
[![Documentation](https://docs.rs/imap/badge.svg)](https://docs.rs/imap/)
[![Crate License](https://img.shields.io/crates/l/imap.svg)](https://crates.io/crates/imap)
[![Build Status](https://travis-ci.org/jonhoo/rust-imap.svg)](https://travis-ci.org/jonhoo/rust-imap)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/jonhoo/rust-imap?svg=true)](https://ci.appveyor.com/api/projects/status/github/jonhoo/rust-imap)
[![Coverage Status](https://codecov.io/gh/jonhoo/rust-imap/branch/master/graph/badge.svg)](https://codecov.io/gh/jonhoo/rust-imap)
{{readme}}

View file

@ -1,71 +0,0 @@
# inspired by https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml
environment:
matrix:
### MSVC Toolchains ###
# Stable 64-bit MSVC
- channel: stable
target: x86_64-pc-windows-msvc
# Stable 32-bit MSVC
- channel: stable
target: i686-pc-windows-msvc
# Beta 64-bit MSVC
- channel: beta
target: x86_64-pc-windows-msvc
# Beta 32-bit MSVC
- channel: beta
target: i686-pc-windows-msvc
### GNU Toolchains ###
# Stable 64-bit GNU
- channel: stable
target: x86_64-pc-windows-gnu
# Stable 32-bit GNU
- channel: stable
target: i686-pc-windows-gnu
# Beta 64-bit GNU
- channel: beta
target: x86_64-pc-windows-gnu
# Beta 32-bit GNU
- channel: beta
target: i686-pc-windows-gnu
### MinGW Toolchains ###
# Stable 64-bit MinGW
- channel: stable
target: x86_64-pc-windows-msvc
MSYS_BITS: 64
# Stable 32-bit MinGW
- channel: stable
target: i686-pc-windows-msvc
MSYS_BITS: 32
# Beta 64-bit MinGW
- channel: beta
target: x86_64-pc-windows-msvc
MSYS_BITS: 64
# Beta 32-bit MinGW
- channel: beta
target: i686-pc-windows-msvc
MSYS_BITS: 32
install:
# install Rust
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init -yv --default-toolchain %channel% --default-host %target%
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustc -vV
- cargo -vV
# Building is done in the test phase, so we disable Appveyor's build phase.
build: false
test_script:
- cargo check --all-targets
- cargo test --lib
- cargo test --doc
- cargo test --examples
# note that we are not running integration tests!