language: rust dist: xenial rust: - stable - beta - nightly addons: apt: packages: - mingw-w64 - upx - musl - musl-dev - musl-tools matrix: allow_failures: - rust: stable - rust: beta include: - rust: nightly env: - TARGET=x86_64-unknown-linux-musl - BIN_NAME=miniserve - PROPER_NAME=miniserve-linux-x86_64 os: linux - rust: nightly env: - TARGET=x86_64-pc-windows-gnu - BIN_NAME=miniserve.exe - PROPER_NAME=miniserve-win-x86_64.exe - RUSTFLAGS="-C linker=x86_64-w64-mingw32-gcc" os: linux - rust: nightly env: - TARGET=x86_64-apple-darwin - BIN_NAME=miniserve - PROPER_NAME=miniserve-osx-x86_64 os: osx before_install: - rustup self update - rustup update install: # On Apple, the default target is already the right one. - if [[ -n $TARGET && $TARGET != "x86_64-apple-darwin" ]]; then rustup target add $TARGET; fi script: # If this is a normal, non-deployment build... - if [[ -z $TARGET ]]; then cargo build --verbose && RUST_BACKTRACE=1 cargo test; fi - if [[ -n $TARGET ]]; then cargo build --verbose --release --target $TARGET; fi before_deploy: # If this is a binary deployment... - if [[ -n $TARGET ]]; then cp -a target/$TARGET/release/$BIN_NAME $PROPER_NAME && strip $PROPER_NAME; fi - # Run upx on the binary if this is a deployment for Linux or Windows - if [[ $TARGET = "x86_64-pc-windows-gnu" ]]; then upx $PROPER_NAME; fi - if [[ $TARGET = "x86_64-unknown-linux-musl" ]]; then upx $PROPER_NAME; fi deploy: - provider: releases api_key: secure: "$GITHUB_API_KEY" file: $PROPER_NAME skip_cleanup: true on: branch: master tags: true condition: $TRAVIS_RUST_VERSION = nightly && -n $TARGET