Skip to content

Commit

Permalink
Add container environment for building and testing in CI (#1569)
Browse files Browse the repository at this point in the history
In this PR, we add a container environment (currently CentOS 7) for building and testing in CI.
  • Loading branch information
PragmaTwice authored Jul 10, 2023
1 parent e2d637c commit 943af5c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/kvrocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,78 @@ 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
runs-on: ubuntu-latest
needs:
- precondition
- build-and-test
- build-and-test-on-container
- check-docker
steps:
- name: Merge requirement checking
Expand Down

0 comments on commit 943af5c

Please sign in to comment.