Skip to content

Commit

Permalink
feat: add a new test env (rocky linux) in github ci. (#2806) (#2823)
Browse files Browse the repository at this point in the history
* add a new test env (rocky linux) in github ci.
  • Loading branch information
QlQlqiqi authored and brother-jin committed Jul 31, 2024
1 parent 9c918a0 commit 93878ce
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 44 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,51 +83,45 @@ jobs:
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_centos:
build_on_rocky:
runs-on: ubuntu-latest
container:
image: centos:7
image: rockylinux:9

steps:
- name: Install deps
run: |
yum install -y wget git autoconf centos-release-scl gcc
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util
yum install -y llvm-toolset-7 llvm-toolset-7-clang tcl which
dnf update -y
dnf install -y bash cmake wget git autoconf gcc perl-Digest-SHA tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel gcc-toolset-13
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Install cmake
run: |
wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
bash ./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure CMake
run: |
source /opt/rh/devtoolset-10/enable
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address
source /opt/rh/gcc-toolset-13/enable
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address .
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/deps
key: ${{ runner.os }}-centos-deps-${{ hashFiles('**/CMakeLists.txt') }}
key: ${{ runner.os }}-rocky-deps-${{ hashFiles('**/CMakeLists.txt') }}

- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/buildtrees
key: ${{ runner.os }}-centos-buildtrees-${{ hashFiles('**/CMakeLists.txt') }}
key: ${{ runner.os }}-rocky-buildtrees-${{ hashFiles('**/CMakeLists.txt') }}

- name: Build
run: |
source /opt/rh/devtoolset-10/enable
source /opt/rh/gcc-toolset-13/enable
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Test
Expand All @@ -141,7 +135,6 @@ jobs:
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
rm -rf ../deps
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,27 @@ jobs:
name: ${{ matrix.name }}.sha256sum
path: build/${{ matrix.name }}.sha256sum

centos:
rocky:
runs-on: ubuntu-latest
container:
image: centos:7
image: rockylinux:9
env:
name: ${{ github.event.repository.name }}-${{ github.ref_name }}-centos-amd64.tar.gz
name: ${{ github.event.repository.name }}-${{ github.ref_name }}-rocky-amd64.tar.gz
steps:
- name: Install deps
run: |
yum install -y wget git autoconf centos-release-scl gcc perl-Digest-SHA
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util
yum install -y llvm-toolset-7 llvm-toolset-7-clang tcl which
- name: Install cmake
run: |
wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
bash ./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr
dnf update -y
dnf install -y bash cmake wget git autoconf gcc perl-Digest-SHA tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel gcc-toolset-13
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Release build os - centos
- name: Release build os - rocky
run: |
chmod +x ci/release-build.sh
./ci/release-build.sh install centos ${{ env.BUILD_TYPE }} -xe
./ci/release-build.sh install rocky ${{ env.BUILD_TYPE }} -xe
- name: Calculate checksum and rename binary
shell: bash
Expand All @@ -93,7 +87,7 @@ jobs:

release:
name: Release artifacts
needs: [ build,centos ]
needs: [ build, rocky ]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
Expand Down
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()

link_directories("/opt/rh/gcc-toolset-13/root/lib/gcc/x86_64-redhat-linux/13")

############# You should enable sanitizer if you are developing pika #############
# Uncomment the following two lines to enable AddressSanitizer to detect memory leaks and other memory-related bugs.
Expand Down Expand Up @@ -157,7 +158,7 @@ ExternalProject_Add(gtest
make -j${CPU_CORE}
)

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(GTEST_LIBRARY ${INSTALL_LIBDIR_64}/libgtest.a)
set(GTEST_MAIN_LIBRARY ${INSTALL_LIBDIR_64}/libgtest_main.a)
set(GMOCK_LIBRARY ${INSTALL_LIBDIR_64}/libgmock.a)
Expand Down Expand Up @@ -281,7 +282,7 @@ else()
set(LIB_GLOG libglog.a)
endif()

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(GLOG_LIBRARY ${INSTALL_LIBDIR_64}/${LIB_GLOG})
else()
set(GLOG_LIBRARY ${INSTALL_LIBDIR}/${LIB_GLOG})
Expand Down Expand Up @@ -316,7 +317,7 @@ ExternalProject_Add(snappy
make -j${CPU_CORE}
)

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(SNAPPY_LIBRARY ${INSTALL_LIBDIR_64}/libsnappy.a)
else()
set(SNAPPY_LIBRARY ${INSTALL_LIBDIR}/libsnappy.a)
Expand Down Expand Up @@ -354,7 +355,7 @@ ExternalProject_Add(zstd
make -j${CPU_CORE}
)

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(ZSTD_LIBRARY ${INSTALL_LIBDIR_64}/libzstd.a)
else()
set(ZSTD_LIBRARY ${INSTALL_LIBDIR}/libzstd.a)
Expand Down Expand Up @@ -393,7 +394,7 @@ else()
set(LIB_FMT libfmt.a)
endif()

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(FMT_LIBRARY ${INSTALL_LIBDIR_64}/${LIB_FMT})
else()
set(FMT_LIBRARY ${INSTALL_LIBDIR}/${LIB_FMT})
Expand Down Expand Up @@ -431,7 +432,7 @@ ExternalProject_Add(lz4
make -j${CPU_CORE}
)

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(LZ4_LIBRARY ${INSTALL_LIBDIR_64}/liblz4.a)
else()
set(LZ4_LIBRARY ${INSTALL_LIBDIR}/liblz4.a)
Expand Down Expand Up @@ -717,7 +718,7 @@ if (USE_PIKA_TOOLS)
set(BZ2_LIBRARY ${INSTALL_LIBDIR}/libbz2.a)
endif()

if(${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "Rocky")
set(ROCKSDB_LIBRARY ${INSTALL_LIBDIR_64}/librocksdb.a)
else()
set(ROCKSDB_LIBRARY ${INSTALL_LIBDIR}/librocksdb.a)
Expand Down
10 changes: 8 additions & 2 deletions ci/release-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ function install_deps() {
elif [[ $OS == *"ubuntu"* ]]; then
sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler
sudo apt-get install -y clang-tidy-12
elif [[ $OS == *"rocky"* ]]; then
sudo dnf update -y
sudo dnf install -y bash cmake
sudo dnf install -y wget git autoconf gcc perl-Digest-SHA
sudo dnf install -y tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel
sudo dnf install -y gcc-toolset-13
else
echo "not support $OS"
fi
Expand All @@ -22,8 +28,8 @@ function configure_cmake() {
cmake -B build -DCMAKE_C_COMPILER=/usr/local/opt/gcc@10/bin/gcc-10 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE
elif [[ $OS == *"ubuntu"* ]]; then
cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS="-s" -DCMAKE_EXE_LINKER_FLAGS="-s"
elif [[ $OS == *"centos"* ]]; then
source /opt/rh/devtoolset-10/enable
elif [[ $OS == *"rocky"* ]]; then
source /opt/rh/gcc-toolset-13/enable
cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address
fi
echo "configure cmake after ..."
Expand Down
10 changes: 5 additions & 5 deletions codis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ codis-deps:

codis-dashboard: codis-deps
$(info build codis-dashboard)
@cd ${PRJ_ROOT}/cmd/dashboard && go mod tidy && go build -o ${PRJ_ROOT}/bin/codis-dashboard .
@cd ${PRJ_ROOT}/cmd/dashboard && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-dashboard .
@${PRJ_ROOT}/bin/codis-dashboard --default-config > ${PRJ_ROOT}/config/dashboard.toml

codis-proxy: codis-deps
$(info build codis-proxy)
@cd ${PRJ_ROOT}/cmd/proxy && go mod tidy && go build -o ${PRJ_ROOT}/bin/codis-proxy .
@cd ${PRJ_ROOT}/cmd/proxy && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-proxy .
@${PRJ_ROOT}/bin/codis-proxy --default-config > ${PRJ_ROOT}/config/proxy.toml

codis-admin: codis-deps
$(info build codis-admin)
@cd ${PRJ_ROOT}/cmd/admin && go mod tidy && go build -o ${PRJ_ROOT}/bin/codis-admin .
@cd ${PRJ_ROOT}/cmd/admin && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-admin .

codis-ha: codis-deps
$(info build codis-ha)
@cd ${PRJ_ROOT}/cmd/ha && go mod tidy && go build -o ${PRJ_ROOT}/bin/codis-ha .
@cd ${PRJ_ROOT}/cmd/ha && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-ha .

codis-fe: codis-deps
$(info build codis-fe)
@cd ${PRJ_ROOT}/cmd/fe && go mod tidy && go build -o ${PRJ_ROOT}/bin/codis-fe .
@cd ${PRJ_ROOT}/cmd/fe && go mod tidy && go build -buildvcs=false -o ${PRJ_ROOT}/bin/codis-fe .
@rm -rf ${PRJ_ROOT}/bin/assets && cp -rf ${PRJ_ROOT}/cmd/fe/assets ./bin/

clean:
Expand Down
3 changes: 3 additions & 0 deletions utils/Get_OS_Version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Get_Dist_Name()
elif grep -Eqii "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
DISTRO='CentOS'
PM='yum'
elif grep -Eqii "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
DISTRO='Rocky'
PM='nfs'
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
DISTRO='RHEL'
PM='yum'
Expand Down

0 comments on commit 93878ce

Please sign in to comment.