Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container environment for building and testing in CI #1569

Merged
merged 4 commits into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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