CI #406
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
name: CI | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
jobs: | |
checkers: | |
name: Run static checkers | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Run clang-format style check (.c and .h) | |
uses: jidicula/clang-format-action@c74383674bf5f7c69f60ce562019c1c94bc1421a # v4.13.0 | |
with: | |
clang-format-version: '18' | |
ubuntu-cmake: | |
name: Build with CMake [${{ matrix.cmake-build-type }}, ${{ matrix.compiler }}, cmake-${{ matrix.cmake-version }}, sanitizer="${{ matrix.sanitizer }}"] | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [gcc-14, clang-18] | |
cmake-version: [3.29] | |
cmake-build-type: [Release] | |
sanitizer: ["", thread, undefined, leak, address] | |
runner: [ubuntu-24.04] | |
include: | |
- compiler: clang-18 | |
cmake-version: 3.29 | |
cmake-build-type: Debug | |
sanitizer: "" | |
runner: ubuntu-24.04 | |
- compiler: gcc-7 | |
cmake-version: 3.13 | |
cmake-build-type: Release | |
sanitizer: "" | |
runner: ubuntu-20.04 | |
- compiler: clang-12 | |
cmake-version: 3.13 | |
cmake-build-type: Release | |
sanitizer: "" | |
runner: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Prepare | |
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 | |
with: | |
packages: libevent-dev libuv1-dev libev-dev libglib2.0-dev | |
version: 1.0 | |
- name: Setup compiler | |
uses: aminya/setup-cpp@d485b24c1283deafc12b4b8ae90ff09c0d1eb972 # v0.44.0 | |
with: | |
compiler: ${{ matrix.compiler }} | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 | |
with: | |
cmake-version: ${{ matrix.cmake-version }} | |
- name: Build and install Valkey for non-cluster tests | |
if: ${{ matrix.runner == 'ubuntu-20.04' }} | |
run: | | |
git clone --depth 1 --branch 7.2.5 https://github.com/valkey-io/valkey.git | |
cd valkey && BUILD_TLS=yes make install | |
- name: Install Valkey for non-cluster tests | |
if: ${{ matrix.runner != 'ubuntu-20.04' }} | |
run: sudo apt install valkey | |
- name: Generate makefiles | |
env: | |
CC: ${{ matrix.compiler }} | |
run: | | |
if [ -n "${{ matrix.sanitizer }}" ]; then | |
export CFLAGS="-fno-omit-frame-pointer -fsanitize=${{ matrix.sanitizer }}" | |
fi | |
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_TLS=ON -DENABLE_IPV6_TESTS=ON | |
- name: Build | |
working-directory: build | |
run: VERBOSE=1 make | |
- name: Setup clusters | |
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 | |
working-directory: build | |
run: make test | |
- name: Teardown clusters | |
working-directory: build | |
run: make stop | |
ubuntu-make: | |
name: Build with make | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Prepare | |
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 | |
with: | |
packages: libevent-dev valgrind | |
version: 1.0 | |
- name: Install Valkey | |
run: sudo apt install valkey | |
- name: Build | |
run: USE_TLS=1 TEST_ASYNC=1 make | |
- name: Run tests | |
working-directory: tests | |
env: | |
SKIPS_AS_FAILS: 1 | |
TEST_TLS: 1 | |
run: ./test.sh | |
- name: Run tests under valgrind | |
working-directory: tests | |
env: | |
SKIPS_AS_FAILS: 1 | |
TEST_TLS: 1 | |
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full | |
run: ./test.sh | |
ubuntu-32bit: | |
name: Build for 32-bit | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Prepare | |
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 | |
with: | |
packages: gcc-multilib | |
version: 1.0 | |
- name: Install Valkey | |
run: sudo apt install valkey | |
- name: Build | |
run: | | |
make 32bit | |
- name: Run tests | |
working-directory: tests | |
run: | | |
./test.sh | |
install: | |
name: Installation tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Prepare | |
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 | |
with: | |
packages: libevent-dev libuv1-dev libev-dev libglib2.0-dev | |
version: 1.0 | |
- name: Install libvalkey using Makefile | |
run: | | |
make USE_TLS=1 DESTDIR=${{ github.workspace }}/make-install install | |
- name: Install libvalkey using CMake | |
run: | | |
mkdir build && cd build | |
cmake -DDISABLE_TESTS=ON -DENABLE_TLS=ON .. | |
make DESTDIR=${{ github.workspace }}/cmake-install install | |
- name: Build examples with Makefile using a Makefile-installed libvalkey | |
run: | | |
make CFLAGS="-I${{ github.workspace }}/make-install/usr/local/include" \ | |
STLIBNAME="${{ github.workspace }}/make-install/usr/local/lib/libvalkey.a" \ | |
USE_TLS=1 -C examples | |
- name: Build examples with Makefile using a CMake-installed libvalkey | |
run: | | |
make CFLAGS="-I${{ github.workspace }}/cmake-install/usr/local/include" \ | |
STLIBNAME="${{ github.workspace }}/cmake-install/usr/local/lib/libvalkey.a" \ | |
USE_TLS=1 -C examples | |
- name: Build examples with CMake using a CMake-installed libvalkey | |
run: | | |
cd examples && mkdir build && cd build | |
cmake -DCMAKE_PREFIX_PATH=${{ github.workspace }}/cmake-install/usr/local -DENABLE_TLS=ON .. | |
make | |
macos: | |
name: macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Install dependencies | |
run: brew install ninja | |
- 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: Build using CMake | |
run: | | |
mkdir build && cd build | |
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_TLS=ON | |
ninja -v | |
- name: Build using Makefile | |
run: USE_TLS=1 make | |
- name: Run tests | |
working-directory: tests | |
env: | |
TEST_TLS: 1 | |
run: ./test.sh | |
windows: | |
name: Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Install dependencies | |
run: | | |
choco install -y ninja memurai-developer | |
vcpkg install --triplet x64-windows pkgconf libevent | |
- name: Build | |
run: | | |
mkdir build && cd build | |
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake | |
ninja -v | |
- name: Run tests | |
working-directory: build | |
run: .\tests\client_test.exe | |
- name: Install Cygwin Action | |
uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4 | |
with: | |
packages: make gcc-core | |
- name: Build in Cygwin | |
run: make clean && make | |
windows-mingw64: | |
name: Windows (MinGW64) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up MinGW | |
uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1 | |
with: | |
msystem: mingw64 | |
install: | | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-ninja | |
mingw-w64-x86_64-libevent | |
- name: Build | |
shell: msys2 {0} | |
run: | | |
mkdir build && cd build | |
cmake .. -G Ninja | |
cmake --build . |