Skip to content

Commit

Permalink
CI in Windows (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
danreeves authored Oct 12, 2018
1 parent b7b4db9 commit ba0b6f7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
19 changes: 7 additions & 12 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions scripts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba0b6f7

Please sign in to comment.