1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+
18+ name : FreeBSD CI
19+
20+ on : [push, pull_request]
21+
22+ concurrency :
23+ group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
24+ cancel-in-progress : true
25+
26+ jobs :
27+ build-and-test :
28+ name : FreeBSD Build and Test
29+ runs-on : ubuntu-latest
30+ strategy :
31+ fail-fast : false
32+ matrix :
33+ freebsd-version : ['14.1']
34+ compiler : ['clang', 'gcc']
35+ build-type : ['Release', 'Debug']
36+ include :
37+ - build-type : Release
38+ cmake-flags : ' '
39+ - build-type : Debug
40+ cmake-flags : ' -DCMAKE_BUILD_TYPE=Debug'
41+ - compiler : gcc
42+ cxx-compiler : g++
43+ - compiler : clang
44+ cxx-compiler : clang++
45+
46+ steps :
47+ - uses : actions/checkout@v4
48+ with :
49+ fetch-depth : 0
50+
51+ - name : Build and Test on FreeBSD
52+ uses : vmactions/freebsd-vm@v1
53+ with :
54+ release : ${{ matrix.freebsd-version }}
55+ usesh : true
56+ prepare : |
57+ pkg update -f
58+ pkg install -y git cmake ninja autoconf automake libtool pkgconf python3
59+ pkg install -y ${{ matrix.compiler }}
60+
61+ run : |
62+ echo "=== System Information ==="
63+ uname -a
64+ freebsd-version
65+
66+ echo "=== Compiler Version ==="
67+ ${{ matrix.compiler }} --version
68+
69+ echo "=== Setting up build environment ==="
70+ export CC=${{ matrix.compiler }}
71+ export CXX=${{ matrix.cxx-compiler }}
72+
73+ echo "=== Building Kvrocks ==="
74+ ./x.py build --ninja -j$(sysctl -n hw.ncpu) --unittest ${{ matrix.cmake-flags }} -DDISABLE_JEMALLOC=ON
75+
76+ echo "=== Running C++ Unit Tests ==="
77+ ./x.py test cpp
78+
79+ echo "=== Smoke Test - Starting Kvrocks ==="
80+ # Create a minimal config for testing
81+ cat > test-kvrocks.conf <<EOF
82+ bind 127.0.0.1
83+ port 6666
84+ dir /tmp/kvrocks
85+ EOF
86+
87+ # Start kvrocks in background
88+ ./build/kvrocks -c test-kvrocks.conf &
89+ KVROCKS_PID=$!
90+
91+ # Wait for server to start
92+ sleep 5
93+
94+ # Check if process is running
95+ if kill -0 $KVROCKS_PID 2>/dev/null; then
96+ echo "✓ Kvrocks server started successfully (PID: $KVROCKS_PID)"
97+
98+ # Try to connect using Redis protocol
99+ # Send PING command in Redis protocol format
100+ printf "*1\r\n\$4\r\nPING\r\n" | nc -w 2 127.0.0.1 6666 | grep -q "+PONG" && echo "✓ Server responds to PING"
101+
102+ # Clean shutdown
103+ kill $KVROCKS_PID
104+ wait $KVROCKS_PID 2>/dev/null
105+ echo "✓ Kvrocks server stopped successfully"
106+ else
107+ echo "✗ Failed to start Kvrocks server"
108+ exit 1
109+ fi
110+
111+ echo "=== All tests passed successfully ==="
0 commit comments