diff --git a/.github/composite-actions/download-libraries/action.yml b/.github/composite-actions/download-libraries/action.yml index 6e37578fc6..4bd8615c84 100644 --- a/.github/composite-actions/download-libraries/action.yml +++ b/.github/composite-actions/download-libraries/action.yml @@ -16,6 +16,11 @@ inputs: description: 'Install boost' default: true + install-clang: + type: boolean + description: 'Install clang' + default: false + runs: using: 'composite' steps: @@ -25,6 +30,18 @@ runs: sudo apt-get update -y sudo apt-get install gcc-10 g++-10 cmake build-essential -y shell: bash + if: inputs.install-clang != 'true' + + - name: Install clang + # llvm.sh installs all needed libraries, no need in build-essential + run: | + sudo apt-get update -y + sudo apt-get install cmake make -y + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 17 + shell: bash + if: inputs.install-clang != 'false' - name: Make lib directory run: | @@ -35,7 +52,7 @@ runs: uses: ./.github/composite-actions/download-library with: directory: googletest - download-command: git clone https://github.com/google/googletest/ --branch release-1.12.1 --depth 1 + download-command: git clone https://github.com/google/googletest/ --branch release-1.14.0 --depth 1 if: inputs.download-googletest != 'false' - name: Download easyloggingpp diff --git a/.github/workflows/core-tests.yml b/.github/workflows/core-tests.yml index 058ca3d2fe..e4ec897e22 100644 --- a/.github/workflows/core-tests.yml +++ b/.github/workflows/core-tests.yml @@ -27,7 +27,7 @@ on: #- examples/** workflow_dispatch: jobs: - run_tests: + run_tests_gcc: runs-on: ubuntu-latest strategy: matrix: @@ -44,6 +44,38 @@ jobs: uses: ./.github/composite-actions/download-datasets - name: Build run: | + export CC=gcc-10 + export CXX=g++-10 + if [[ "${{matrix.cfg.BUILD_TYPE}}" == "Debug" ]]; then + ./build.sh --debug --sanitizer=${{ matrix.cfg.SANITIZER }} + else + ./build.sh + fi + - name: Test + working-directory: ${{github.workspace}}/build/target + shell: bash + run: ./Desbordante_test --gtest_filter='*:-*HeavyDatasets*' + run_tests_clang: + runs-on: ubuntu-latest + strategy: + matrix: + cfg: + - { BUILD_TYPE: Release } + - { BUILD_TYPE: Debug } + - { BUILD_TYPE: Debug, SANITIZER : ADDRESS } + - { BUILD_TYPE: Debug, SANITIZER : UB } + steps: + - uses: actions/checkout@v3 + - name: Download libraries + uses: ./.github/composite-actions/download-libraries + with: + install-clang: true + - name: Download datasets + uses: ./.github/composite-actions/download-datasets + - name: Build + run: | + export CC=clang-17 + export CXX=clang++-17 if [[ "${{matrix.cfg.BUILD_TYPE}}" == "Debug" ]]; then ./build.sh --debug --sanitizer=${{ matrix.cfg.SANITIZER }} else diff --git a/CMakeLists.txt b/CMakeLists.txt index 86e00ba465..ed0a56b993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,16 @@ else() add_compile_options(-ggdb3) endif() + # Workaround clang-18 bug: + # https://github.com/llvm/llvm-project/issues/76515?ysclid=m406q4it5k674680045 + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + string(FIND "${CMAKE_CXX_COMPILER_VERSION}" "18" IDX) + if (IDX EQUAL 0) # clang major version is 18 + message(WARNING "C++ compiler is Clang++-18. Supressing deprecated declaration warnings. Consider using another version of Clang") + string(JOIN ";" DEBUG_BUILD_OPTS "${DEBUG_BUILD_OPTS}" "-Wno-deprecated-declarations") + endif() + endif() + add_compile_options("$<$:${DEBUG_BUILD_OPTS}>") add_link_options("$<$:${DEBUG_LINK_OPTS}>")