Skip to content

Added CI check for GCC #394

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

Merged
merged 12 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
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
27 changes: 20 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,36 @@ FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04
# Install software-properties-common for add-apt-repository
RUN apt-get update && apt-get -y install software-properties-common

# Install CMake
ENV CMAKE_VERSION=3.27.7
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install make && \
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \
tar -xvzf cmake-${CMAKE_VERSION}.tar.gz && cd cmake-${CMAKE_VERSION} && \
./bootstrap && \
make -j$(nproc) && \
make install

# Install C++ tools and libraries
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install \
git gdb cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \
RUN apt-get -y update && apt-get -y install \
git gdb ninja-build libidn11-dev ragel yasm protobuf-compiler \
protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \
rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \
libbz2-dev libdouble-conversion-dev libstdc++-13-dev liblz4-dev libssl-dev \
libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13 liblz4-dev libssl-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Install LLVM
RUN wget https://apt.llvm.org/llvm.sh && \
chmod u+x llvm.sh && \
./llvm.sh 16

# Update alternatives to use clang-16 and clang++-16 by default
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 && \
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 100 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100
# Update alternatives to use clang-16 by default
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 10000 && \
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 10000 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 10000

# Update alternatives to use gcc-13 by default
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10000

# Install libiconv
ENV LIBICONV_VERSION=1.15
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mkdir -p build
git submodule update --init --recursive
ccache -o cache_dir=/root/.ccache
cmake --preset release-test-with-ccache-basedir -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --preset release-test-clang

if which ydb > /dev/null 2>&1; then
ENDPOINT=$(echo ${YDB_CONNECTION_STRING_SECURE:-$YDB_CONNECTION_STRING} | awk -F/ '{print $3}')
Expand Down
14 changes: 10 additions & 4 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: Build
description: Build YDB SDK

inputs:
compiler:
description: 'Compiler to use (clang or gcc)'
required: true
default: 'clang'

runs:
using: "composite"
steps:
- name: Configure
shell: bash
run: |
mkdir -p ../build
rm -rf ../build/*
cmake --preset release-test-with-ccache-basedir
mkdir -p build
rm -rf build/*
cmake --preset release-test-${{ inputs.compiler }}
- name: Build
shell: bash
run: |
ccache -z
export CCACHE_BASEDIR=`realpath ..`
export CCACHE_DIR=~/.ccache
cmake --build --preset release -- -j32
cmake --build --preset default -- -j$(nproc)
ccache -s
14 changes: 10 additions & 4 deletions .github/actions/prepare_vm/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ description: Install required packages
runs:
using: "composite"
steps:
- name: Install CMake and Ninja
uses: lukka/get-cmake@v3.27.7
- name: Install dependencies
shell: bash
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get -y update
sudo apt-get -y install git cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \
sudo apt-get -y install git ninja-build libidn11-dev ragel yasm protobuf-compiler \
protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \
rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \
libbz2-dev libdouble-conversion-dev libstdc++-13-dev
libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 16
sudo ln -sf /usr/bin/clang-16 /usr/bin/clang
sudo ln -sf /usr/bin/clang++-16 /usr/bin/clang++
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 10000
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 10000

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10000

wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar -xvzf libiconv-1.15.tar.gz
cd libiconv-1.15
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
ydb-version: [24.1, trunk]
ydb-version: [25.1, trunk]
compiler: [clang, gcc]
services:
ydb:
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
Expand Down Expand Up @@ -56,15 +57,17 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.ccache
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
ubuntu-22.04-ccache-
ubuntu-22.04-ccache-${{ matrix.compiler }}-
- name: Build
uses: ./.github/actions/build
with:
compiler: ${{ matrix.compiler }}
- name: Launch basic example
shell: bash
run: |
cd ../build
cd build
examples/basic_example/basic_example -e localhost:2136 -d /local
examples/bulk_upsert_simple/bulk_upsert_simple -e localhost:2136 -d /local -p /local/bulk
examples/pagination/pagination -e localhost:2136 -d /local -p /local/pagination
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ concurrency:
jobs:
unit:
concurrency:
group: unit-${{ github.ref }}-${{ matrix.os }}
group: unit-${{ github.ref }}-${{ matrix.os }}-${{ matrix.compiler }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
env:
OS: ubuntu-22.04
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -44,25 +46,28 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.ccache
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
ubuntu-22.04-ccache-
ubuntu-22.04-ccache-${{ matrix.compiler }}-
- name: Build
uses: ./.github/actions/build
with:
compiler: ${{ matrix.compiler }}
- name: Test
shell: bash
run: |
ctest -j32 --preset release-unit
ctest -j$(nproc) --preset unit

integration:
concurrency:
group: integration-${{ github.ref }}-${{ matrix.ydb-version }}
group: integration-${{ github.ref }}-${{ matrix.ydb-version }}-${{ matrix.compiler }}
cancel-in-progress: true
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
ydb-version: [23.3, 24.1, trunk]
ydb-version: [24.1, 24.2, 24.3, 24.4, 25.1, trunk]
compiler: [clang, gcc]
services:
ydb:
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
Expand Down Expand Up @@ -101,12 +106,14 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.ccache
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
ubuntu-22.04-ccache-
ubuntu-22.04-ccache-${{ matrix.compiler }}-
- name: Build
uses: ./.github/actions/build
with:
compiler: ${{ matrix.compiler }}
- name: Test
shell: bash
run: |
ctest -j32 --preset release-integration
ctest -j$(nproc) --preset integration
9 changes: 7 additions & 2 deletions .github/workflows/warmup_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
main:
name: Build YDB C++ SDK and cache artifacts
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [clang, gcc]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -27,8 +30,10 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.ccache
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
ubuntu-22.04-ccache-
ubuntu-22.04-ccache-${{ matrix.compiler }}-
- name: Build
uses: ./.github/actions/build
with:
compiler: ${{ matrix.compiler }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ __pycache__/

/compile_commands.json

/build
/build_*
/build-*

Expand Down
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.15)
project(YDB-CPP-SDK LANGUAGES C CXX ASM)
cmake_minimum_required(VERSION 3.5)

file(READ "src/version.h" YDB_SDK_VERSION_FILE_RAW)
string(REGEX MATCH "YDB_SDK_VERSION = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${YDB_SDK_VERSION_FILE_RAW})
set(YDB_SDK_VERSION ${CMAKE_MATCH_1})
message(STATUS "YDB С++ SDK version: ${YDB_SDK_VERSION}")

project(YDB-CPP-SDK VERSION ${YDB_SDK_VERSION} LANGUAGES C CXX ASM)

option(YDB_SDK_INSTALL "Install YDB C++ SDK" Off)
option(YDB_SDK_TESTS "Build YDB C++ SDK tests" Off)
Expand All @@ -16,10 +22,6 @@ set(YDB_SDK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(YDB_SDK_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(YDB-CPP-SDK_AVAILABLE_COMPONENTS "" CACHE INTERNAL "")
set(YDB-CPP-SDK_COMPONENT_TARGETS "" CACHE INTERNAL "")
file(READ "src/version.h" YDB_SDK_VERSION_FILE_RAW)
string(REGEX MATCH "YDB_SDK_VERSION = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${YDB_SDK_VERSION_FILE_RAW})
set(YDB_SDK_VERSION ${CMAKE_MATCH_1})
message(STATUS "YDB С++ SDK version: ${YDB_SDK_VERSION}")

#[=============================================================================[
NOTE: if `ccache` is used with the environment variable `CCACHE_BASEDIR`,
Expand Down
Loading
Loading