diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d171e8222..2cb111a1a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ stages: - build - -Debian: + +.Debian: tags: - docker - linux @@ -14,20 +14,47 @@ Debian: before_script: - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - apt-get update -yq - - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt5opengl5-dev libopenal-dev libopenscenegraph-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev ccache + - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt5opengl5-dev libopenal-dev libopenscenegraph-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev ccache git clang stage: build script: - export CCACHE_BASEDIR="`pwd`" - export CCACHE_DIR="`pwd`/ccache" && mkdir -pv "$CCACHE_DIR" - - ccache -z -M 250M - - cores_to_use=$((`nproc`-2)); if (( $cores_to_use < 1 )); then cores_to_use=1; fi - - mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - - make -j$cores_to_use - - DESTDIR=artifacts make install + - ccache -z -M 1G + - CI/before_script.linux.sh + - cd build + - cmake --build . -- -j $(nproc) + - cmake --install . + - if [[ "${BUILD_TESTS_ONLY}" ]]; then ./openmw_test_suite; fi - ccache -s artifacts: paths: - - build/artifacts/ + - build/install/ + +Debian_GCC: + extends: .Debian + variables: + CC: gcc + CXX: g++ + +Debian_GCC_tests: + extends: .Debian + variables: + CC: gcc + CXX: g++ + BUILD_TESTS_ONLY: 1 + +Debian_Clang: + extends: .Debian + variables: + CC: clang + CXX: clang++ + +Debian_Clang_tests: + extends: .Debian + variables: + CC: clang + CXX: clang++ + BUILD_TESTS_ONLY: 1 MacOS: tags: @@ -228,4 +255,4 @@ Windows_MSBuild_CS_RelWithDebInfo: - .Windows_MSBuild_Base variables: <<: *cs-targets - config: "RelWithDebInfo" \ No newline at end of file + config: "RelWithDebInfo" diff --git a/.travis.yml b/.travis.yml index 36b15d794..8d98d0dd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,12 @@ matrix: os: linux dist: focal if: branch != coverity_scan + - name: OpenMW (tests only) on Ubuntu Focal with GCC + os: linux + dist: focal + if: branch != coverity_scan + env: + - BUILD_TESTS_ONLY: 1 - name: OpenMW (openmw) on Ubuntu Focal with Clang's Static Analysis os: linux dist: focal @@ -73,7 +79,7 @@ script: - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ${ANALYZE} make -j3; fi - if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi - if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then ../CI/check_package.osx.sh; fi - - if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi + - if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TESTS_ONLY}" ]; then ./openmw_test_suite; fi - if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi - cd "${TRAVIS_BUILD_DIR}" - ccache -s diff --git a/CI/before_script.linux.sh b/CI/before_script.linux.sh index f4aaeecc9..6df3dc32e 100755 --- a/CI/before_script.linux.sh +++ b/CI/before_script.linux.sh @@ -2,22 +2,43 @@ free -m -env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh -GOOGLETEST_DIR="$(pwd)/googletest/build" +if [[ "${BUILD_TESTS_ONLY}" ]]; then + export GOOGLETEST_DIR="$(pwd)/googletest/build/install" + env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh +fi mkdir build cd build -${ANALYZE} cmake \ - -DCMAKE_C_COMPILER="${CC}" \ - -DCMAKE_CXX_COMPILER="${CXX}" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DBUILD_UNITTESTS=TRUE \ - -DUSE_SYSTEM_TINYXML=TRUE \ - -DCMAKE_INSTALL_PREFIX="/usr" \ - -DBINDIR="/usr/games" \ - -DCMAKE_BUILD_TYPE="DEBUG" \ - -DGTEST_ROOT="${GOOGLETEST_DIR}" \ - -DGMOCK_ROOT="${GOOGLETEST_DIR}" \ - .. +if [[ "${BUILD_TESTS_ONLY}" ]]; then + ${ANALYZE} cmake \ + -D CMAKE_C_COMPILER="${CC}" \ + -D CMAKE_CXX_COMPILER="${CXX}" \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -D CMAKE_INSTALL_PREFIX=install \ + -D CMAKE_BUILD_TYPE=RelWithDebInfo \ + -D USE_SYSTEM_TINYXML=TRUE \ + -D BUILD_OPENMW=OFF \ + -D BUILD_BSATOOL=OFF \ + -D BUILD_ESMTOOL=OFF \ + -D BUILD_LAUNCHER=OFF \ + -D BUILD_MWINIIMPORTER=OFF \ + -D BUILD_ESSIMPORTER=OFF \ + -D BUILD_OPENCS=OFF \ + -D BUILD_WIZARD=OFF \ + -D BUILD_UNITTESTS=ON \ + -D GTEST_ROOT="${GOOGLETEST_DIR}" \ + -D GMOCK_ROOT="${GOOGLETEST_DIR}" \ + .. +else + ${ANALYZE} cmake \ + -D CMAKE_C_COMPILER="${CC}" \ + -D CMAKE_CXX_COMPILER="${CXX}" \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -D USE_SYSTEM_TINYXML=TRUE \ + -D CMAKE_INSTALL_PREFIX=install \ + -D CMAKE_BUILD_TYPE=Debug \ + .. +fi diff --git a/CI/build_googletest.sh b/CI/build_googletest.sh index 0ffda7f9b..a9a50fee7 100755 --- a/CI/build_googletest.sh +++ b/CI/build_googletest.sh @@ -1,13 +1,17 @@ -#!/bin/sh -e +#!/bin/sh -ex git clone -b release-1.10.0 https://github.com/google/googletest.git cd googletest mkdir build cd build cmake \ + -D CMAKE_C_COMPILER="${CC}" \ + -D CMAKE_CXX_COMPILER="${CXX}" \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_BUILD_TYPE="${CONFIGURATION}" \ - -D CMAKE_INSTALL_PREFIX=. \ + -D CMAKE_INSTALL_PREFIX="${GOOGLETEST_DIR}" \ -G "${GENERATOR}" \ .. -cmake --build . --config "${CONFIGURATION}" -cmake --build . --target install --config "${CONFIGURATION}" +cmake --build . --config "${CONFIGURATION}" -- -j $(nproc) +cmake --install . --config "${CONFIGURATION}"