Skip to content

Commit a90f72b

Browse files
authored
Update gitmodules; optimize CI Matrix; refine makefile (#68)
* 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
1 parent 85c5539 commit a90f72b

File tree

5 files changed

+36
-41
lines changed

5 files changed

+36
-41
lines changed

.github/workflows/ci.yml

+21-30
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,38 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
os:
14-
- "ubuntu-latest"
15-
- "macos-latest"
16-
version:
17-
- "5.0"
18-
- "6.0"
19-
- "6.2"
20-
- "7.0"
21-
- "7.2"
22-
- "7.4"
23-
- "unstable"
24-
compiler:
25-
- "gcc"
26-
- "clang"
27-
28-
exclude:
29-
- os: macos-latest
13+
include:
14+
- os: ubuntu-latest
3015
compiler: gcc
31-
- os: macos-latest
3216
version: "5.0"
33-
- os: macos-latest
17+
- os: ubuntu-latest
18+
compiler: clang
3419
version: "6.0"
35-
- os: macos-latest
20+
- os: ubuntu-latest
21+
compiler: gcc
3622
version: "7.0"
23+
- os: ubuntu-latest
24+
compiler: clang
25+
version: "7.2"
26+
- os: ubuntu-latest
27+
compiler: gcc
28+
version: "7.4"
29+
- os: ubuntu-latest
30+
compiler: clang
31+
version: "unstable"
32+
- os: macos-latest
33+
compiler: gcc
34+
version: "7.4"
35+
- os: macos-latest
36+
compiler: clang
37+
version: "unstable"
3738

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

4041
env:
4142
DEBIAN_FRONTEND: noninteractive
4243
CC: ${{ matrix.compiler }}
4344

44-
# TODO: would be nice to connect to a redis server instead of building from source
45-
# services:
46-
# redis:
47-
# image: redis:${{ matrix.version }}
48-
# options: >-
49-
# --health-cmd "redis-cli ping"
50-
# --health-interval 10s
51-
# --health-timeout 5s
52-
# --health-retries 5
53-
5445
steps:
5546
- name: Checkout librdb
5647
uses: actions/checkout@v4

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "deps/hiredis"]
22
path = deps/hiredis
33
url = https://github.com/redis/hiredis.git
4+
branch = master

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ clean:
3939
rm -f librdb.pc
4040
rm -f librdb-ext.pc
4141

42-
distclean: clean
43-
4442
example: all
4543
cd examples && export LD_LIBRARY_PATH=../lib && ./example1
4644

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

137134

138-
.PHONY: all debug test valgrind example clean distclean install uninstall build_test help
135+
.PHONY: all debug test valgrind example clean install uninstall build_test help

deps/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ all:
44

55
clean:
66
$(MAKE) -C redis clean
7-
$(MAKE) -C hiredis all
7+
$(MAKE) -C hiredis clean
88

99

1010
.PHONY: all clean

src/cli/Makefile

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ default: all
22

33
LIB_DIR = ../../lib
44
LIB_NAME = rdb
5-
LIB_NAME_EXT = $(LIB_NAME)-ext
5+
LIB_FILENAME = librdb.a
6+
LIB_NAME_EXT = rdb-ext
7+
LIB_FILENAME_EXT = librdb-ext.a
68

79
# Artifacts:
8-
TARGET_APP = rdb-cli
9-
TARGET_LIB_STATIC_EXT = $(LIB_DIR)/lib$(LIB_NAME_EXT).a
10+
TARGET_APP = rdb-cli
1011

1112
#########################################################################################
1213
SOURCES = $(notdir $(basename $(wildcard *.c)))
@@ -20,10 +21,15 @@ STACK = -fstack-protector-all -Wstack-protector
2021
WARNS = -Wall -Wextra -pedantic -Werror
2122
CFLAGS = -fPIC $(OPTIMIZATION) $(STD) $(STACK) $(WARNS)
2223
DEBUG = -g3 -DDEBUG=1
23-
LIBS = -L /usr/lib -L $(LIB_DIR) -l $(LIB_NAME_EXT) -l $(LIB_NAME)
24+
25+
ifeq ($(shell uname -s),Darwin)
26+
LIBS = -L $(LIB_DIR) -l $(LIB_NAME_EXT) -l $(LIB_NAME)
27+
else
28+
LIBS = -L $(LIB_DIR) -l:$(LIB_FILENAME) -l:$(LIB_FILENAME_EXT)
29+
endif
2430

2531
ifeq ($(BUILD_TLS),yes)
26-
CFLAGS += -DUSE_OPENSSL=1
32+
CFLAGS+=-DUSE_OPENSSL=1
2733
LIBS += -lssl -lcrypto
2834
endif
2935

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

39-
lib_dependency: $(LIB_DIR)/lib$(LIB_NAME_EXT).a
45+
lib_dependency: $(LIB_DIR)/$(LIB_FILENAME_EXT)
4046

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

0 commit comments

Comments
 (0)