Skip to content

Commit

Permalink
Fix issues in CI (#32)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bjosv committed Jun 27, 2024
1 parent b3713d3 commit fd3358b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 17 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,70 +20,60 @@ 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..
uses: kibertoad/wait-action@99f6f101c5be7b88bb9b41c0d3b810722491b8e5 # 1.0.1
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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/db-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
27 changes: 1 addition & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/[email protected]
- 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
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit fd3358b

Please sign in to comment.