Merge branch 'gitlab_tests' into 'master'

Run unit tests in gitlab CI for linux build

See merge request OpenMW/openmw!314
pull/593/head
psi29a 4 years ago
commit 21fa55de8e

@ -1,7 +1,7 @@
stages: stages:
- build - build
Debian: .Debian:
tags: tags:
- docker - docker
- linux - linux
@ -14,20 +14,47 @@ Debian:
before_script: before_script:
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
- apt-get update -yq - 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 stage: build
script: script:
- export CCACHE_BASEDIR="`pwd`" - export CCACHE_BASEDIR="`pwd`"
- export CCACHE_DIR="`pwd`/ccache" && mkdir -pv "$CCACHE_DIR" - export CCACHE_DIR="`pwd`/ccache" && mkdir -pv "$CCACHE_DIR"
- ccache -z -M 250M - ccache -z -M 1G
- cores_to_use=$((`nproc`-2)); if (( $cores_to_use < 1 )); then cores_to_use=1; fi - CI/before_script.linux.sh
- mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - cd build
- make -j$cores_to_use - cmake --build . -- -j $(nproc)
- DESTDIR=artifacts make install - cmake --install .
- if [[ "${BUILD_TESTS_ONLY}" ]]; then ./openmw_test_suite; fi
- ccache -s - ccache -s
artifacts: artifacts:
paths: 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: MacOS:
tags: tags:
@ -228,4 +255,4 @@ Windows_MSBuild_CS_RelWithDebInfo:
- .Windows_MSBuild_Base - .Windows_MSBuild_Base
variables: variables:
<<: *cs-targets <<: *cs-targets
config: "RelWithDebInfo" config: "RelWithDebInfo"

@ -45,6 +45,12 @@ matrix:
os: linux os: linux
dist: focal dist: focal
if: branch != coverity_scan 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 - name: OpenMW (openmw) on Ubuntu Focal with Clang's Static Analysis
os: linux os: linux
dist: focal dist: focal
@ -73,7 +79,7 @@ script:
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ${ANALYZE} make -j3; fi - 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 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}" = "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 - if [ "${COVERITY_SCAN_BRANCH}" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi
- cd "${TRAVIS_BUILD_DIR}" - cd "${TRAVIS_BUILD_DIR}"
- ccache -s - ccache -s

@ -2,22 +2,43 @@
free -m free -m
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh if [[ "${BUILD_TESTS_ONLY}" ]]; then
GOOGLETEST_DIR="$(pwd)/googletest/build" export GOOGLETEST_DIR="$(pwd)/googletest/build/install"
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh
fi
mkdir build mkdir build
cd build cd build
${ANALYZE} cmake \ if [[ "${BUILD_TESTS_ONLY}" ]]; then
-DCMAKE_C_COMPILER="${CC}" \ ${ANALYZE} cmake \
-DCMAKE_CXX_COMPILER="${CXX}" \ -D CMAKE_C_COMPILER="${CC}" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \
-DBUILD_UNITTESTS=TRUE \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DUSE_SYSTEM_TINYXML=TRUE \ -D CMAKE_INSTALL_PREFIX=install \
-DCMAKE_INSTALL_PREFIX="/usr" \ -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-DBINDIR="/usr/games" \ -D USE_SYSTEM_TINYXML=TRUE \
-DCMAKE_BUILD_TYPE="DEBUG" \ -D BUILD_OPENMW=OFF \
-DGTEST_ROOT="${GOOGLETEST_DIR}" \ -D BUILD_BSATOOL=OFF \
-DGMOCK_ROOT="${GOOGLETEST_DIR}" \ -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

@ -1,13 +1,17 @@
#!/bin/sh -e #!/bin/sh -ex
git clone -b release-1.10.0 https://github.com/google/googletest.git git clone -b release-1.10.0 https://github.com/google/googletest.git
cd googletest cd googletest
mkdir build mkdir build
cd build cd build
cmake \ 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_BUILD_TYPE="${CONFIGURATION}" \
-D CMAKE_INSTALL_PREFIX=. \ -D CMAKE_INSTALL_PREFIX="${GOOGLETEST_DIR}" \
-G "${GENERATOR}" \ -G "${GENERATOR}" \
.. ..
cmake --build . --config "${CONFIGURATION}" cmake --build . --config "${CONFIGURATION}" -- -j $(nproc)
cmake --build . --target install --config "${CONFIGURATION}" cmake --install . --config "${CONFIGURATION}"

Loading…
Cancel
Save