Skip to content

Commit

Permalink
Remove handwritten makefiles to keep only one build system (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored May 13, 2022
1 parent 6ab3ff4 commit 518549f
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 486 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/daily-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ jobs:

- name: Build
run: |
git submodule init && git submodule update
mkdir _build && cd _build
cmake -DDISABLE_JEMALLOC=true -DCMAKE_BUILD_TYPE=Release ..
make -j4 kvrocks kvrocks2redis
Expand All @@ -82,12 +81,13 @@ jobs:

- name: Install Dependencies
run: |
brew install snappy googletest gcc autoconf automake libtool
brew install cmake gcc autoconf automake libtool
mkdir build
- name: Build
run: |
cd build
cmake ..
make -j4
cp src/kvrocks build/kvrocks
- name: Unit Test
run: make test

Expand Down
45 changes: 12 additions & 33 deletions .github/workflows/kvrocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y cppcheck
sudo pip install cpplint==1.5.0
sudo apt-get install -y tar libsnappy-dev
sudo apt-get install -y tar cmake
mkdir build
- name: Lint
run: |
make lint
./cpplint.sh
./cppcheck.sh
- name: Build
run: |
cd build
cmake ..
make -j4
cp src/kvrocks build/kvrocks
cd ..
- name: Unit Test
run: |
wget https://github.com/google/googletest/archive/release-1.8.1.tar.gz
tar -zxvf release-1.8.1.tar.gz
cd googletest-release-1.8.1/
cmake CMakeLists.txt
make && sudo make install && cd -
make test
./build/unittest
- name: Redis Tcl Test
run: |
Expand All @@ -79,28 +77,6 @@ jobs:
cd tests/tcl && sh runtest
sh runtest --single integration/redis-cli && cd -
build-on-ubuntu-with-cmake:
strategy:
matrix:
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}
needs: [license]
steps:
- name: Checkout Code Base
uses: actions/checkout@v2.3.4
with:
fetch-depth: 64

- name: Install Dependencies
run: |
sudo apt update
sudo apt-get install -y gcc g++ cmake
mkdir _build
- name: Build
run: |
sh build.sh _build
build-on-macos-latest:
runs-on: macos-11
needs: [license]
Expand All @@ -112,8 +88,11 @@ jobs:

- name: Install Dependencies
run: |
brew install snappy googletest gcc autoconf automake libtool
brew install gcc autoconf automake libtool cmake
mkdir build
- name: Build
run: make -j4
run: |
cd build
cmake ..
make -j4
25 changes: 15 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ jobs:

- name: Install Dependencies
run: |
sudo apt-get install -y tar libsnappy-dev
sudo apt-get install -y tar cmake
mkdir -p build/bin
mkdir -p build/conf
- name: Build
run: |
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
cp src/kvrocks build/bin/
cp src/kvrocks2redis build/bin/
cp kvrocks.conf build/conf/
cp kvrocks bin/
cp kvrocks2redis bin/
cp ../kvrocks.conf conf/
cd ..
- name: Set ENV
run: |
Expand Down Expand Up @@ -101,7 +104,7 @@ jobs:
run: |
yum install -y epel-release
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum install -y git gcc gcc-c++ make snappy snappy-devel autoconf automake libtool which gtest gtest-devel
yum install -y git gcc gcc-c++ make cmake autoconf automake libtool which
- name: Checkout Code Base
uses: actions/checkout@v2.3.4
Expand All @@ -110,12 +113,14 @@ jobs:

- name: Build
run: |
cd build
cmake -DCMAKE_BUILD_TYPE=Release
make -j4
mkdir -p build/bin
mkdir -p build/conf
cp src/kvrocks build/bin/
cp src/kvrocks2redis build/bin/
cp kvrocks.conf build/conf/
mkdir -p bin
mkdir -p conf
cp kvrocks bin/
cp kvrocks2redis bin/
cp ../kvrocks.conf conf/
- name: Set ENV
run: |
Expand Down
24 changes: 0 additions & 24 deletions .gitmodules

This file was deleted.

7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@

FROM ubuntu:22.04 as build

RUN apt update && apt install -y make git autoconf libtool g++ libsnappy-dev
RUN apt update && apt install -y cmake make git autoconf libtool g++
WORKDIR /kvrocks

COPY . .
RUN make -j4
RUN mkdir docker-build && ./build.sh docker-build


FROM ubuntu:22.04

RUN apt update && apt install -y libsnappy-dev
WORKDIR /kvrocks

COPY --from=build /kvrocks/src/kvrocks ./bin/
COPY --from=build /kvrocks/docker-build/kvrocks ./bin/

COPY ./kvrocks.conf ./conf/
RUN sed -i -e 's|dir /tmp/kvrocks|dir /var/lib/kvrocks|g' ./conf/kvrocks.conf
Expand Down
29 changes: 0 additions & 29 deletions Makefile

This file was deleted.

24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,44 @@ Kvrocks has the following key features:

#### requirements
* g++ (required by c++11, version >= 4.8)
* autoconf automake libtool snappy
* autoconf automake libtool cmake

#### Build

***NOTE: You should install the snappy first:***

```shell
# Centos/Redhat
sudo yum install -y epel-release && sudo yum install -y git gcc gcc-c++ make snappy snappy-devel autoconf automake libtool which gtest gtest-devel
sudo yum install -y epel-release && sudo yum install -y git gcc gcc-c++ make cmake autoconf automake libtool which

# Ubuntu/Debian
sudo apt update
sudo apt-get install gcc g++ make libsnappy-dev autoconf automake libtool googletest libgtest-dev
sudo apt-get install gcc g++ make cmake autoconf automake libtool

# MACOSX
brew install autoconf automake libtool snappy googletest
brew install autoconf automake libtool cmake
```

It is as simple as:

```shell
$ git clone --recursive https://github.com/apache/incubator-kvrocks.git
$ git clone https://github.com/apache/incubator-kvrocks.git
$ cd kvrocks
$ make -j4
$ mkdir build
$ ./build.sh build # manually run CMake if you want to build Debug version or add some build options
```

### Running kvrocks

```shell
$ ./src/kvrocks -c kvrocks.conf
$ ./build/kvrocks -c kvrocks.conf
```

### Running test cases

***NOTE: You should install the googletest first***

```shell
make test
$ # make sure CMake was executed in ./build
$ cd build
$ make unittest
$ ./unittest
```

### Supported platforms
Expand Down
Loading

0 comments on commit 518549f

Please sign in to comment.