From 767f0b1c65813bd8a5952fd304f31f8749f6058b Mon Sep 17 00:00:00 2001 From: Tao He Date: Wed, 30 Mar 2022 09:22:18 +0800 Subject: [PATCH] Test against centos latest. (#121) Signed-off-by: Tao He --- .github/workflows/cancel.yaml | 2 +- .github/workflows/centos-latest.yml | 133 ++++++++++++++++++++++++++++ README.md | 3 +- 3 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/centos-latest.yml diff --git a/.github/workflows/cancel.yaml b/.github/workflows/cancel.yaml index a80ff5a..40a2cbf 100644 --- a/.github/workflows/cancel.yaml +++ b/.github/workflows/cancel.yaml @@ -8,6 +8,6 @@ jobs: steps: - uses: styfle/cancel-workflow-action@0.9.1 with: - workflow_id: build-deb-package.yml,build-test.yml + workflow_id: build-deb-package.yml,build-test.yml,centos-latest.yml access_token: ${{ github.token }} diff --git a/.github/workflows/centos-latest.yml b/.github/workflows/centos-latest.yml new file mode 100644 index 0000000..d32df19 --- /dev/null +++ b/.github/workflows/centos-latest.yml @@ -0,0 +1,133 @@ +name: Build & Test on CentOS Latest + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + container: + image: centos:latest + strategy: + matrix: + os: [ubuntu-20.04] + etcd: [v3.4.13] + steps: + - name: Get time + run: | + date +'%Y-%m' > snapshot.txt + + - name: Install dependencies for Linux + run: | + # switch to centos stream + dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos + dnf -y update + + # install required dependencies + yum -y group install "Development Tools" + yum -y install boost-devel \ + cmake \ + git \ + openssl-devel \ + wget + + # install screen fetch + wget -O screenfetch-dev https://git.io/vaHfR + chmod +x screenfetch-dev + mv ./screenfetch-dev /usr/bin/screenfetch + + + # the checkout action require new version of git + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Install grpc v1.27.x for CentOS latest + run: | + # We simply keep the same version with Ubuntu 18.04 + # + git clone https://github.com/grpc/grpc.git --depth 1 --branch v1.27.x + cd grpc/ + git submodule update --init + mkdir cmake-build + cd cmake-build/ + cmake .. -DBUILD_SHARED_LIBS=ON \ + -DgRPC_INSTALL=ON \ + -DgRPC_BUILD_TESTS=OFF \ + -DgRPC_BUILD_CSHARP_EXT=OFF \ + -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \ + -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \ + -DgRPC_BACKWARDS_COMPATIBILITY_MODE=ON \ + -DgRPC_ZLIB_PROVIDER=package \ + -DgRPC_SSL_PROVIDER=package + make -j`nproc` + make install + + - name: Screen fetch + run: | + screenfetch + + - name: Install etcd for Linux + run: | + # install etcd + wget https://github.com/etcd-io/etcd/releases/download/${{ matrix.etcd }}/etcd-${{ matrix.etcd }}-linux-amd64.tar.gz + tar zxvf etcd-${{ matrix.etcd }}-linux-amd64.tar.gz + mv etcd-${{ matrix.etcd }}-linux-amd64/etcd /usr/local/bin/ + mv etcd-${{ matrix.etcd }}-linux-amd64/etcdctl /usr/local/bin/ + + - name: Install cpprestsdk + run: | + mkdir -p build + cd build + git clone https://github.com/microsoft/cpprestsdk.git + mkdir -p cpprestsdk/build + cd cpprestsdk/build + cmake .. -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_TESTS=OFF \ + -DBUILD_SAMPLES=OFF \ + -DCPPREST_EXCLUDE_WEBSOCKETS=ON + make -j`nproc` + make install + + - name: Build + run: | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64 + + mkdir -p build + cd build + cmake .. -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD_REQUIRED=TRUE \ + -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_ETCD_TESTS=ON + make -j`nproc` + make install + + - name: Setup tmate session + if: false + uses: mxschmitt/action-tmate@v2 + + - name: Test + run: | + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64 + + # use etcd v3 api + export ETCDCTL_API="3" + + rm -rf default.etcd + /usr/local/bin/etcd & + + sleep 5 + + # tests without auth + ./build/bin/EtcdSyncTest + ./build/bin/EtcdTest + ./build/bin/LockTest + ./build/bin/MemLeakTest + ./build/bin/WatcherTest + ./build/bin/ElectionTest + + killall -TERM etcd + sleep 5 diff --git a/README.md b/README.md index 5be2d56..af3b2e0 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,9 @@ i.e., `ETCDCTL_API=3`. ### Supported OS environments + **Linux** - - Ubuntu 18.04, requires upgrade gRPC libraries (has been tested with 1.27.x). + - Ubuntu 18.04, requires upgrade gRPC libraries (tested with 1.27.x). - Ubuntu 20.04 + - CentOS 8 (tested with 1.27.x) + **MacOS** - MacOS 10.15