Skip to content

Enable Coverity scans in CI #290

Enable Coverity scans in CI

Enable Coverity scans in CI #290

Workflow file for this run

name: CI
on: [push, pull_request]
permissions:
contents: read
jobs:
checkers:
name: Run static checkers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Run clang-format style check (.c and .h)
uses: jidicula/clang-format-action@c74383674bf5f7c69f60ce562019c1c94bc1421a # v4.13.0
with:
clang-format-version: '18'
ubuntu:
name: ${{ matrix.cmake-build-type }} build [${{ 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: 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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@bfbfe9ca0b2c69a076f6513393d61fc478fb54f8 # v0.41.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: 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_SSL=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
install:
name: Installation tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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_SSL=1 DESTDIR=${{ github.workspace }}/make-install install
- name: Install libvalkey using CMake
run: |
mkdir build && cd build
cmake -DDISABLE_TESTS=ON -DENABLE_SSL=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_SSL=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_SSL=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_SSL=ON ..
make
macos:
name: macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install dependencies
run: brew install ninja valkey
- name: Build using CMake
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_SSL=ON
ninja -v
- name: Build using Makefile
run: USE_SSL=1 make
- name: Run tests
working-directory: tests
env:
TEST_SSL: 1
run: ./test.sh
windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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 .