diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..c00161a --- /dev/null +++ b/.appveyor.yml @@ -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 diff --git a/.travis.yml b/.travis.yml index 011e4e9..8246ff7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/crates/libcruby-sys/build.rs b/crates/libcruby-sys/build.rs index 34426be..5e38220 100644 --- a/crates/libcruby-sys/build.rs +++ b/crates/libcruby-sys/build.rs @@ -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")); } } diff --git a/ruby/Rakefile b/ruby/Rakefile index c98395d..040d61c 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -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" diff --git a/scripts/ci-install b/scripts/ci-install new file mode 100755 index 0000000..2ad872c --- /dev/null +++ b/scripts/ci-install @@ -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 diff --git a/scripts/ci-test b/scripts/ci-test new file mode 100755 index 0000000..e83b564 --- /dev/null +++ b/scripts/ci-test @@ -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