From fd3358b71718c3b1b1c88a988ea2c81bf5c7298e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Thu, 27 Jun 2024 10:49:56 +0200 Subject: [PATCH] Fix issues in CI (#32) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes most remaining issues in CI to get most jobs green. - Enable building non-cluster test on FreeBSD in CI. - Don't run tests on Windows in CI workflow "CI". - CMake correction for libevent header. - Update compilers in CI build matrix. Use latest available gcc/clang in workflow "CI". - Fix 32bit build in CI workflow "C/C++ CI". Signed-off-by: Björn Svensson --- .github/workflows/build.yml | 2 +- .github/workflows/ci.yml | 44 ++++++++++---------------- .github/workflows/db-compatibility.yml | 4 +-- .github/workflows/test.yml | 27 +--------------- tests/CMakeLists.txt | 2 +- 5 files changed, 22 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3a4e8ad..7f204046 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,7 +142,7 @@ jobs: prepare: pkg install -y gmake cmake run: | gmake - mkdir build && cd build && cmake -DDISABLE_TESTS=ON .. && gmake + mkdir build && cd build && cmake .. && gmake macos: name: macOS diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01ab6840..71960024 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,57 +20,49 @@ jobs: strategy: fail-fast: false matrix: - compiler: [gcc-11, clang-12] - cmake-version: [3.19] + compiler: [gcc-13, clang-18] + cmake-version: [3.29] cmake-build-type: [Release, RelWithDebInfo] sanitizer: ["", thread, undefined, leak, address] include: - compiler: gcc-7 - cmake-version: 3.14 + cmake-version: 3.11 cmake-build-type: Release sanitizer: "" - - compiler: gcc-8 - cmake-version: 3.15 + - compiler: clang-12 + cmake-version: 3.11 cmake-build-type: Release sanitizer: "" - - compiler: clang-7 - cmake-version: 3.17 - cmake-build-type: Release - sanitizer: "" - - compiler: clang-9 - cmake-version: 3.18 - cmake-build-type: Release - sanitizer: "" - steps: - name: Prepare uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 with: - packages: libevent-dev libuv1-dev libev-dev libglib2.0-dev ${{ matrix.compiler }} + packages: libevent-dev libuv1-dev libev-dev libglib2.0-dev version: 1.0 + - name: Setup compiler + uses: aminya/setup-cpp@290824452986e378826155f3379d31bce8753d76 # v0.37.0 + with: + compiler: ${{ matrix.compiler }} + - name: Setup CMake + uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 + with: + cmake-version: ${{ matrix.cmake-version }} - name: Install Valkey for non-cluster tests run: | git clone --depth 1 --branch 7.2.5 https://github.com/valkey-io/valkey.git cd valkey && BUILD_TLS=yes make install - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 - with: - cmake-version: ${{ matrix.cmake-version }} - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 - name: Create build folder run: cmake -E make_directory build - name: Generate makefiles - shell: bash env: CC: ${{ matrix.compiler }} working-directory: build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_SSL=ON -DENABLE_IPV6_TESTS=ON -DDOWNLOAD_HIREDIS=OFF -DUSE_SANITIZER=${{ matrix.sanitizer }} .. + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_SSL=ON -DENABLE_IPV6_TESTS=ON -DUSE_SANITIZER=${{ matrix.sanitizer }} .. - name: Build - shell: bash working-directory: build run: VERBOSE=1 make - name: Setup clusters - shell: bash working-directory: build run: make start - name: Wait for clusters to start.. @@ -78,12 +70,10 @@ jobs: with: time: '20s' - name: Run tests - shell: bash working-directory: build - run: make CTEST_OUTPUT_ON_FAILURE=1 test + run: make test - name: Teardown clusters working-directory: build - shell: bash run: make stop install: @@ -147,7 +137,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake + cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISABLE_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake ninja -v windows-mingw64: diff --git a/.github/workflows/db-compatibility.yml b/.github/workflows/db-compatibility.yml index d26f802e..a39dbd6b 100644 --- a/.github/workflows/db-compatibility.yml +++ b/.github/workflows/db-compatibility.yml @@ -46,7 +46,7 @@ jobs: - name: Run tests shell: bash working-directory: build - run: make CTEST_OUTPUT_ON_FAILURE=1 test + run: make test - name: Teardown clusters working-directory: build shell: bash @@ -100,7 +100,7 @@ jobs: - name: Run tests shell: bash working-directory: build - run: make CTEST_OUTPUT_ON_FAILURE=1 test + run: make test - name: Teardown clusters working-directory: build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4a162ae..b0023a06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,9 +32,7 @@ jobs: run: sudo apt-get update && sudo apt-get install gcc-multilib - uses: actions/checkout@v3 - name: Run make - run: make all - env: - PLATFORM_FLAGS: -m32 + run: make 32bit - name: Run unittests env: REDIS_DOCKER: redis:alpine @@ -71,26 +69,3 @@ jobs: REDIS_DOCKER: redis:alpine TEST_PREFIX: ${{matrix.emulator}} -L /usr/${{matrix.toolset}}/ run: make check - - build-windows: - name: Build and test on windows 64 bit Intel - runs-on: windows-latest - steps: - - uses: microsoft/setup-msbuild@v1.0.2 - - uses: actions/checkout@v3 - - name: Run CMake (shared lib) - run: cmake -Wno-dev CMakeLists.txt - - name: Build shared library - run: MSBuild hiredis.vcxproj /p:Configuration=Debug - - name: Run CMake (static lib) - run: cmake -Wno-dev CMakeLists.txt -DBUILD_SHARED_LIBS=OFF - - name: Build static library - run: MSBuild hiredis.vcxproj /p:Configuration=Debug - - name: Build test.exe - run: MSBuild hiredis-test.vcxproj /p:Configuration=Debug - # use memurai, redis compatible server, since it is easy to install. Can't - # install official redis containers on the windows runner - - name: Install Memurai redis server - run: choco install -y memurai-developer.install - - name: Run tests - run: Debug\hiredis-test.exe diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 596db91e..8a747a40 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -50,7 +50,7 @@ find_library(LIBUV_LIBRARY uv HINTS /usr/lib/x86_64-linux-gnu) find_library(LIBEV_LIBRARY ev HINTS /usr/lib/x86_64-linux-gnu) find_library(LIBEVENT_LIBRARY event HINTS /usr/lib/x86_64-linux-gnu) find_path(LIBEVENT_INCLUDES event2/event.h) -if(LIBEVENT_INCLUDES_FOUND) +if(LIBEVENT_INCLUDES) include_directories(${LIBEVENT_INCLUDES}) endif()