Skip to content

Commit

Permalink
Update gitmodules; optimize CI Matrix; refine makefile (#68)
Browse files Browse the repository at this point in the history
* Simplifies the GitHub Actions CI matrix by replacing the full OS × Version × Compiler matrix with a more concise, targeted selection.
* Update .gitmodules to include branch explicitly of hiredis.
* Refine makefile to ubuntu vs. macos
  • Loading branch information
moticless authored Feb 27, 2025
1 parent 85c5539 commit a90f72b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 41 deletions.
51 changes: 21 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,38 @@ jobs:
build:
strategy:
matrix:
os:
- "ubuntu-latest"
- "macos-latest"
version:
- "5.0"
- "6.0"
- "6.2"
- "7.0"
- "7.2"
- "7.4"
- "unstable"
compiler:
- "gcc"
- "clang"

exclude:
- os: macos-latest
include:
- os: ubuntu-latest
compiler: gcc
- os: macos-latest
version: "5.0"
- os: macos-latest
- os: ubuntu-latest
compiler: clang
version: "6.0"
- os: macos-latest
- os: ubuntu-latest
compiler: gcc
version: "7.0"
- os: ubuntu-latest
compiler: clang
version: "7.2"
- os: ubuntu-latest
compiler: gcc
version: "7.4"
- os: ubuntu-latest
compiler: clang
version: "unstable"
- os: macos-latest
compiler: gcc
version: "7.4"
- os: macos-latest
compiler: clang
version: "unstable"

runs-on: ${{ matrix.os }}

env:
DEBIAN_FRONTEND: noninteractive
CC: ${{ matrix.compiler }}

# TODO: would be nice to connect to a redis server instead of building from source
# services:
# redis:
# image: redis:${{ matrix.version }}
# options: >-
# --health-cmd "redis-cli ping"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5

steps:
- name: Checkout librdb
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "deps/hiredis"]
path = deps/hiredis
url = https://github.com/redis/hiredis.git
branch = master
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ clean:
rm -f librdb.pc
rm -f librdb-ext.pc

distclean: clean

example: all
cd examples && export LD_LIBRARY_PATH=../lib && ./example1

Expand Down Expand Up @@ -128,11 +126,10 @@ help:
@echo " valgrind - Run tests with static lib and valgrind"
@echo " example - Run the example"
@echo " clean - Clean without deps folders"
@echo " distclean - Clean including deps folders"
@echo " install - install to (DESTDIR)/(PREFIX)/bin and (DESTDIR)/(PREFIX)/lib"
@echo " By default PREFIX=/usr/local"
@echo " uninstall - Remove from (DESTDIR)\(PREFIX)/bin and (DESTDIR)/(PREFIX)/lib"
@echo " help - Prints this message"


.PHONY: all debug test valgrind example clean distclean install uninstall build_test help
.PHONY: all debug test valgrind example clean install uninstall build_test help
2 changes: 1 addition & 1 deletion deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ all:

clean:
$(MAKE) -C redis clean
$(MAKE) -C hiredis all
$(MAKE) -C hiredis clean


.PHONY: all clean
18 changes: 12 additions & 6 deletions src/cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ default: all

LIB_DIR = ../../lib
LIB_NAME = rdb
LIB_NAME_EXT = $(LIB_NAME)-ext
LIB_FILENAME = librdb.a
LIB_NAME_EXT = rdb-ext
LIB_FILENAME_EXT = librdb-ext.a

# Artifacts:
TARGET_APP = rdb-cli
TARGET_LIB_STATIC_EXT = $(LIB_DIR)/lib$(LIB_NAME_EXT).a
TARGET_APP = rdb-cli

#########################################################################################
SOURCES = $(notdir $(basename $(wildcard *.c)))
Expand All @@ -20,10 +21,15 @@ STACK = -fstack-protector-all -Wstack-protector
WARNS = -Wall -Wextra -pedantic -Werror
CFLAGS = -fPIC $(OPTIMIZATION) $(STD) $(STACK) $(WARNS)
DEBUG = -g3 -DDEBUG=1
LIBS = -L /usr/lib -L $(LIB_DIR) -l $(LIB_NAME_EXT) -l $(LIB_NAME)

ifeq ($(shell uname -s),Darwin)
LIBS = -L $(LIB_DIR) -l $(LIB_NAME_EXT) -l $(LIB_NAME)
else
LIBS = -L $(LIB_DIR) -l:$(LIB_FILENAME) -l:$(LIB_FILENAME_EXT)
endif

ifeq ($(BUILD_TLS),yes)
CFLAGS += -DUSE_OPENSSL=1
CFLAGS+=-DUSE_OPENSSL=1
LIBS += -lssl -lcrypto
endif

Expand All @@ -36,7 +42,7 @@ all: $(TARGET_APP)
$(TARGET_APP): %: %.c lib_dependency
$(CC) $(CFLAGS) -o $@ $< $(DEBUG) $(LIBS)

lib_dependency: $(LIB_DIR)/lib$(LIB_NAME_EXT).a
lib_dependency: $(LIB_DIR)/$(LIB_FILENAME_EXT)

clean:
@rm -rvf $(TARGETS) ./*.o ../../bin/$(TARGET_APP)
Expand Down

0 comments on commit a90f72b

Please sign in to comment.