diff --git a/.travis.yml b/.travis.yml index ed59a2f..8f7ddbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,9 @@ matrix: os: osx - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 rust: nightly + - os: windows + env: TARGET=x86_64-pc-windows-msvc + rust: nightly before_install: - set -e diff --git a/Cargo.toml b/Cargo.toml index 0f8ef0a..61c1e8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,12 @@ toml = "0.4.8" serde_derive = "1.0.79" serde = "1.0.79" subprocess = "0.1.16" -structopt = "0.2.10" +structopt = "0.2.12" clap = "2.32.0" assert_cli = "0.6.3" +[target.'cfg(windows)'.dependencies] +winapi = { version = "0.3.6", features = ["handleapi", "namedpipeapi", "processenv", "synchapi", "winerror"] } + [badges] travis-ci = { repository = "danreeves/cargo-cmd", branch = "master" } diff --git a/scripts/install.sh b/scripts/install.sh index 5e8f360..5b5d041 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -30,18 +30,13 @@ main() { ;; esac - # This fetches latest stable release - local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ - | cut -d/ -f3 \ - | grep -E '^v[0.1.0-9.]+$' \ - | $sort --version-sort \ - | tail -n1) - curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- \ - --force \ - --git japaric/cross \ - --tag $tag \ - --target $target + if [ $TRAVIS_OS_NAME = linux ]; then + cargo install cross --force + fi + + if [ $TRAVIS_OS_NAME = windows ]; then + choco install windows-sdk-10.0 + fi # Install test dependencies rustup component add rustfmt-preview diff --git a/scripts/script.sh b/scripts/script.sh index b47d28b..0c1f025 100644 --- a/scripts/script.sh +++ b/scripts/script.sh @@ -3,18 +3,26 @@ set -ex main() { - cross build --target $TARGET - cross build --target $TARGET --release + if [ $TRAVIS_OS_NAME = linux ]; then + cargo='cross' + else + cargo='cargo' + fi + + $cargo --version + + $cargo build --target $TARGET + $cargo build --target $TARGET --release if [ ! -z $DISABLE_TESTS ]; then return fi - cargo fmt -- --check - cargo +nightly clippy + $cargo fmt -- --check + $cargo +nightly clippy - cross test --target $TARGET - cross test --target $TARGET --release + $cargo test --target $TARGET + $cargo test --target $TARGET --release } # we don't run the "test phase" when doing deploys