Skip to content

Commit 449cb10

Browse files
committed
Merge branch 'unstable' of https://github.com/valkey-io/valkey into feature/automated-test-failure-detector
2 parents 9dfa946 + d173441 commit 449cb10

135 files changed

Lines changed: 11880 additions & 9092 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/typos.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ ake = "ake"
7171
[type.tcl.extend-words]
7272
fo = "fo"
7373
tre = "tre"
74+
75+
[type.cpp.extend-words]
76+
fo = "fo"

.github/instructions/core-engine.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Apply these standards to core engine C code. Do NOT apply to `deps/` (vendored d
3636
- **PR Scope:** Separate refactoring from functional changes for easier backporting.
3737

3838
## 5. Testing & Documentation
39-
- **Unit Tests:** Required for data structures in `src/unit/`. Test files should follow `test_*.c` naming.
39+
- **Unit Tests:** Required for data structures in `src/unit/`. Test files should follow `test_*.cpp` naming.
4040
- **Integration Tests:** Required for commands in `tests/`.
4141
- **Command Changes:** New/modified commands need corresponding updates in `src/commands/*.json`.
4242
- **New C Files:** Remind to update `CMakeLists.txt` when adding new `.c` source files.

.github/workflows/ci.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
- name: make
3636
# Fail build if there are warnings
3737
# build with TLS just for compilation coverage
38-
run: make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes
38+
run: |
39+
sudo apt-get install pkg-config libgtest-dev libgmock-dev
40+
make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes
3941
- name: test
4042
run: |
4143
sudo apt-get install tcl8.6 tclx
@@ -50,7 +52,7 @@ jobs:
5052
if [[ ! -z "$dirty" ]]; then echo "$dirty"; exit 1; fi
5153
- name: unit tests
5254
run: |
53-
./src/valkey-unit-tests
55+
./src/unit/valkey-unit-gtests
5456
5557
test-ubuntu-latest-compatibility:
5658
runs-on: ubuntu-latest
@@ -62,6 +64,9 @@ jobs:
6264
- {version: "8.0.6", file: "valkey-8.0.6-noble-x86_64.tar.gz"}
6365
- {version: "8.1.4", file: "valkey-8.1.4-noble-x86_64.tar.gz"}
6466
steps:
67+
- name: Install gtest
68+
run: |
69+
sudo apt-get install pkg-config libgtest-dev libgmock-dev
6570
- name: Install libbacktrace
6671
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6772
with:
@@ -103,7 +108,7 @@ jobs:
103108
sudo apt-get install -y cmake libssl-dev
104109
mkdir -p build-release
105110
cd build-release
106-
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_TESTS=yes
111+
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_GTESTS=yes
107112
make -j$(nproc)
108113
- name: test
109114
run: |
@@ -112,7 +117,7 @@ jobs:
112117
./build-release/runtest --verbose --tags -slow --dump-logs --tls
113118
- name: unit tests
114119
run: |
115-
./build-release/bin/valkey-unit-tests
120+
./build-release/bin/valkey-unit-gtests
116121
117122
test-sanitizer-address:
118123
runs-on: ubuntu-latest
@@ -128,15 +133,18 @@ jobs:
128133
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
129134
- name: make
130135
# build with TLS module just for compilation coverage
131-
run: make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module USE_LIBBACKTRACE=yes
136+
run: |
137+
sudo apt-get install pkg-config libgtest-dev libgmock-dev
138+
make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module USE_LIBBACKTRACE=yes
132139
- name: testprep
133140
run: sudo apt-get install tcl8.6 tclx -y
134141
- name: test
135142
run: ./runtest --verbose --tags -slow --dump-logs
136143
- name: module api test
137144
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs
138145
- name: unit tests
139-
run: ./src/valkey-unit-tests
146+
run: |
147+
./src/unit/valkey-unit-gtests
140148
141149
test-rdma:
142150
runs-on: ubuntu-latest
@@ -220,9 +228,15 @@ jobs:
220228
- run: cd libbacktrace && ./configure && make && sudo make install
221229
- name: Checkout Valkey
222230
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
231+
- name: Install build dependencies
232+
run: brew install llvm googletest
223233
- name: make
224234
# Build with additional upcoming features
225-
run: make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes
235+
run: |
236+
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
237+
export CC=/opt/homebrew/opt/llvm/bin/clang
238+
export CXX=/opt/homebrew/opt/llvm/bin/clang++
239+
make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes LIBBACKTRACE_PREFIX=/usr/local
226240
227241
build-32bit:
228242
runs-on: ubuntu-latest
@@ -240,16 +254,34 @@ jobs:
240254
cd libbacktrace && ./configure CFLAGS="-m32" --prefix=/usr/local/libbacktrace32 && make && sudo make install
241255
- name: Checkout Valkey
242256
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
257+
- name: Install gtest
258+
run: |
259+
sudo apt-get update
260+
sudo apt-get install libgtest-dev
261+
mkdir -p /tmp/gtest32
262+
cd /tmp/gtest32
263+
cmake -B build32 \
264+
-DCMAKE_BUILD_TYPE=Release \
265+
-DCMAKE_C_FLAGS="-m32" \
266+
-DCMAKE_CXX_FLAGS="-m32" \
267+
-DCMAKE_EXE_LINKER_FLAGS="-m32" \
268+
/usr/src/googletest
269+
cmake --build build32 --parallel
270+
sudo cp build32/lib/*.a /usr/lib32/
271+
cd $GITHUB_WORKSPACE
243272
- name: make
244273
# Fast float requires C++ 32-bit libraries to compile on 64-bit ubuntu
245274
# machine i.e. "-cross" suffixed version. Cross-compiling c++ to 32-bit
246275
# also requires multilib support for g++ compiler i.e. "-multilib"
247276
# suffixed version of g++. g++-multilib generally includes libstdc++.
248277
# *cross version as well, but it is also added explicitly just in case.
249-
run: make -j4 SERVER_CFLAGS='-Werror' 32bit USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes LIBBACKTRACE_PREFIX=/usr/local/libbacktrace32
278+
run: |
279+
make -j4 SERVER_CFLAGS='-Werror' 32bit USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes LIBBACKTRACE_PREFIX=/usr/local/libbacktrace32 \
280+
GTEST_CFLAGS="-I/usr/src/googletest/googletest/include -I/usr/src/googletest/googlemock/include" \
281+
GTEST_LIBS="/usr/lib32/libgtest.a /usr/lib32/libgmock.a"
250282
- name: unit tests
251283
run: |
252-
./src/valkey-unit-tests
284+
./src/unit/valkey-unit-gtests
253285
254286
build-libc-malloc:
255287
runs-on: ubuntu-latest
@@ -278,7 +310,7 @@ jobs:
278310
path: libbacktrace
279311
- name: Build libbacktrace
280312
run: |
281-
dnf -y install epel-release gcc gcc-c++ make procps-ng which
313+
dnf -y install epel-release gcc gcc-c++ make procps-ng which git cmake
282314
cd libbacktrace && ./configure && make && make install
283315
- name: Checkout Valkey
284316
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/clang-format.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Clang Format Check
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
paths-ignore:
@@ -39,7 +42,7 @@ jobs:
3942
# Run clang-format and capture the diff
4043
cd src
4144
shopt -s globstar
42-
clang-format-18 -i **/*.c **/*.h
45+
clang-format-18 -i **/*.c **/*.h **/*.cpp **/*.hpp
4346
# Capture the diff output
4447
DIFF=$(git diff)
4548
if [ ! -z "$DIFF" ]; then

.github/workflows/codecov.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: "Codecov"
22

3+
permissions:
4+
contents: read
5+
36
# Enabling on each push is to display the coverage changes in every PR,
47
# where each PR needs to be compared against the coverage of the head commit
58
on:
@@ -41,4 +44,4 @@ jobs:
4144
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
4245
with:
4346
token: ${{ secrets.CODECOV_TOKEN }}
44-
file: ./src/valkey.info
47+
files: ./src/valkey.info

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ jobs:
4040
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4141

4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2
43+
uses: github/codeql-action/init@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
4444
with:
4545
languages: ${{ matrix.language }}
4646

4747
- name: Autobuild
48-
uses: github/codeql-action/autobuild@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2
48+
uses: github/codeql-action/autobuild@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
4949

5050
- name: Perform CodeQL Analysis
51-
uses: github/codeql-action/analyze@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2
51+
uses: github/codeql-action/analyze@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5

.github/workflows/daily.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ jobs:
13211321
container: almalinux:8
13221322
install_epel: true
13231323
- name: test-almalinux9-jemalloc
1324-
container: almalinux:8
1324+
container: almalinux:9
13251325
install_epel: true
13261326
- name: test-centosstream9-jemalloc
13271327
container: quay.io/centos/centos:stream9
@@ -1401,7 +1401,7 @@ jobs:
14011401
container: almalinux:8
14021402
install_epel: true
14031403
- name: test-almalinux9-tls-module
1404-
container: almalinux:8
1404+
container: almalinux:9
14051405
install_epel: true
14061406
- name: test-centosstream9-tls-module
14071407
container: quay.io/centos/centos:stream9
@@ -1482,7 +1482,7 @@ jobs:
14821482
container: almalinux:8
14831483
install_epel: true
14841484
- name: test-almalinux9-tls-module-no-tls
1485-
container: almalinux:8
1485+
container: almalinux:9
14861486
install_epel: true
14871487
- name: test-centosstream9-tls-module-no-tls
14881488
container: quay.io/centos/centos:stream9

.github/workflows/scorecard.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: OpenSSF Scorecard supply-chain security
2+
on:
3+
push:
4+
branches: [unstable]
5+
schedule:
6+
- cron: '0 0 * * 1'
7+
8+
permissions: read-all
9+
10+
jobs:
11+
analysis:
12+
name: Scorecard analysis
13+
runs-on: ubuntu-latest
14+
permissions:
15+
security-events: write
16+
id-token: write
17+
18+
steps:
19+
- name: "Checkout code"
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
21+
with:
22+
persist-credentials: false
23+
24+
- name: "Run analysis"
25+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a #v2.4.3
26+
with:
27+
results_file: results.sarif
28+
results_format: sarif
29+
publish_results: true
30+
31+
- name: "Upload artifact"
32+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
33+
with:
34+
name: SARIF file
35+
path: results.sarif
36+
retention-days: 5
37+
38+
- name: "Upload to code-scanning"
39+
uses: github/codeql-action/upload-sarif@6bc82e05fd0ea64601dd4b465378bbcf57de0314 #v4.32.1
40+
with:
41+
sarif_file: results.sarif

.github/workflows/trigger-build-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Trigger Build Release
22

3+
permissions:
4+
contents: read
5+
36
on:
47
release:
58
types: [published]

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dump*.rdb
1515
*-cli
1616
*-sentinel
1717
*-server
18-
*-unit-tests
18+
*-unit-gtests
1919
doc-tools
2020
release
2121
misc/*
@@ -56,3 +56,5 @@ build-debug/
5656
build-release/
5757
cmake-build-debug/
5858
cmake-build-release/
59+
__pycache__
60+
src/unit/.flags

0 commit comments

Comments
 (0)