Skip to content

Commit

Permalink
Initial Travis Windows support (#1644)
Browse files Browse the repository at this point in the history
* Initial Travis Windows support

* Whitespace changes

* More Whitespace

* use OSTYPE case
  • Loading branch information
argakiig authored Jan 31, 2019
1 parent 82734f2 commit 00dd12a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ matrix:
packages:
- doxygen
- os: osx
- os: windows
cache:
- ccache: false

compiler:
- clang
Expand All @@ -30,16 +33,20 @@ before_install:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install qt5 && brew cask install xquartz && brew install rust; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo mkdir -p /etc/docker && echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json && sudo service docker restart; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then ci/build-docker-image.sh docker/ci/Dockerfile nanocurrency/nano-ci; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install -y nuget.commandline; fi

install:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then util/build_prep/windows/prep.sh; fi

script:
- if [ -n "$ONE_TIME_TESTS" ]; then ci/check-commit-format.sh; fi
- if [ -n "$ONE_TIME_TESTS" ]; then doxygen doxygen.config; fi # TODO also deploy the built HTML
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ci/build-travis.sh "/usr/local/opt/qt5/lib/cmake/Qt5"; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then docker run -v $TRAVIS_BUILD_DIR:/workspace -v $HOME/.ccache:/ccache -v $HOME/.cargo:/cargo nanocurrency/nano-ci /bin/bash -c "apt install ccache; cd /workspace && ASAN=${ASAN} TSAN=${TSAN} CCACHE_DIR=/ccache CARGO_HOME=/cargo ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then ./ci/build-travis-win.sh; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then ./ci/test.sh ./build_win/Debug; fi

deploy:
provider: script
Expand Down
24 changes: 24 additions & 0 deletions ci/build-travis-win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

export PATH="$PATH:/c/Program Files (x86)/Microsoft Visual Studio/Installer/"
export MSVC=$(vswhere -latest -products "*" -requires Microsoft.Component.MSBuild -property installationPath)
export MSVC=$(echo /$MSVC | sed -e 's/\\/\//g' -e 's/://')
export PATH="$PATH:$MSVC/MSBuild/15.0/Bin/"

NANO_ROOT=`PWD`
mkdir build_win
cd build_win

cmake \
-G'Visual Studio 15 2017 Win64' \
-DACTIVE_NETWORK=nano_test_network \
-DNANO_TEST=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DBOOST_ROOT="~/platform/boost/" \
-DIPHLPAPI_LIBRARY="/c/Program Files (x86)/Windows Kits/10/Lib/10.0.17134.0/um/x64/iphlpapi.Lib" \
-DWINSOCK2_LIBRARY="/c/Program Files (x86)/Windows Kits/10/Lib/10.0.17134.0/um/x64/WS2_32.Lib" \
-Dgtest_force_shared_crt=true \
$NANO_ROOT

cmd.exe /C "MSBuild.exe \"nano/core_test/core_test.vcxproj\" /m"
15 changes: 15 additions & 0 deletions ci/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.66.0.0" targetFramework="native" />
<package id="boost_filesystem-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_log-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_program_options-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_thread-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_system-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_date_time-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_atomic-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_regex-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_chrono-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_log_setup-vc141" version="1.66.0.0" targetFramework="native" />
<package id="qt5baseqt5WinExtras" version="5.11.0" targetFramework="native" />
</packages>
10 changes: 9 additions & 1 deletion ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ run_tests() {
sleep $[60 + (${RANDOM} % 30)]
fi

${TIMEOUT_CMD} ${TIMEOUT_TIME_ARG} ${TIMEOUT_SEC-${TIMEOUT_DEFAULT}} ./core_test
case "${OSTYPE}" in
msys|cygwin)
executableSuffix='.exe'
;;
*)
executableSuffix=''
;;
esac
${TIMEOUT_CMD} ${TIMEOUT_TIME_ARG} ${TIMEOUT_SEC-${TIMEOUT_DEFAULT}} ./core_test${executableSuffix}
core_test_res=${?}
if [ "${core_test_res}" = '0' ]; then
break
Expand Down
14 changes: 14 additions & 0 deletions util/build_prep/windows/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.66.0.0" targetFramework="native" />
<package id="boost_filesystem-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_log-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_program_options-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_thread-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_system-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_date_time-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_atomic-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_regex-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_chrono-vc141" version="1.66.0.0" targetFramework="native" />
<package id="boost_log_setup-vc141" version="1.66.0.0" targetFramework="native" />
</packages>
6 changes: 6 additions & 0 deletions util/build_prep/windows/prep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

mkdir -p ~/platform/boost/lib
nuget install ./util/build_prep/windows/packages.config -ExcludeVersion -OutputDirectory ~/tmp
cp ~/tmp/boost_*/lib/native/libboost*.lib ~/platform/boost/lib
mv ~/tmp/boost/lib/native/include/* ~/platform/boost/

0 comments on commit 00dd12a

Please sign in to comment.