1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-21 17:17:06 +02:00

Travis CI: update config and upload artifacts after build

This commit is contained in:
Arseniy Shestakov 2017-06-12 18:17:10 +03:00
parent 9623f7caf3
commit 0c7eeeaa5c
10 changed files with 123 additions and 52 deletions

View File

@ -1,52 +1,40 @@
language: cpp
os:
- linux
- osx
- linux
- osx
dist: trusty
sudo: required
before_install:
- test $TRAVIS_BRANCH != coverity_scan -o ${TRAVIS_JOB_NUMBER##*.} = 1 || exit 0
- if [[ $VCMI_PLATFORM == 'linux' ]]; then . .travis.linux; fi
- if [[ $VCMI_PLATFORM == 'mac' ]]; then . .travis.osx; fi
- if [[ $VCMI_PLATFORM == 'mxe' ]]; then . .travis.mxe; fi
before_script:
- mkdir build
- cd build
- if [[ $TRAVIS_BRANCH != 'coverity_scan' ]]; then cmake -G "Unix Makefiles" .. $VCMI_CMAKE_FLAGS; fi
script:
- test $TRAVIS_BRANCH != coverity_scan || exit 0
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cd ..; xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release CONFIGURATION_BUILD_DIR=..; cd build; fi
- make -j2
env:
matrix:
- ignore=this
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "NMg+qtQB4DIZ/KqlDeIn3K7A7Ydksdpnbv6Ha9n4bSSA0AT8wlPwbHXvQmiR8qYs6cnz4fyY6NVcBe7X3bdR8jWyPNAS0l0QByqG12q3dBpEtNNn0X5u/GS3wHse5+ObNAF9a83+xACTQj2UdxqHgJ3LFGzdBpQt3kLsc8NDnn8="
- secure: NMg+qtQB4DIZ/KqlDeIn3K7A7Ydksdpnbv6Ha9n4bSSA0AT8wlPwbHXvQmiR8qYs6cnz4fyY6NVcBe7X3bdR8jWyPNAS0l0QByqG12q3dBpEtNNn0X5u/GS3wHse5+ObNAF9a83+xACTQj2UdxqHgJ3LFGzdBpQt3kLsc8NDnn8=
cache:
timeout: 500
directories:
- $HOME/Library/Caches/Homebrew
matrix:
exclude:
- env: ignore=this
- env: ignore=this
include:
- os: linux
compiler: clang
env: VCMI_PLATFORM='linux' REAL_CC=clang-3.6 REAL_CXX=clang++-3.6 PACKAGE=clang-3.6 SUPPORT=libstdc++-4.8-dev VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
- os: linux
compiler: clang
env: VCMI_PLATFORM='linux' REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=libstdc++-4.8-dev VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
- os: linux
compiler: gcc
env: VCMI_PLATFORM='linux' REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
- os: linux
env: VCMI_PLATFORM='mxe' MXE_TARGET=i686-w64-mingw32.shared VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
sudo: required
- os: osx
env: VCMI_PLATFORM='mac'
- os: linux
compiler: clang
env: VCMI_PLATFORM='linux' REAL_CC=clang-3.6 REAL_CXX=clang++-3.6 PACKAGE=clang-3.6
SUPPORT=libstdc++-4.8-dev VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
- os: linux
compiler: clang
env: VCMI_PLATFORM='linux' REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4
SUPPORT=libstdc++-4.8-dev VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
- os: linux
compiler: gcc
env: VCMI_PLATFORM='linux' REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT=
VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
- os: linux
env: VCMI_PLATFORM='mxe' MXE_TARGET=i686-w64-mingw32.shared VCMI_CMAKE_FLAGS='-DENABLE_TEST=0'
sudo: required
- os: osx
env: VCMI_PLATFORM='mac'
addons:
coverity_scan:
@ -54,15 +42,37 @@ addons:
name: vcmi/vcmi
description: Build submitted via Travis CI
notification_email: coverity@arseniyshestakov.com
build_command_prepend: "cov-configure --compiler clang-3.6 --comptype clangcc && cov-configure --comptype clangcxx --compiler clang++-3.6 && cmake -G Ninja .. -DCMAKE_BUILD_TYPE=DEBUG -DENABLE_LAUNCHER=0 -DENABLE_TEST=0"
build_command_prepend: cov-configure --compiler clang-3.6 --comptype clangcc &&
cov-configure --comptype clangcxx --compiler clang++-3.6 && cmake -G Ninja ..
-DCMAKE_BUILD_TYPE=DEBUG -DENABLE_LAUNCHER=0 -DENABLE_TEST=0
build_command: ninja -j 3
branch_pattern: coverity_scan
notifications:
email:
recipients:
- noreply@vcmi.eu
- noreply@vcmi.eu
on_success: change
on_failure: always
slack:
secure: "KHXFe14FFKtw5mErWbj730+utqy7i/3AUobWfAMAGvWI5sJYlhbBU+KvvCoD2SlRQg3mQqgwVw8NBJF1Mffs7WcRmrFFFmuMqZxFLAfKBd3T0CxWpAGfnfNgDmlfV4OfEgQWk1pakEPOymhxbbmLUuCjykZDuTcioxAk0UAHDwY="
secure: KHXFe14FFKtw5mErWbj730+utqy7i/3AUobWfAMAGvWI5sJYlhbBU+KvvCoD2SlRQg3mQqgwVw8NBJF1Mffs7WcRmrFFFmuMqZxFLAfKBd3T0CxWpAGfnfNgDmlfV4OfEgQWk1pakEPOymhxbbmLUuCjykZDuTcioxAk0UAHDwY=
before_install:
- test $TRAVIS_BRANCH != coverity_scan -o ${TRAVIS_JOB_NUMBER##*.} = 1 || exit 0
- . $TRAVIS_BUILD_DIR/CI/$VCMI_PLATFORM/before_install.sh
before_script:
- mkdir build
- cd build
- test $TRAVIS_BRANCH != coverity_scan || exit 0
- source $TRAVIS_BUILD_DIR/CI/get_package_name.sh
- cmake -G "Unix Makefiles" .. $VCMI_CMAKE_FLAGS -DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" -DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"
script:
- test $TRAVIS_BRANCH != coverity_scan || exit 0
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then cd ..; xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release CONFIGURATION_BUILD_DIR=..; cd build; fi
- make -j2
after_success:
- test $TRAVIS_BRANCH != coverity_scan || exit 0
- . $TRAVIS_BUILD_DIR/CI/$VCMI_PLATFORM/upload_package.sh

BIN
CI/deploy_rsa.enc Normal file

Binary file not shown.

16
CI/get_package_name.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
VCMI_PACKAGE_FILE_NAME="${TRAVIS_JOB_ID}-vcmi"
VCMI_PACKAGE_NAME_SUFFIX=""
if [ "$TRAVIS_PULL_REQUEST" = "false" ];
then
branch_name=$(echo "$TRAVIS_BRANCH" | sed 's/[^[:alnum:]]\+/_/g')
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-branch-${branch_name}-${TRAVIS_COMMIT}"
VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}"
else
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"
VCMI_PACKAGE_NAME_SUFFIX="PR ${TRAVIS_PULL_REQUEST}"
fi
VCMI_PACKAGE_NAME_SUFFIX="(${VCMI_PACKAGE_NAME_SUFFIX})"
export VCMI_PACKAGE_FILE_NAME
export VCMI_PACKAGE_NAME_SUFFIX

View File

@ -0,0 +1 @@
#!/bin/sh

View File

@ -14,4 +14,4 @@ wget https://github.com/sparkle-project/Sparkle/releases/download/$sparkle_versi
mkdir sparkle && cd sparkle
tar -xf ../Sparkle-*.tar.bz2
sudo mv Sparkle.framework /Library/Frameworks/
cd .. && rm -rf sparkle
cd .. && rm -rf sparkle

10
CI/mac/upload_package.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
cpack
touch /tmp/deploy_rsa
chmod 600 /tmp/deploy_rsa
openssl aes-256-cbc -K $encrypted_1d30f79f8582_key -iv $encrypted_1d30f79f8582_iv -in $TRAVIS_BUILD_DIR/CI/deploy_rsa.enc -out /tmp/deploy_rsa -d
eval "$(ssh-agent -s)"
ssh-add /tmp/deploy_rsa
sftp -r -o StrictHostKeyChecking=no travis@beholder.vcmi.eu <<< "put $VCMI_PACKAGE_FILE_NAME.dmg /incoming/$VCMI_PACKAGE_FILE_NAME.dmg"

View File

@ -22,6 +22,9 @@ mxe-$MXE_TARGET-ffmpeg \
mxe-$MXE_TARGET-qt \
mxe-$MXE_TARGET-qtbase
# Install nsis for installer creation
sudo apt-get install -qq nsis
# alias for CMake
sudo mv /usr/bin/cmake /usr/bin/cmake.orig
sudo ln -s /usr/lib/mxe/usr/bin/$MXE_TARGET-cmake /usr/bin/cmake

10
CI/mxe/upload_package.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
cpack
touch /tmp/deploy_rsa
chmod 600 /tmp/deploy_rsa
openssl aes-256-cbc -K $encrypted_1d30f79f8582_key -iv $encrypted_1d30f79f8582_iv -in $TRAVIS_BUILD_DIR/CI/deploy_rsa.enc -out /tmp/deploy_rsa -d
eval "$(ssh-agent -s)"
ssh-add /tmp/deploy_rsa
sftp -r -o StrictHostKeyChecking=no travis@beholder.vcmi.eu <<< "put $VCMI_PACKAGE_FILE_NAME.exe /incoming/$VCMI_PACKAGE_FILE_NAME.exe"

View File

@ -16,6 +16,10 @@ set(VCMI_VERSION_MAJOR 0)
set(VCMI_VERSION_MINOR 99)
set(VCMI_VERSION_PATCH 0)
# Allow to pass package name from Travis CI
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
@ -238,14 +242,17 @@ endif()
# For apple these files will be already inside vcmiclient bundle
if (NOT APPLE)
# copy whole directory but .svn control files
install(DIRECTORY config DESTINATION ${DATA_DIR} PATTERN ".svn" EXCLUDE)
install(DIRECTORY config DESTINATION ${DATA_DIR})
# copy vcmi mod along with all its content
install(DIRECTORY Mods/vcmi DESTINATION ${DATA_DIR}/Mods PATTERN ".svn" EXCLUDE)
install(DIRECTORY Mods/vcmi DESTINATION ${DATA_DIR}/Mods)
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
# that script is useless for Windows
if (NOT WIN32)
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
endif()
endif()
if(WIN32)
@ -317,15 +324,28 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
if("${PACKAGE_NAME_SUFFIX}" STREQUAL "")
set(CPACK_PACKAGE_NAME "VCMI")
else()
set(CPACK_PACKAGE_NAME "VCMI ${PACKAGE_NAME_SUFFIX}")
endif()
if("${PACKAGE_FILE_NAME}" STREQUAL "")
set(CPACK_PACKAGE_FILE_NAME "vcmi-${CPACK_PACKAGE_VERSION}")
else()
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_FILE_NAME}")
endif()
set(CPACK_PACKAGE_VENDOR "VCMI team")
if(WIN32)
set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_PACKAGE_NAME "VCMI")
set(CPACK_PACKAGE_VENDOR "VCMI team")
set(CPACK_PACKAGE_FILE_NAME "vcmi-${CPACK_PACKAGE_VERSION}-win32")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}")
if("${PACKAGE_NAME_SUFFIX}" STREQUAL "")
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}")
else()
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION} ${PACKAGE_NAME_SUFFIX} ")
endif()
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Delete \\\"$DESKTOP\\\\VCMI.lnk\\\" ")
@ -340,8 +360,9 @@ else()
set(CPACK_GENERATOR TGZ)
endif()
INCLUDE(CPack)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY)
INCLUDE(CPack)