Skip to content

fix: CI

fix: CI #4973

Workflow file for this run

name: Pika
on:
push:
branches: [ "unstable", "3.5" , "4.0"]
pull_request:
branches: [ "unstable", "3.5" , "4.0"]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
ARTIFACT_PIKA_NAME: artifact-pika
jobs:
build_on_ubuntu:
# The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu Host)
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker system prune -af
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ubuntu-latest
- name: Install Deps
run: |
sudo apt-get update
sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler clang-tidy
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
# Build your program with the given configuration
run: cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Cleanup
run: |
rm -rf ./buildtrees
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_PIKA_NAME }}
path: ${{ github.workspace }}/build/pika
- name: Test
working-directory: ${{ github.workspace }}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }}
- name: Unit Test
working-directory: ${{ github.workspace }}
run: ./pikatests.sh all clean
# master on port 9221, slave on port 9231, all with 2 db
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
../tests/integration/start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tools/pika_keys_analysis/
go test -v ./...
cd ../../tests/integration/
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_rocky:
runs-on: ubuntu-latest
container:
image: rockylinux:9
steps:
- name: set up mirror
run: |
rm -rf /etc/yum.repos.d/CentOS-Base.repo
cat > /etc/yum.repos.d/CentOS-Base.repo << EOL
[base]
name=CentOS-\$releasever - Base
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-\$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/updates/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-\$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/extras/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-\$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/centosplus/\$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOL
cat > /etc/yum.repos.d/CentOS-SCLo-scl.repo << EOL
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Source
baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOL
cat > /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo << EOL
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Source
baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOL
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-SCLo
yum clean all
yum makecache
- name: Install deps
run: |
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 binutils
dnf clean all
rm -rf /var/cache/dnf
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Configure CMake
run: |
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 }}-rocky-deps-${{ hashFiles('**/CMakeLists.txt') }}
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/buildtrees
key: ${{ runner.os }}-rocky-buildtrees-${{ hashFiles('**/CMakeLists.txt') }}
- name: Build
run: |
source /opt/rh/gcc-toolset-13/enable
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Cleanup
run: |
rm -rf ./buildtrees
rm -rf ./build/Testing
rm -rf ./deps/src ./deps/include ./deps/share
echo "Cleaning up object files to save space..."
find ./build -name "*.o" -type f -delete
find ./build -name "*.a" -type f -delete
find ./build -name "*.pb.cc" -type f -delete
find ./build -name "*.pb.h" -type f -delete
echo "Stripping debug symbols from binaries..."
find ./build -type f -executable -not -name "*.sh" -exec strip --strip-debug {} \; || true
rm -rf .git
rm -rf include
rm -rf docs
rm -rf tools/codis_to_pika tools/aof_to_pika tools/binlog_sender
rm -rf codis/ansible codis/example codis/doc
- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ env.BUILD_TYPE }}
- name: Unit Test
working-directory: ${{ github.workspace }}
run: ./pikatests.sh all clean
- name: Cleanup artifacts
working-directory: ${{ github.workspace }}/build
run: |
df -h
rm -rf Testing CMakeFiles CMakeCache.txt cmake_install.cmake Makefile
find . -name "*.o" -o -name "*.a" -delete
find . -name "*.log" -delete
find . -name "*.cmake" -delete
find . -type d -name "CMakeFiles" -exec rm -rf {} + || true
find . -name "*.pb.cc" -o -name "*.pb.h" -delete || true
find . -type f -name "*_test" -executable -delete || true
find ./src/storage/tests -type f -perm -111 -delete || true
find ../deps -name "*.a" -delete
go clean -cache -testcache -modcache
rm -rf /root/.cache/go-build /root/go/pkg/mod
rm -rf ../log ../pika_log ../dump ../*.log ../dbsync ../db[0-9]* ../log[0-9]*
find ../src -name "*.o" -delete || true
dnf clean all
rm -rf /var/cache/dnf /tmp/* /var/tmp/*
du -h --max-depth=3 .. | sort -hr | head -n 20
find .. -type f -exec du -h {} + | sort -hr | head -n 20
du -h --max-depth=1 / | sort -hr | head -n 15
df -h
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
../tests/integration/start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
find . -name "pika.conf" -exec sed -i 's/loglevel : info/loglevel : error/g' {} +
find . -name "pika.conf" -exec sed -i 's/loglevel : debug/loglevel : error/g' {} +
cd ../tools/pika_keys_analysis/
go test -v ./...
cd ../../tests/integration/
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_macos:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: macos-14
- name: Install Deps
run: |
brew list --versions cmake && brew uninstall --ignore-dependencies --force cmake || true
brew install gcc@13 automake cmake make binutils
- name: Configure CMake
run: |
GCC_PREFIX=$(brew --prefix gcc@13)
export CC=$GCC_PREFIX/bin/gcc-13
cmake -B build -DCMAKE_C_COMPILER=$GCC_PREFIX/bin/gcc-13 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: |
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Cleanup
run: |
cp deps/lib/libz.1.dylib .
cp deps/lib/libz.1.dylib tests/integration/
rm -rf ./buildtrees
find tests -name "*.tcl" -exec sed -i '' 's/exec leaks/exec echo "0 leaks"/g' {} +
- name: Unit Test
working-directory: ${{ github.workspace }}
run: |
./pikatests.sh all clean
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}
run: |
cd tests/integration/
chmod +x start_master_and_slave.sh
./start_master_and_slave.sh
chmod +x start_codis.sh
./start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}
run: |
cd tests/integration/
chmod +x integrate_test.sh
# sh integrate_test.sh
build_pika_image:
name: Build Pika Docker image
runs-on: ubuntu-latest
needs: build_on_ubuntu
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: pikadb/pika
- uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_PIKA_NAME }}
path: artifact/
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./ci/Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}