Skip to content

Commit

Permalink
Add OSX and Windows builds to Travis CI and remove AppVeyor.
Browse files Browse the repository at this point in the history
Take advantage of the recently added OSX and Windows build support in
Travis CI and simplify `uom` to use a single CI build service. Remove
AppVeyor. Minimum supported `rustc` version is now 1.24.1 in order to
support the latest `Quickcheck`, `lazy_static` and `compile_fail` doc
tests. 1.22.0 is still included in the CI build script, but no tests are
run.
  • Loading branch information
iliekturtles committed Nov 13, 2018
1 parent 78e58f9 commit f81c40c
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 153 deletions.
65 changes: 0 additions & 65 deletions .appveyor.yml

This file was deleted.

45 changes: 28 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,64 @@ addons:
- libssl-dev

rust:
- 1.20.0 # Oldest supported
#- stable # Done by explicit job
- 1.24.1 # Oldest supported
- stable
- beta
- nightly
os:
- linux
- osx
- windows

matrix:
allow_failures:
- rust: nightly
include:
- env: TEST
- name: "Rust: 1.22.0" # Oldest compiled
rust: 1.22.0
script: |
cargo build --verbose --features "use_serde"
- name: "Rust: stable + tests"
rust: stable
script: |
set -e
cargo test --verbose --features "use_serde ${TRAVIS_RUST_VERSION//./_}"
cargo test --manifest-path tests/feature_check/Cargo.toml --verbose --features "${TRAVIS_RUST_VERSION//./_}"
cargo test --verbose --no-default-features --features "autoconvert f32 f64 si use_serde ${TRAVIS_RUST_VERSION//./_}"
cargo test --verbose --no-run --no-default-features --features "autoconvert usize u8 u16 u32 u64 isize i8 i16 i32 i64 bigint biguint rational rational32 rational64 bigrational f32 f64 std use_serde ${TRAVIS_RUST_VERSION//./_}"
- env: RUSTFMT
rust: stable
cargo test --verbose --features "use_serde"
cargo test --manifest-path tests/feature_check/Cargo.toml --verbose
cargo test --verbose --no-default-features --features "autoconvert f32 f64 si use_serde"
cargo test --verbose --no-run --no-default-features --features "autoconvert usize u8 u16 u32 u64 isize i8 i16 i32 i64 bigint biguint rational rational32 rational64 bigrational f32 f64 std use_serde"
- name: Rustfmt
rust: 1.30.0
install:
- rustup component add rustfmt-preview
script:
- cargo fmt -- --check
- env: RUSTFLAGS="-D warnings"
rust: stable
- name: Deny warnings
rust: 1.30.0
script:
- RUSTFLAGS="-D warnings" cargo check --tests
- env: CLIPPY
rust: stable
- name: Clippy
rust: 1.30.0
install:
- rustup component add clippy-preview
script:
- cargo clippy -- -D clippy
- env: TARPAULIN
rust: stable
- name: Tarpaulin
rust: 1.30.0
sudo: required
script:
- docker run --security-opt seccomp=unconfined -v "$PWD:/volume" xd009642/tarpaulin sh -c "cargo build && cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID"
exclude:
- os: linux # Done by explicit job.
rust: stable

install:
- rustc -Vv
- cargo -V

script: |
set -e
cargo test --verbose --features "use_serde ${TRAVIS_RUST_VERSION//./_}"
cargo test --manifest-path tests/feature_check/Cargo.toml --verbose --features "${TRAVIS_RUST_VERSION//./_}"
cargo test --verbose --features "use_serde"
cargo test --manifest-path tests/feature_check/Cargo.toml --verbose
before_cache:
- rm -rf /home/travis/.cargo/registry
Expand Down
10 changes: 1 addition & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ autobenches = true
all-features = true

[badges]
appveyor = { repository = "iliekturtles/uom" }
travis-ci = { repository = "iliekturtles/uom" }
coveralls = { repository = "iliekturtles/uom" }
maintenance = { status = "actively-developed" }
Expand All @@ -36,7 +35,7 @@ typenum = "1.9"

[dev-dependencies]
approx = "0.3"
quickcheck = "0.6"
quickcheck = "0.7"
serde_json = "1.0"
static_assertions = "0.2"

Expand Down Expand Up @@ -71,13 +70,6 @@ use_serde = ["serde"]
# Internal features to include appropriate num-* crates.
rational-support = ["num-rational"]
bigint-support = ["num-bigint", "num-rational/bigint"]
# Internal features to support channel specific test logic. Note that a
# channel's feature must be added to the `--features` list when compiling
# manually as no channel detection is build into `cargo`/`rustc`.
1_20_0 = []
stable = []
beta = []
nightly = []

[[example]]
name = "base"
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
uom
===
[![Travis](https://travis-ci.org/iliekturtles/uom.svg?branch=master)](https://travis-ci.org/iliekturtles/uom)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/github/iliekturtles/uom?svg=true&branch=master)](https://ci.appveyor.com/project/iliekturtles/uom)
[![Coveralls](https://coveralls.io/repos/github/iliekturtles/uom/badge.svg?branch=master)](https://coveralls.io/github/iliekturtles/uom?branch=master)
[![Rustup.rs](https://img.shields.io/badge/rustc-1.20.0%2B-orange.svg)](https://rustup.rs/)
[![Rustup.rs](https://img.shields.io/badge/rustc-1.24.1%2B-orange.svg)](https://rustup.rs/)
[![Crates.io](https://img.shields.io/crates/v/uom.svg)](https://crates.io/crates/uom)
[![Crates.io](https://img.shields.io/crates/l/uom.svg)](https://crates.io/crates/uom)
[![Documentation](https://img.shields.io/badge/documentation-docs.rs-blue.svg)](https://docs.rs/uom)
Expand All @@ -24,7 +23,7 @@ Units of measurement is a crate that does automatic type-safe zero-cost
[orbiter]: https://en.wikipedia.org/wiki/Mars_Climate_Orbiter

## Usage
`uom` requires `rustc` 1.20.0 or later. Add this to your `Cargo.toml`:
`uom` requires `rustc` 1.24.1 or later. Add this to your `Cargo.toml`:

```toml
[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! [orbiter]: https://en.wikipedia.org/wiki/Mars_Climate_Orbiter
//!
//! ## Usage
//! `uom` requires `rustc` 1.20.0 or later. Add this to your `Cargo.toml`:
//! `uom` requires `rustc` 1.24.1 or later. Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
Expand Down
8 changes: 4 additions & 4 deletions src/si/thermodynamic_temperature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//! the [ISQ][isq]. Temperature interval is the measure of relative temperature difference between
//! thermodynamic temperatures.
//!
#![cfg_attr(all(feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#![cfg_attr(not(all(feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#![cfg_attr(feature = "f32", doc = " ```rust,compile_fail")]
#![cfg_attr(not(feature = "f32"), doc = " ```rust,ignore")]
//! # use uom::si::{temperature_interval, thermodynamic_temperature};
//! # use uom::si::f32::*;
//! let tt = ThermodynamicTemperature::new::<thermodynamic_temperature::kelvin>(1.0);
Expand All @@ -19,8 +19,8 @@
//!
//! Additionally, addition and subtraction are not implemented for thermodynamic temperature.
//!
#![cfg_attr(all(feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#![cfg_attr(not(all(feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#![cfg_attr(feature = "f32", doc = " ```rust,compile_fail")]
#![cfg_attr(not(feature = "f32"), doc = " ```rust,ignore")]
//! # use uom::si::{temperature_interval, thermodynamic_temperature};
//! # use uom::si::f32::*;
//! let t1 = ThermodynamicTemperature::new::<thermodynamic_temperature::kelvin>(1.0);
Expand Down
56 changes: 27 additions & 29 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ macro_rules! system {
///
/// Using units for the wrong quantity will cause a compile error:
///
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#[cfg_attr(all(feature = "si", feature = "f32"), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32")), doc = " ```rust,ignore")]
/// # use uom::si::f32::*;
/// # use uom::si::time::second;
/// // error[E0277]: the trait bound `second: length::Unit` is not satisfied
Expand All @@ -208,17 +208,17 @@ macro_rules! system {
///
/// Mixing quantities will also cause a compile error:
///
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#[cfg_attr(all(feature = "si", feature = "f32"), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32")), doc = " ```rust,ignore")]
/// # use uom::si::f32::*;
/// # use uom::si::length::meter;
/// # use uom::si::time::second;
/// // error[E0308]: mismatched types
/// let r = Length::new::<meter>(1.0) + Time::new::<second>(1.0);
/// ```
///
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#[cfg_attr(all(feature = "si", feature = "f32"), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32")), doc = " ```rust,ignore")]
/// # use uom::si::f32::*;
/// # use uom::si::length::meter;
/// # use uom::si::time::second;
Expand Down Expand Up @@ -596,8 +596,8 @@ macro_rules! system {
///
/// The input type must have dimensions divisible by three:
///
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#[cfg_attr(all(feature = "si", feature = "f32"), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32")), doc = " ```rust,ignore")]
/// # use uom::si::f32::*;
/// # use uom::si::area::square_meter;
/// // error[E0271]: type mismatch resolving ...
Expand Down Expand Up @@ -764,8 +764,8 @@ macro_rules! system {
///
/// The input type must have dimensions divisible by two:
///
#[cfg_attr(all(feature = "si", feature = "f32", not(feature = "1_20_0")), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32", not(feature = "1_20_0"))), doc = " ```rust,ignore")]
#[cfg_attr(all(feature = "si", feature = "f32"), doc = " ```rust,compile_fail")]
#[cfg_attr(not(all(feature = "si", feature = "f32")), doc = " ```rust,ignore")]
/// # use uom::si::f32::*;
/// # use uom::si::length::meter;
/// // error[E0271]: type mismatch resolving ...
Expand Down Expand Up @@ -930,25 +930,23 @@ macro_rules! system {
self.value.cmp(&other.value)
}

// TODO Re-enable once a way is found to conditionally include based on Rust version or
// the minimum version for uom increases. Ord::{max, min} was added in 1.22.0.
// #[inline(always)]
// fn max(self, other: Self) -> Self {
// Quantity {
// dimension: $crate::lib::marker::PhantomData,
// units: $crate::lib::marker::PhantomData,
// value: self.value.max(other.value),
// }
// }

// #[inline(always)]
// fn min(self, other: Self) -> Self {
// Quantity {
// dimension: $crate::lib::marker::PhantomData,
// units: $crate::lib::marker::PhantomData,
// value: self.value.min(other.value),
// }
// }
#[inline(always)]
fn max(self, other: Self) -> Self {
Quantity {
dimension: $crate::lib::marker::PhantomData,
units: $crate::lib::marker::PhantomData,
value: self.value.max(other.value),
}
}

#[inline(always)]
fn min(self, other: Self) -> Self {
Quantity {
dimension: $crate::lib::marker::PhantomData,
units: $crate::lib::marker::PhantomData,
value: self.value.min(other.value),
}
}
}

autoconvert! {
Expand Down
29 changes: 13 additions & 16 deletions src/tests/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,22 +565,19 @@ mod fixed {
&Length::new::<meter>((*r).clone()))
}

// TODO Re-enable once a way is found to conditionally include based on Rust
// version or the minimum version for uom increases. Ord::{max, min} was added in
// 1.22.0.
// #[allow(trivial_casts)]
// fn max(l: A<V>, r: A<V>) -> bool {
// Test::eq(&Length::new::<meter>((*l).clone().max((*r).clone())),
// &Ord::max(Length::new::<meter>((*l).clone()),
// Length::new::<meter>((*r).clone())))
// }

// #[allow(trivial_casts)]
// fn min(l: A<V>, r: A<V>) -> bool {
// Test::eq(&Length::new::<meter>((*l).clone().min((*r).clone())),
// &Ord::min(Length::new::<meter>((*l).clone()),
// Length::new::<meter>((*r).clone())))
// }
#[allow(trivial_casts)]
fn max(l: A<V>, r: A<V>) -> bool {
Test::eq(&Length::new::<meter>((*l).clone().max((*r).clone())),
&Ord::max(Length::new::<meter>((*l).clone()),
Length::new::<meter>((*r).clone())))
}

#[allow(trivial_casts)]
fn min(l: A<V>, r: A<V>) -> bool {
Test::eq(&Length::new::<meter>((*l).clone().min((*r).clone())),
&Ord::min(Length::new::<meter>((*l).clone()),
Length::new::<meter>((*r).clone())))
}
}
}
}
7 changes: 0 additions & 7 deletions tests/feature_check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,3 @@ uom = { path = "../.." }

[features]
default = []
# Internal features to support channel specific test logic. Note that a
# channel's feature must be added to the `--features` list when compiling
# manually as no channel detection is build into `cargo`/`rustc`.
1_20_0 = []
stable = []
beta = []
nightly = []
3 changes: 1 addition & 2 deletions tests/feature_check/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
//!
//! Validate that `storage_types!` does not generate code for the `i32` type.
//!
#![cfg_attr(not(feature = "1_20_0"), doc = " ```rust,compile_fail")]
#![cfg_attr(feature = "1_20_0", doc = " ```rust,ignore")]
//! ```rust,compile_fail
//! #[macro_use]
//! extern crate uom;
//!
Expand Down

0 comments on commit f81c40c

Please sign in to comment.