Run tests on AppVeyor

This commit is contained in:
Peter Wagenet 2017-03-03 12:51:31 -08:00
parent 0eba4fa4db
commit 6b49fdfe34
6 changed files with 59 additions and 16 deletions

19
.appveyor.yml Normal file
View File

@ -0,0 +1,19 @@
# TODO: Maybe add caching
environment:
IMPLEMENTATION: RUST
EXAMPLES: console membership turbo_blank
VERBOSE: true
# This isn't expected to pass yet
#- EXAMPLES="duration"
install:
- set PATH=C:\Ruby23\bin;C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;%HOMEPATH%\.cargo\bin;%APPVEYOR_BUILD_FOLDER%\ruby\windows_build;%PATH%
- set HELIX_ROOT=%APPVEYOR_BUILD_FOLDER%
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly --default-host i686-pc-windows-msvc -y
- bash ./scripts/ci-install
test_script:
- bash ./scripts/ci-test
build: off

View File

@ -12,22 +12,19 @@ cache:
- $TRAVIS_BUILD_DIR/target
env:
- EXAMPLES="console"
# These aren't expected to pass yet
#- EXAMPLES="console duration membership turbo_blank"
global:
- IMPLEMENTATION=RUST
- EXAMPLES="console membership turbo_blank"
- VERBOSE=true
# This isn't expected to pass yet
#- EXAMPLES="duration"
before_install:
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
- export PATH="$HOME/.cargo/bin:$PATH"
install:
- cd ruby
- bundle install
- cd ..
- bash -c "./examples/runner install $EXAMPLES"
- ./scripts/ci-install
script:
- cd ruby
- rake rspec
- cd ..
- bash -c "./examples/runner test $EXAMPLES"
- ./scripts/ci-test

View File

@ -16,7 +16,7 @@ fn main() {
// Read info about current Ruby install
let raw_ruby_info = Command::new("ruby")
.arg(root.join("scripts/ruby_info.rb"))
.arg(root.join("scripts").join("ruby_info.rb"))
.output()
.expect("failed to get Ruby info");
let raw_ruby_output = String::from_utf8_lossy(&raw_ruby_info.stdout);
@ -34,11 +34,13 @@ fn main() {
fs::copy(ruby_libdir.join(libruby), out_dir.join(ruby_libname).with_extension("lib"))
.expect("unable to copy libruby");
let windows_build_dir = root.join("ruby").join("windows_build");
// Set up linker
println!("cargo:rustc-flags=-L {libpath} -l dylib={libruby} -L {root}/ruby/windows_build",
println!("cargo:rustc-flags=-L {libpath} -l dylib={libruby} -L {windows_build}",
libpath=out_dir.to_str().expect("can't get str from out_dir"),
libruby=ruby_libname,
root=root.to_str().expect("can't get str from root"));
windows_build=windows_build_dir.to_str().expect("can't get str from root"));
}
}

View File

@ -14,8 +14,9 @@ end
if RUBY_PLATFORM =~ /mingw/
Rake::Task["compile:native:#{RUBY_PLATFORM}"].enhance do
mkdir_p "#{__dir__}/windows_build"
res = system("lib -def:#{__dir__}/ext/helix_runtime/native/native.def -out:#{__dir__}/windows_build/helix-runtime.lib")
abort "can't build helix-runtime.lib" unless res
sh "lib.exe /def:#{File.expand_path("ext/helix_runtime/native/native.def", __dir__)} " \
"/out:#{File.expand_path("windows_build/helix-runtime.lib", __dir__)}"
# Windows looks for a .dll in PATH
cp "#{__dir__}/lib/helix_runtime/native.so", "#{__dir__}/windows_build/helix-runtime.dll"

12
scripts/ci-install Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -x
set -e
DIR=$(dirname "${BASH_SOURCE[0]}")/..
pushd "$DIR/ruby"
bundle install
popd
$DIR/examples/runner install $EXAMPLES

12
scripts/ci-test Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -x
set -e
DIR=$(dirname "${BASH_SOURCE[0]}")/..
pushd "$DIR/ruby"
bundle exec rake rspec
popd
$DIR/examples/runner test $EXAMPLES