Fix inverted cursor is not saved in global settings #1573
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2005 - 2024 Settlers Freaks <sf-team at siedler25.org> | |
# | |
# SPDX-License-Identifier: GPL-2.0-or-later | |
name: Unit tests | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- develop | |
- bugfix/** | |
- feature/** | |
- fix/** | |
- pr/** | |
pull_request: | |
concurrency: | |
group: ${{format('tests-{0}:{1}', github.repository, github.ref)}} | |
cancel-in-progress: true | |
env: | |
# Default versions from Jenkins Toolchain | |
CMAKE_VERSION: 3.26.0 | |
BOOST_VERSION: 1.81.0 | |
ADDITIONAL_CMAKE_FLAGS: -DRTTR_ENABLE_BENCHMARKS=ON | |
jobs: | |
Windows: | |
strategy: | |
matrix: | |
include: | |
- { os: windows-2019, generator: Visual Studio 16 2019, type: Debug, platform: Win32} | |
- { os: windows-2019, generator: Visual Studio 16 2019, type: Debug, platform: x64} | |
- { os: windows-2019, generator: Visual Studio 16 2019, type: Release, platform: Win32} | |
- { os: windows-2019, generator: Visual Studio 16 2019, type: Release, platform: x64} | |
- { os: windows-2022, generator: Visual Studio 17 2022, type: Debug, platform: Win32} | |
- { os: windows-2022, generator: Visual Studio 17 2022, type: Debug, platform: x64} | |
- { os: windows-2022, generator: Visual Studio 17 2022, type: Release, platform: Win32} | |
- { os: windows-2022, generator: Visual Studio 17 2022, type: Release, platform: x64} | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install boost | |
uses: MarkusJx/[email protected] | |
id: install-boost | |
with: | |
boost_version: ${{env.BOOST_VERSION}} | |
platform_version: ${{matrix.os == 'windows-2019' && '2019' || '2022'}} | |
toolset: msvc | |
- name: 'Configure' | |
env: | |
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}} | |
shell: cmd | |
run: | | |
set "INSTALL_DIR=%GITHUB_WORKSPACE%\installed" | |
mkdir build_dir | |
cd build_dir | |
rem Enable LTCG for release builds (speeds up linking as /GL compiled modules are used) | |
if ${{matrix.type}} == Release (set "cmakeFlags=-DCMAKE_EXE_LINKER_FLAGS=/LTCG -DCMAKE_SHARED_LINKER_FLAGS=/LTCG") | |
echo "Configuring ${{matrix.generator}} for ${{matrix.type}} on ${{matrix.platform}}" | |
cmake -G "${{matrix.generator}}" -A ${{matrix.platform}} ^ | |
-DRTTR_ENABLE_WERROR=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ^ | |
-DRTTR_EXTERNAL_BUILD_TESTING=ON -DRTTR_ENABLE_BENCHMARKS=ON ^ | |
%cmakeFlags% .. | |
- name: 'Build' | |
run: cmake --build build_dir --config ${{matrix.type}} --parallel 4 | |
- name: 'Test' | |
run: ctest --test-dir build_dir --output-on-failure -C ${{matrix.type}} --parallel 4 | |
Linux: | |
strategy: | |
matrix: | |
include: | |
# MacOSX: | |
# Use system clang (14) | |
# Use (compiler) default C++ 14 standard | |
# Use system cmake (version gets ignored below) | |
# Use boost installed via brew | |
- { compiler: clang, os: macos-12, type: Debug } | |
# Linux: | |
# Oldest Compilers | |
# GCC 9 also known to show a few warnings that newer versions dont show | |
# Use (compiler) default C++ 14 standard | |
# Use system cmake | |
# Use system boost (min version) | |
- { compiler: gcc-9, os: ubuntu-20.04, type: Debug, cmake: 3.16.3, boost: 1.71.0 } | |
- { compiler: clang-10, os: ubuntu-20.04, type: Debug, cmake: 3.16.3, boost: 1.71.0, externalSanitizer: true } | |
# | |
# Default compiler for Ubuntu 20.04 | |
# Use (compiler) default C++ 14 standard | |
# Use default cmake | |
# Use default boost | |
- { compiler: gcc-10, os: ubuntu-20.04, type: Debug, coverage: true } | |
# | |
# Default compilers for Ubuntu 22.04 | |
# Use C++ 17 standard (default for gcc-11) | |
# Use system cmake | |
# Use system boost | |
# Also include a (semi-)optimized build to a) shake out issues there an b) run the replay tests | |
- { compiler: clang-14, os: ubuntu-22.04, type: Debug, cmake: 3.22.1, boost: 1.74.0, cxx: 17 } | |
- { compiler: gcc-11, os: ubuntu-22.04, type: Debug, cmake: 3.22.1, boost: 1.74.0 } | |
- { compiler: gcc-11, os: ubuntu-22.04, type: RelWithDebInfo, cmake: 3.22.1, boost: 1.74.0 } | |
# | |
# Latest Compilers | |
# GCC 12 needs boost 1.82 to compile correctly | |
# Use (compiler) default C++ 17 standard | |
# Use default cmake | |
- { compiler: gcc-12, os: ubuntu-22.04, type: Debug, boost: 1.82.0 } | |
# Use default boost | |
- { compiler: clang-16, os: ubuntu-20.04, type: Debug, externalSanitizer: true } | |
runs-on: ${{matrix.os}} | |
steps: | |
- run: echo "DEPS_DIR=${{runner.temp}}/.cache" >> $GITHUB_ENV | |
- name: Set BUILD_TYPE | |
run: echo "BUILD_TYPE=${{matrix.type}}" >> $GITHUB_ENV | |
- name: Set CMake version | |
if: matrix.cmake | |
run: echo "CMAKE_VERSION=${{matrix.cmake}}" >> $GITHUB_ENV | |
- name: Set Boost version | |
if: matrix.boost | |
run: echo "BOOST_VERSION=${{matrix.boost}}" >> $GITHUB_ENV | |
- name: Set C++ standard | |
if: matrix.cxx | |
run: echo "ADDITIONAL_CMAKE_FLAGS=${ADDITIONAL_CMAKE_FLAGS} -DCMAKE_CXX_STANDARD=${{matrix.cxx}}" >> $GITHUB_ENV | |
- name: Enable coverage collection | |
if: matrix.coverage | |
run: echo "ADDITIONAL_CMAKE_FLAGS=${ADDITIONAL_CMAKE_FLAGS} -DRTTR_ENABLE_COVERAGE=ON" >> $GITHUB_ENV | |
- name: Enable external sanitizer | |
if: matrix.externalSanitizer | |
run: echo "ADDITIONAL_CMAKE_FLAGS=${ADDITIONAL_CMAKE_FLAGS} -DRTTR_EXTERNAL_BUILD_TESTING=ON -DRTTR_ENABLE_SANITIZERS=ON" >> $GITHUB_ENV | |
# Coverage collection requires access to history to find merge-base | |
- uses: actions/checkout@v3 | |
if: "!matrix.coverage" | |
with: | |
submodules: true | |
- uses: actions/checkout@v3 | |
if: matrix.coverage | |
with: | |
submodules: true | |
fetch-depth: 0 # Faster checkout | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.DEPS_DIR}} | |
key: ${{matrix.os}}-${{env.BOOST_VERSION}} | |
# clang-16 needs to be manually installed | |
- name: Install Compiler (Linux, clang-16) | |
if: matrix.compiler == 'clang-16' && matrix.os == 'ubuntu-20.04' | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main' | |
sudo apt update | |
- name: Install Compiler (Linux) | |
if: "!startsWith(runner.os, 'macos')" | |
run: | | |
pkgs=${{matrix.compiler}} | |
pkgs=${pkgs/gcc-/g++-} | |
sudo apt install $pkgs | |
# Setup CC, CXX and GCOV variables | |
- name: Setup compiler | |
run: | | |
CC=${{matrix.compiler}} | |
if [[ "$CC" =~ clang ]]; then | |
CXX=${CC/clang/clang++} | |
elif [[ "$CC" =~ gcc ]]; then | |
CXX=${CC/gcc/g++} | |
fi | |
ver=7 # default | |
if [[ "$CC" =~ gcc- ]]; then | |
ver="${CC##*gcc-}" | |
fi | |
GCOV=gcov-${ver} | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
echo "GCOV=$GCOV" >> $GITHUB_ENV | |
- name: Install system packages (Linux) | |
if: "!startsWith(runner.os, 'macos')" | |
run: | | |
sudo apt update | |
sudo apt install gettext libsdl2-dev libsdl2-mixer-dev libcurl4-openssl-dev libbz2-dev libminiupnpc-dev liblua5.2-dev | |
- name: Install system packages (OSX) | |
if: startsWith(runner.os, 'macos') | |
run: | | |
brew install cmake boost sdl2 sdl2_mixer gettext miniupnpc libiconv | |
echo /usr/local/opt/gettext/bin >> $GITHUB_PATH | |
echo "Available Boost installs: $(ls /usr/local/Cellar/boost/)" | |
# Use the latest (last folder) | |
BOOST_ROOT=$(find /usr/local/Cellar/boost/* -maxdepth 0 -type d | tail -n1) | |
[[ -n "$BOOST_ROOT" ]] | |
echo "Choosen Boost: $BOOST_ROOT" | |
echo "BOOST_ROOT=${BOOST_ROOT}" >> $GITHUB_ENV | |
- name: Setup CCache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: ${{matrix.os}}-${{matrix.compiler}}-${{matrix.type}}-${{matrix.boost}} | |
max-size: 200M | |
- name: Compile CMake (Linux) | |
if: "!startsWith(runner.os, 'macos')" | |
run: | | |
CMAKE_DIR="${DEPS_DIR}/cmake" | |
external/libutil/tools/ci/installCMake.sh "${CMAKE_VERSION}" "${CMAKE_DIR}" | |
echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH | |
- name: Compile Boost (Linux) | |
if: "!startsWith(runner.os, 'macos')" | |
run: | | |
BOOST_ROOT="${DEPS_DIR}/boost${BOOST_VERSION}" | |
echo "BOOST_ROOT=${BOOST_ROOT}" >> $GITHUB_ENV | |
echo "ADDITIONAL_CMAKE_FLAGS=${ADDITIONAL_CMAKE_FLAGS} -DBoost_NO_SYSTEM_PATHS=ON -DBoost_NO_BOOST_CMAKE=ON" >> $GITHUB_ENV | |
external/libutil/tools/ci/installBoost.sh "${BOOST_VERSION}" "${BOOST_ROOT}" "filesystem,system,program_options,thread,test,locale,iostreams,regex" shared | |
cat /tmp/boost.log || true | |
ls -la ${BOOST_ROOT}/lib/ || true | |
- name: Setup environment | |
run: echo "TRAVIS_BUILD_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
- name: Build | |
run: tools/ci/build.sh | |
- run: tools/ci/collectCoverageData.sh && external/libutil/tools/ci/uploadCoverageData.sh | |
if: matrix.coverage && success() | |
- run: tools/ci/checkTestCoverage.sh | |
if: matrix.coverage && success() | |
- name: Upload coverage (Coveralls) | |
if: matrix.coverage && success() | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
path-to-lcov: srccov.info |