diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml index 505e39ea08b..e191d614a9d 100644 --- a/.github/workflows/kvrocks.yaml +++ b/.github/workflows/kvrocks.yaml @@ -291,6 +291,70 @@ jobs: context: . build-args: MORE_BUILD_ARGS=-j${{ env.NPROC }} + build-and-test-on-container: + name: Build and test on container + needs: [precondition, check-and-lint] + if: ${{ needs.precondition.outputs.docs_only != 'true' }} + strategy: + fail-fast: false + matrix: + include: + - name: CentOS 7 + image: centos:7 + compiler: gcc + + runs-on: ubuntu-22.04 + container: + image: ${{ matrix.image }} + steps: + - name: Setup CentOS + if: ${{ startsWith(matrix.image, 'centos') }} + run: | + yum install -y centos-release-scl-rh + yum install -y devtoolset-11 python3 autoconf automake wget git + echo "NPROC=$(nproc)" >> $GITHUB_ENV + + - name: Cache redis + id: cache-redis + uses: actions/cache@v3 + with: + path: | + ~/local/bin/redis-cli + key: ${{ matrix.image }}-redis-cli + - name: Install redis + if: steps.cache-redis.outputs.cache-hit != 'true' + run: | + curl -O https://download.redis.io/releases/redis-6.2.7.tar.gz + tar -xzvf redis-6.2.7.tar.gz + mkdir -p $HOME/local/bin + pushd redis-6.2.7 && USE_JEMALLOC=no make -j$NPROC redis-cli && mv src/redis-cli $HOME/local/bin/ && popd + + - 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 + + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: 'tests/gocase/go.mod' + + - name: Build Kvrocks + if: ${{ startsWith(matrix.image, 'centos') }} + run: | + source /opt/rh/devtoolset-11/enable + ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} + + - name: Run Unit Test + run: | + ./x.py test cpp + + - name: Run Go Integration Cases + run: | + export PATH=$PATH:$HOME/local/bin/ + GOCASE_RUN_ARGS="" + ./x.py test go build $GOCASE_RUN_ARGS + required: if: always() name: Required @@ -298,6 +362,7 @@ jobs: needs: - precondition - build-and-test + - build-and-test-on-container - check-docker steps: - name: Merge requirement checking