Skip to content

Commit

Permalink
Added travis scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavidberger committed Aug 30, 2020
1 parent 6a8457d commit 1bc3162
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 19 deletions.
26 changes: 8 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,24 @@ jobs:
- os: linux
env: USE_ASAN=OFF CONFIG=Release
- os: windows
env: CONFIG=Release
env: CONFIG=Release CMAKE_GENERATOR_PLATFORM=x64 CMAKE_GENERATOR="Visual Studio 15 2017" VERBOSE=1

before_install:
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then sudo apt-get update -qq; fi
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then sudo apt-get install -y p7zip-full build-essential zlib1g-dev libx11-dev libusb-1.0-0-dev freeglut3-dev liblapacke-dev libopenblas-dev libatlas-base-dev libpcap-dev python3 python3-pip; fi
install:
- ./useful_files/travis/$TRAVIS_OS_NAME.install.sh

script:
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then virtualenv --python=python3 venv; fi
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then source ./venv/bin/activate; fi
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then python3 setup.py install; fi
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then cd bindings/python; fi
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then python3 ./example.py --simulator --simulator-time .1 --playback-factor 0; fi
- if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then cd ../..; fi
- mkdir -p bin
- cd bin
- cmake -DENABLE_TESTS=ON -DUSE_ASAN=${USE_ASAN} -DCMAKE_BUILD_TYPE=${CONFIG} ..
- cmake --build . --config ${CONFIG}
- ctest . -C ${CONFIG} --output-on-failure -j30
- ./useful_files/travis/$TRAVIS_OS_NAME.sh

before_deploy:
- if [[ "$TRAVIS_OS_NAME" == 'linux' ]]; then 7z a ../libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME.7z . -xr@../travis-exclusion.lst; fi
- if [[ "$TRAVIS_OS_NAME" == 'windows' ]]; then 7z a libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME.7z ./Release/*; fi
- ./useful_files/travis/$TRAVIS_OS_NAME.before_deploy.sh

deploy:
- provider: releases
api_key: $GITHUB_TOKEN
file: libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME.7z
file: libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME-$CONFIG.7z
skip_cleanup: true
on:
branch: master
condition: $CONFIG=Release
tags: true

12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ IF(TARGET survive-cli)
install(PROGRAMS ${SURVIVE_WEBSOCKETD} DESTINATION bin)
endif()

find_program(DOTNET dotnet)
if(DOTNET)
execute_process(
COMMAND ${DOTNET} build -c Release
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/)

file(GLOB_RECURSE CS_BINDINGS
"${CMAKE_CURRENT_SOURCE_DIR}/bindings/cs/libsurvive.net/bin/Release/*.dll")

install(FILES ${CS_BINDINGS} DESTINATION "lib")
endif()

install(DIRECTORY include/libsurvive DESTINATION include)

file(GLOB REDIST_HEADERS
Expand Down
2 changes: 1 addition & 1 deletion bindings/cs/Demo/Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions useful_files/travis/linux.before_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7z a libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME-$CONFIG.7z ./bin/INSTALL_ROOT/ ./dist/pysurvive-*.egg
7 changes: 7 additions & 0 deletions useful_files/travis/linux.install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set -o xtrace

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update -qq
sudo apt-get install -y p7zip-full build-essential zlib1g-dev libx11-dev libusb-1.0-0-dev freeglut3-dev liblapacke-dev libopenblas-dev libatlas-base-dev libpcap-dev python3 python3-pip apt-transport-https dotnet-sdk-3.1
10 changes: 10 additions & 0 deletions useful_files/travis/linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
virtualenv --python=python3 venv
source ./venv/bin/activate
python3 setup.py install
cd bindings/python
python3 ./example.py --simulator --simulator-time .1 --playback-factor 0
cd ../..
./useful_files/travis/shared.sh

cd bin
sudo make install
8 changes: 8 additions & 0 deletions useful_files/travis/shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set -o xtrace

mkdir -p bin
cd bin
cmake -DENABLE_TESTS=ON -DUSE_ASAN=${USE_ASAN} -DCMAKE_BUILD_TYPE=${CONFIG} -DCMAKE_INSTALL_PREFIX=INSTALL_ROOT ..
cmake --build . --config ${CONFIG}
ctest . -C ${CONFIG} --output-on-failure -j30

1 change: 1 addition & 0 deletions useful_files/travis/windows.before_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7z a libsurvive-$TRAVIS_TAG-$TRAVIS_OS_NAME-$CONFIG.7z ./bin/INSTALL_ROOT/ ./*/pysurvive-*.egg
14 changes: 14 additions & 0 deletions useful_files/travis/windows.install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -o xtrace

#choco upgrade dotnetcore
choco install python

export PATH="/c/Python38/:$PATH"
python -m ensurepip
python -m pip install wheel setuptools ctypesgen

#choco install visualstudio2019community
#choco install visualstudio2019-workload-nativedesktop



14 changes: 14 additions & 0 deletions useful_files/travis/windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -o xtrace

#export VS160COMNTOOLS="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools"
export PATH="/c/Python38/:/c/Python38/scripts:$PATH"

python setup.py install
cd bindings/python
python ./example.py --simulator --simulator-time .1 --playback-factor 0
cd ../..

./useful_files/travis/shared.sh

cd bin
cmake --build . --target install --config Release

0 comments on commit 1bc3162

Please sign in to comment.