Skip to content

Commit

Permalink
Merge ce5e068 into f0770c1
Browse files Browse the repository at this point in the history
  • Loading branch information
Flow86 committed Apr 7, 2023
2 parents f0770c1 + ce5e068 commit 4fa5626
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 28 deletions.
55 changes: 30 additions & 25 deletions .github/workflows/unit-tests.yml
Expand Up @@ -13,70 +13,72 @@ concurrency:
cancel-in-progress: true

env:
BOOST_VERSION: 1.69.0
CMAKE_VERSION: 3.26.0
BOOST_VERSION: 1.81.0
ADDITIONAL_CMAKE_FLAGS: -DRTTR_ENABLE_BENCHMARKS=ON

jobs:
Linux:
strategy:
matrix:
include:
- { compiler: gcc-6, os: ubuntu-18.04, buildType: Release }
- { compiler: gcc-6, os: ubuntu-18.04, buildType: Debug, coverage: true }
- { compiler: clang-7, os: ubuntu-18.04, buildType: Release }
- { compiler: clang-7, os: ubuntu-18.04, buildType: Debug }
- { compiler: clang , os: macos-10.15, buildType: Debug, boostVersion: 1.74.0 } # Multiple bugs with recent OSX until 1.74
# GCC 9 is known to show a few warnings that GCC 10 has "fixed", make sure this doesn't happen for us
- { compiler: gcc-9, os: ubuntu-18.04, buildType: Debug }
# Latest GCC
- { compiler: gcc-11, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14 }
- { compiler: gcc-11, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: gcc-11, os: ubuntu-20.04, buildType: Release }
# Latest Clang with externals
- { compiler: clang-13, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, externalSanitizer: true }
- { compiler: clang-13, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: clang-13, os: ubuntu-20.04, buildType: Release }
# Latest Clang with latest boost
- { compiler: clang-13, os: ubuntu-20.04, buildType: Debug, boostVersion: 1.78.0, externalSanitizer: true }
# MacOSX
- { compiler: clang, os: macos-12, buildType: Debug, cxxStandard: 14 }
# Linux GCC
- { compiler: gcc-10, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, coverage: true }
- { compiler: gcc-10, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: gcc-10, os: ubuntu-20.04, buildType: Release, cxxStandard: 14 }
# Linux clang
- { compiler: clang-11, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, externalSanitizer: true }
- { compiler: clang-11, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: clang-11, os: ubuntu-20.04, buildType: Release, cxxStandard: 14 }
# Linux Latest GCC
#- { compiler: gcc-12, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, coverage: true }
# Linux Latest clang
- { compiler: clang-16, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, externalSanitizer: true }

runs-on: ${{matrix.os}}

steps:
- run: echo "DEPS_DIR=${{runner.temp}}/.cache" >> $GITHUB_ENV
- run: echo "CMAKE_VERSION=${{matrix.cmakeVersion}}" >> $GITHUB_ENV
if: matrix.cmakeVersion
- run: echo "BOOST_VERSION=${{matrix.boostVersion}}" >> $GITHUB_ENV
if: matrix.boostVersion
- run: echo "ADDITIONAL_CMAKE_FLAGS=${ADDITIONAL_CMAKE_FLAGS} -DRTTR_EXTERNAL_BUILD_TESTING=ON -DRTTR_ENABLE_SANITIZERS=ON" >> $GITHUB_ENV
if: matrix.externalSanitizer

- uses: actions/checkout@v2
- uses: actions/checkout@v3
if: "!matrix.coverage"
with:
submodules: true
# Coverage collection requires access to history to find merge-base
- uses: actions/checkout@v2
- uses: actions/checkout@v3
if: matrix.coverage
with:
submodules: true
fetch-depth: 0

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{env.DEPS_DIR}}
key: ${{matrix.os}}-${{env.BOOST_VERSION}}

- name: Add LLVM repo
if: matrix.compiler == 'clang-13' && matrix.os == 'ubuntu-20.04'
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-13 main'
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main'
sudo apt update
- name: Install Compiler
if: "!startsWith(runner.os, 'macos')"
run: |
pkgs=${{matrix.compiler}}
pkgs=${pkgs/gcc-/g++-}
sudo apt install $pkgs
- name: Setup compiler
run: |
CC=${{matrix.compiler}}
Expand All @@ -99,12 +101,13 @@ jobs:
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
BOOST_ROOT=$(find /usr/local/Cellar/boost/boost${BOOST_VERSION}_* -maxdepth 0)
BOOST_ROOT=$(find /usr/local/Cellar/boost/${BOOST_VERSION}_* -maxdepth 0)
echo "BOOST_ROOT=${BOOST_ROOT}" >> $GITHUB_ENV
- name: Setup CCache
Expand All @@ -118,13 +121,15 @@ jobs:
run: |
# Minimum requirements: CMake 3.9, Boost 1.69
CMAKE_DIR="${DEPS_DIR}/cmake"
external/libutil/tools/ci/installCMake.sh "3.9.6" "${CMAKE_DIR}"
external/libutil/tools/ci/installCMake.sh "${CMAKE_VERSION}" "${CMAKE_DIR}"
echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH
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: Enable coverage collection
if: matrix.coverage
Expand Down
2 changes: 1 addition & 1 deletion cmake/optimizations.cmake
Expand Up @@ -51,7 +51,7 @@ else()
# Need to check this because Clang-9 with GLIBC > 1.31 generates undefined references to buildins
# https://bugs.llvm.org/show_bug.cgi?id=45034
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_FLAGS -ffastmath)
set(CMAKE_REQUIRED_FLAGS -ffast-math)
check_cxx_source_compiles("
#include <cmath>
Expand Down
3 changes: 3 additions & 0 deletions tests/common/testCollisionDetection.cpp
Expand Up @@ -36,6 +36,9 @@ BOOST_AUTO_TEST_CASE(PointInRect)
BOOST_TEST(!IsPointInRect(Position(12, 31), rect));
// Right
BOOST_TEST(!IsPointInRect(Position(16, 25), rect));

// Right, overload
BOOST_TEST(!IsPointInRect(16, 25, rect.getOrigin().x, rect.getOrigin().y, rect.getSize().x, rect.getSize().y));
}

BOOST_AUTO_TEST_CASE(RectIntersect)
Expand Down
1 change: 1 addition & 0 deletions tests/common/testSerializationHelpers.cpp
Expand Up @@ -32,6 +32,7 @@ std::ostream& operator<<(std::ostream& os, TestEnum e)
{
return os << static_cast<unsigned>(e);
}
// LCOV_EXCL_STOP
} // namespace

BOOST_AUTO_TEST_SUITE(Serialization)
Expand Down
4 changes: 2 additions & 2 deletions tests/s25Main/simple/testGameMessages.cpp
Expand Up @@ -203,8 +203,8 @@ BOOST_AUTO_TEST_CASE(Serialization)
BOOST_TEST(msgOut->player2 == msgIn.player2);
}
{
const GameMessage_Map_Info msgIn(randString(), randomEnum<MapType>(), randomValue<unsigned>(),
randomValue<unsigned>(), randomValue<unsigned>(), randomValue<unsigned>());
auto rv = [] { return randomValue<unsigned>(); };
const GameMessage_Map_Info msgIn(randString(), randomEnum<MapType>(), rv(), rv(), rv(), rv());
const auto msgOut = serializeDeserializeMessage(msgIn);
BOOST_TEST(msgOut->filename == msgIn.filename);
BOOST_TEST(msgOut->mt == msgIn.mt);
Expand Down

0 comments on commit 4fa5626

Please sign in to comment.