Skip to content

add ci test

add ci test #15

Workflow file for this run

name: Timeplus Cpp CI
on:
pull_request:
types:
- synchronize
- reopened
- opened
- ready_for_review
- closed
branches:
- master
env:
BUILD_TYPE: Release
jobs:
build:
if: ${{ github.event.action != 'closed' || github.event.pull_request.merged == true }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [clang-10, clang-18, gcc-7, gcc-8, gcc-9]
ssl: [ssl_ON, ssl_OFF]
dependencies: [dependencies_BUILT_IN]
timeplusd: [2.3.22]
include:
- compiler: clang-10
COMPILER_INSTALL: clang-10 libc++-dev
C_COMPILER: clang-10
CXX_COMPILER: clang++-10
- compiler: clang-18
LLVM_INSTALL: 18
C_COMPILER: clang-18
CXX_COMPILER: clang++-18
- compiler: gcc-7
COMPILER_INSTALL: gcc-7 g++-7
C_COMPILER: gcc-7
CXX_COMPILER: g++-7
- compiler: gcc-8
COMPILER_INSTALL: gcc-8 g++-8
C_COMPILER: gcc-8
CXX_COMPILER: g++-8
- compiler: gcc-9
COMPILER_INSTALL: gcc-9 g++-9
C_COMPILER: gcc-9
CXX_COMPILER: g++-9
- ssl: ssl_ON
SSL_CMAKE_OPTION: -D WITH_OPENSSL=ON
- dependencies: dependencies_SYSTEM
compiler: compiler_SYSTEM
os: ubuntu-22.04
timeplusd: 2.3.22
COMPILER_INSTALL: gcc g++
C_COMPILER: gcc
CXX_COMPILER: g++
DEPENDENCIES_INSTALL: libabsl-dev liblz4-dev
DEPENDENCIES_CMAKE_OPTIONS: >-
-D WITH_SYSTEM_LZ4=ON
-D WITH_SYSTEM_ABSEIL=ON
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get install -y \
docker \
cmake \
${{matrix.COMPILER_INSTALL}} \
${{matrix.DEPENDENCIES_INSTALL}}
- name: Install LLVM
if: ${{ matrix.LLVM_INSTALL != '' }}
run: |
wget https://apt.llvm.org/llvm.sh && \
chmod u+x llvm.sh \
sudo ./llvm.sh ${{matrix.LLVM_INSTALL}}
- name: Install dependencies - Docker
run: |
sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -q
sudo apt install docker-ce docker-ce-cli containerd.io
- name: Configure project
run: |
cmake \
-D CMAKE_C_COMPILER=${{matrix.C_COMPILER}} \
-D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}} \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D BUILD_TESTS=ON \
-D BUILD_EXAMPLES=ON \
-D BUILD_GTEST=ON \
${{matrix.SSL_CMAKE_OPTION}} \
${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
- name: Build project
run: |
cmake \
--build ${{github.workspace}}/build \
--config ${{env.BUILD_TYPE}} \
--target all
- name: Test - Start timeplusd server in background
run: |
docker pull timeplus/timeplusd:${{matrix.timeplusd}}
docker run -d --name timeplusd -p 8463:8463 timeplus/timeplusd:${{matrix.timeplusd}}
docker ps -a
docker stats -a --no-stream
## Check and wait until timeplusd is ready to accept connections
docker exec timeplusd bash -c 'for i in {1..60}; do echo checking if timeplusd server is started attempt \#$i; if ( grep -q "<Information> Application: Ready for connections." /var/log/timeplusd-server/timeplusd-server.log ); then echo seems like timeplusd server is started; exit 0; fi; sleep 1; done; exit -1'
- name: Unit test
working-directory: ${{github.workspace}}/build/ut
run: ./timeplus-cpp-ut