Use Travis for Win builds as well

This commit is contained in:
Jakub Konka
2019-06-27 11:05:54 +02:00
committed by Jakub Konka
parent 667f272edd
commit c3994bf57b
5 changed files with 40 additions and 111 deletions

View File

@@ -1,43 +1,50 @@
# Travis CI script borrows heavily from CraneStation/wasmtime project.
os:
- linux
- osx
- linux
- osx
- windows
language: rust
rust:
- 1.36.0
- stable
- beta
- nightly
matrix:
allow_failures:
# We try to be compatible with beta and nightly, but they occasionally
# fail, so we don't allow them to hold up people using stable.
- rust: beta
- rust: nightly
# Similarly, we don't need to hold up people using stable while we wait
# for the results which may fail.
fast_finish: true
allow_failures:
# We try to be compatible with beta and nightly, but they occasionally
# fail, so we don't allow them to hold up people using stable.
- rust: beta
- rust: nightly
# Similarly, we don't need to hold up people using stable while we wait
# for the results which may fail.
fast_finish: true
dist: xenial
sudo: false
branches:
only:
- master
before_script:
# If an old version of rustfmt from cargo is already installed, uninstall
# it, since it can prevent the installation of the new version from rustup.
- cargo uninstall rustfmt || true
- cargo install --list
# If we're testing beta or nightly, we still need to install the stable
# toolchain so that we can run the stable version of rustfmt.
- rustup toolchain install stable
# Install the stable version of rustfmt.
- rustup component add --toolchain=stable rustfmt-preview
- rustup component list --toolchain=stable
- rustup show
- rustfmt +stable --version || echo fail
# Sometimes the component isn't actually ready after being installed, and
# rustup update makes it ready.
- rustup update
- rustfmt +stable --version
script: ./test-all.sh
# Caching done according to pointers found in
# https://levans.fr/rust_travis_cache.html
cache:
cargo: true
directories:
- $HOME/.cargo
before_cache:
- rm -rf /home/travis/.cargo/registry
before_install:
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install python3; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then export PATH="/c/Python37:/c/Python37/Scripts:$PATH"; fi
before_script:
# If an old version of rustfmt from cargo is already installed, uninstall
# it, since it can prevent the installation of the new version from rustup.
- cargo uninstall rustfmt || true
- cargo install --list
# If we're testing beta or nightly, we still need to install the stable
# toolchain so that we can run the stable version of rustfmt.
- rustup toolchain install stable
# Install the stable version of rustfmt.
- rustup component add --toolchain=stable rustfmt-preview
- rustup component list --toolchain=stable
- rustup show
- rustfmt +stable --version || echo fail
# Sometimes the component isn't actually ready after being installed, and
# rustup update makes it ready.
- rustup update
- rustfmt +stable --version
script: ./test-all.sh

View File

@@ -1,10 +1,8 @@
# wasi-common
[![travis-build-status]][travis] [![appveyor-build-status]][appveyor] [![rustc-1.36]][rustc]
[![travis-build-status]][travis] [![rustc-1.36]][rustc]
[travis-build-status]: https://travis-ci.org/CraneStation/wasi-common.svg?branch=master
[travis]: https://travis-ci.org/CraneStation/wasi-common
[appveyor-build-status]: https://ci.appveyor.com/api/projects/status/github/cranestation/wasi-common?svg=true
[appveyor]: https://ci.appveyor.com/project/cranestation/wasi-common
[rustc-1.36]: https://img.shields.io/badge/rustc-1.36+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html
[Wasmtime]: https://github.com/CraneStation/wasmtime

View File

@@ -1,13 +0,0 @@
os: Visual Studio 2017
environment:
matrix:
- TARGET: x86_64-pc-windows-msvc
install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -yv --default-host %target%
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustc -vV
- cargo -vV
- rustup component add rustfmt
build: false
test_script: test-all.bat

View File

@@ -1,17 +0,0 @@
@echo off
setlocal
@rem Format all sources using rustfmt.
@rem This script is an adaption of the shell version
@rem 'format-all.sh'.
for /F "delims=" %%i in ("%%~f0") do set dirname=%%~dpi
cd %dirname%
@REM Make sure we can find rustfmt
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
cmd /C cargo +stable fmt --all -- %*
endlocal
exit /b %ERRORLEVEL%

View File

@@ -1,46 +0,0 @@
@echo off
setlocal
@rem This is the top-level test script.
@rem It is an adaption of the shell script "test-all.sh".
@rem - Check code formatting.
@rem - Make a debug build.
@rem - Make a release build.
@rem - Run unit tests for all Rust crates
@rem - Build API documentation.
@rem All tests run by this script should be passing at all times.
for /F "delims=" %%i in ("%%~f0") do set dirname=%%~dpi
cd %dirname%
call :banner Rust formatting
cmd /c "%dirname%format-all.bat --check"
if %errorlevel% neq 0 (
echo Formatting diffs detected! Run "cargo fmt --all" to correct.
goto error
)
call :banner Release build
cmd /c cargo build --release || goto error
call :banner Debug build
cmd /c cargo build || goto error
call :banner Rust unit and integration tests
set RUST_BACKTRACE=1
cmd /c cargo test --all || goto error
call :banner Rust documentation: %dirname%target\doc\wasi-common\index.html
cmd /c cargo doc || goto error
call :banner OK
endlocal
exit /b %ERRORLEVEL%
:banner
echo ===== %* =====
exit /b 0
:error
exit /b 1