Skip to content

Commit 71ee746

Browse files
author
Roman Wu
committed
feat(ci): add FreeBSD CI workflow and update README for FreeBSD support
1 parent 3afb625 commit 71ee746

2 files changed

Lines changed: 118 additions & 1 deletion

File tree

.github/workflows/freebsd.yaml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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 ==="

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<img src="https://kvrocks.apache.org/img/kvrocks-featured.png" alt="kvrocks_logo" width="350"/>
2121

2222
[![CI](https://github.com/apache/kvrocks/actions/workflows/kvrocks.yaml/badge.svg?branch=unstable)](https://github.com/apache/kvrocks/actions/workflows/kvrocks.yaml)
23+
[![FreeBSD CI](https://github.com/apache/kvrocks/actions/workflows/freebsd.yaml/badge.svg?branch=unstable)](https://github.com/apache/kvrocks/actions/workflows/freebsd.yaml)
2324
[![License](https://img.shields.io/github/license/apache/kvrocks)](https://github.com/apache/kvrocks/blob/unstable/LICENSE)
2425
[![GitHub stars](https://img.shields.io/github/stars/apache/kvrocks)](https://github.com/apache/kvrocks/stargazers)
2526

@@ -71,6 +72,11 @@ sudo pacman -Sy --noconfirm autoconf automake python3 git wget which cmake make
7172
brew install git cmake autoconf automake libtool openssl
7273
# please link openssl by force if it still cannot be found after installing
7374
brew link --force openssl
75+
76+
# FreeBSD
77+
sudo pkg update -f
78+
sudo pkg install -y git cmake ninja autoconf automake libtool pkgconf python3
79+
# Optional for TLS: sudo pkg install -y openssl
7480
```
7581

7682
### Build
@@ -139,7 +145,7 @@ $ ./x.py test go # run Golang (unit and integration) test cases
139145

140146
### Supported platforms
141147

142-
* OS: Linux and macOS
148+
* OS: Linux, macOS, and FreeBSD
143149
* arch: x86_64, ARM and RISC-V
144150

145151
## Namespace

0 commit comments

Comments
 (0)