Skip to content

Commit

Permalink
CI corrections (#60)
Browse files Browse the repository at this point in the history
- Disable code format checker in CI.
- Use an Ubuntu version that provides requested compiler in CI.
- Merge CI jobs for `windows`.
- Merge CI jobs for `macos`.
 
Signed-off-by: Björn Svensson <[email protected]>
  • Loading branch information
bjosv authored Aug 2, 2024
1 parent ec4fff9 commit e861276
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 59 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,54 +137,3 @@ jobs:
run: |
gmake
mkdir build && cd build && cmake .. && gmake
macos:
name: macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Install dependencies
run: |
brew install openssl valkey
- name: Build library
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

- name: Install dependencies
run: |
choco install -y ninja memurai-developer
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Build library
run: |
mkdir build && cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja -v
- name: Run tests
working-directory: ${{ github.workspace }}/build
run: .\tests\client_test.exe

- name: Install Cygwin Action
uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4
with:
packages: make git gcc-core

- name: Build in cygwin
env:
HIREDIS_PATH: ${{ github.workspace }}
run: |
make clean && make
35 changes: 27 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,34 @@ jobs:
checkers:
name: Run static checkers
runs-on: ubuntu-latest
if: ${{ false }} # Disabled until we have merged a formatted code base.
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

ubuntu:
name: ${{ matrix.cmake-build-type }}-build [${{ matrix.compiler }}, cmake-${{ matrix.cmake-version }} sanitizer="${{ matrix.sanitizer }}"]
runs-on: ubuntu-20.04
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
compiler: [gcc-13, clang-18]
cmake-version: [3.29]
cmake-build-type: [Release, RelWithDebInfo]
sanitizer: ["", thread, undefined, leak, address]
runner: [ubuntu-22.04]
include:
- compiler: gcc-7
cmake-version: 3.11
cmake-build-type: Release
sanitizer: ""
runner: ubuntu-20.04
- compiler: clang-12
cmake-version: 3.11
cmake-build-type: Release
sanitizer: ""
runner: ubuntu-20.04
steps:
- name: Prepare
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2
Expand Down Expand Up @@ -114,31 +118,46 @@ jobs:
name: macOS
runs-on: macos-latest
steps:
- name: Prepare
run: |
brew install cmake ninja openssl
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Build
- 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: Prepare
- name: Install dependencies
run: |
choco install -y ninja
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 -DDISABLE_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
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)
Expand Down
4 changes: 4 additions & 0 deletions tests/clusterclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <stdlib.h>
#include <string.h>

#ifdef _MSC_VER
#include <winsock2.h> /* For struct timeval */
#endif

void printReply(const valkeyReply *reply) {
switch (reply->type) {
case VALKEY_REPLY_ERROR:
Expand Down
4 changes: 4 additions & 0 deletions tests/clusterclient_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
#include <stdlib.h>
#include <string.h>

#ifdef _MSC_VER
#include <winsock2.h> /* For struct timeval */
#endif

#define CMD_SIZE 256
#define HISTORY_DEPTH 16

Expand Down
4 changes: 4 additions & 0 deletions tests/test_utils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef VALKEY_TEST_UTILS_H
#define VALKEY_TEST_UTILS_H

#ifdef _MSC_VER
#include <winsock2.h> /* For struct timeval */
#endif

#define ASSERT_MSG(_x, _msg) \
if (!(_x)) { \
fprintf(stderr, "ERROR: %s (%s)\n", _msg, #_x); \
Expand Down

0 comments on commit e861276

Please sign in to comment.