Skip to content

Commit f84c1e3

Browse files
authored
Added CI check for GCC (#394)
* Added gcc workflow * Added CI check for GCC * Fix * fix * fix * Fixed clang build * fix * Fix * fix * Updated YDB versions * Fixed examples version * Fixed examples version
1 parent 24c247e commit f84c1e3

File tree

16 files changed

+176
-113
lines changed

16 files changed

+176
-113
lines changed

.devcontainer/Dockerfile

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,36 @@ FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04
33
# Install software-properties-common for add-apt-repository
44
RUN apt-get update && apt-get -y install software-properties-common
55

6+
# Install CMake
7+
ENV CMAKE_VERSION=3.27.7
8+
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install make && \
9+
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \
10+
tar -xvzf cmake-${CMAKE_VERSION}.tar.gz && cd cmake-${CMAKE_VERSION} && \
11+
./bootstrap && \
12+
make -j$(nproc) && \
13+
make install
14+
615
# Install C++ tools and libraries
7-
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get -y update && apt-get -y install \
8-
git gdb cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \
16+
RUN apt-get -y update && apt-get -y install \
17+
git gdb ninja-build libidn11-dev ragel yasm protobuf-compiler \
918
protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \
1019
rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \
11-
libbz2-dev libdouble-conversion-dev libstdc++-13-dev liblz4-dev libssl-dev \
20+
libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13 liblz4-dev libssl-dev \
1221
&& apt-get clean && rm -rf /var/lib/apt/lists/*
1322

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

19-
# Update alternatives to use clang-16 and clang++-16 by default
20-
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 && \
21-
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 100 && \
22-
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100
28+
# Update alternatives to use clang-16 by default
29+
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 10000 && \
30+
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 10000 && \
31+
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 10000
32+
33+
# Update alternatives to use gcc-13 by default
34+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000 && \
35+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10000
2336

2437
# Install libiconv
2538
ENV LIBICONV_VERSION=1.15

.devcontainer/configure.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
mkdir -p build
44
git submodule update --init --recursive
55
ccache -o cache_dir=/root/.ccache
6-
cmake --preset release-test-with-ccache-basedir -DCMAKE_EXPORT_COMPILE_COMMANDS=1
6+
cmake --preset release-test-clang
77

88
if which ydb > /dev/null 2>&1; then
99
ENDPOINT=$(echo ${YDB_CONNECTION_STRING_SECURE:-$YDB_CONNECTION_STRING} | awk -F/ '{print $3}')

.github/actions/build/action.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
name: Build
22
description: Build YDB SDK
33

4+
inputs:
5+
compiler:
6+
description: 'Compiler to use (clang or gcc)'
7+
required: true
8+
default: 'clang'
9+
410
runs:
511
using: "composite"
612
steps:
713
- name: Configure
814
shell: bash
915
run: |
10-
mkdir -p ../build
11-
rm -rf ../build/*
12-
cmake --preset release-test-with-ccache-basedir
16+
mkdir -p build
17+
rm -rf build/*
18+
cmake --preset release-test-${{ inputs.compiler }}
1319
- name: Build
1420
shell: bash
1521
run: |
1622
ccache -z
1723
export CCACHE_BASEDIR=`realpath ..`
1824
export CCACHE_DIR=~/.ccache
19-
cmake --build --preset release -- -j32
25+
cmake --build --preset default -- -j$(nproc)
2026
ccache -s

.github/actions/prepare_vm/action.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ description: Install required packages
44
runs:
55
using: "composite"
66
steps:
7+
- name: Install CMake and Ninja
8+
uses: lukka/[email protected]
79
- name: Install dependencies
810
shell: bash
911
run: |
1012
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
1113
sudo apt-get -y update
12-
sudo apt-get -y install git cmake ninja-build libidn11-dev ragel yasm protobuf-compiler \
14+
sudo apt-get -y install git ninja-build libidn11-dev ragel yasm protobuf-compiler \
1315
protobuf-compiler-grpc libprotobuf-dev libgrpc++-dev libgrpc-dev libgrpc++1 libgrpc10 \
1416
rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \
15-
libbz2-dev libdouble-conversion-dev libstdc++-13-dev
17+
libbz2-dev libdouble-conversion-dev libstdc++-13-dev gcc-13 g++-13
1618
wget https://apt.llvm.org/llvm.sh
1719
chmod u+x llvm.sh
1820
sudo ./llvm.sh 16
19-
sudo ln -sf /usr/bin/clang-16 /usr/bin/clang
20-
sudo ln -sf /usr/bin/clang++-16 /usr/bin/clang++
21+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 10000
22+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 10000
23+
24+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000
25+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10000
26+
2127
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
2228
tar -xvzf libiconv-1.15.tar.gz
2329
cd libiconv-1.15

.github/workflows/examples.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
ydb-version: [24.1, trunk]
20+
ydb-version: [25.1, trunk]
21+
compiler: [clang, gcc]
2122
services:
2223
ydb:
2324
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
@@ -56,15 +57,17 @@ jobs:
5657
uses: actions/cache/restore@v4
5758
with:
5859
path: ~/.ccache
59-
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
60+
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
6061
restore-keys: |
61-
ubuntu-22.04-ccache-
62+
ubuntu-22.04-ccache-${{ matrix.compiler }}-
6263
- name: Build
6364
uses: ./.github/actions/build
65+
with:
66+
compiler: ${{ matrix.compiler }}
6467
- name: Launch basic example
6568
shell: bash
6669
run: |
67-
cd ../build
70+
cd build
6871
examples/basic_example/basic_example -e localhost:2136 -d /local
6972
examples/bulk_upsert_simple/bulk_upsert_simple -e localhost:2136 -d /local -p /local/bulk
7073
examples/pagination/pagination -e localhost:2136 -d /local -p /local/pagination

.github/workflows/tests.yaml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ concurrency:
1313
jobs:
1414
unit:
1515
concurrency:
16-
group: unit-${{ github.ref }}-${{ matrix.os }}
16+
group: unit-${{ github.ref }}-${{ matrix.os }}-${{ matrix.compiler }}
1717
cancel-in-progress: true
1818
strategy:
1919
fail-fast: false
20+
matrix:
21+
compiler: [clang, gcc]
2022
env:
2123
OS: ubuntu-22.04
2224
runs-on: ubuntu-22.04
@@ -44,25 +46,28 @@ jobs:
4446
uses: actions/cache/restore@v4
4547
with:
4648
path: ~/.ccache
47-
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
49+
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
4850
restore-keys: |
49-
ubuntu-22.04-ccache-
51+
ubuntu-22.04-ccache-${{ matrix.compiler }}-
5052
- name: Build
5153
uses: ./.github/actions/build
54+
with:
55+
compiler: ${{ matrix.compiler }}
5256
- name: Test
5357
shell: bash
5458
run: |
55-
ctest -j32 --preset release-unit
59+
ctest -j$(nproc) --preset unit
5660
5761
integration:
5862
concurrency:
59-
group: integration-${{ github.ref }}-${{ matrix.ydb-version }}
63+
group: integration-${{ github.ref }}-${{ matrix.ydb-version }}-${{ matrix.compiler }}
6064
cancel-in-progress: true
6165
runs-on: ubuntu-22.04
6266
strategy:
6367
fail-fast: false
6468
matrix:
65-
ydb-version: [23.3, 24.1, trunk]
69+
ydb-version: [24.1, 24.2, 24.3, 24.4, 25.1, trunk]
70+
compiler: [clang, gcc]
6671
services:
6772
ydb:
6873
image: ydbplatform/local-ydb:${{ matrix.ydb-version }}
@@ -101,12 +106,14 @@ jobs:
101106
uses: actions/cache/restore@v4
102107
with:
103108
path: ~/.ccache
104-
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
109+
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
105110
restore-keys: |
106-
ubuntu-22.04-ccache-
111+
ubuntu-22.04-ccache-${{ matrix.compiler }}-
107112
- name: Build
108113
uses: ./.github/actions/build
114+
with:
115+
compiler: ${{ matrix.compiler }}
109116
- name: Test
110117
shell: bash
111118
run: |
112-
ctest -j32 --preset release-integration
119+
ctest -j$(nproc) --preset integration

.github/workflows/warmup_cache.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
main:
1010
name: Build YDB C++ SDK and cache artifacts
1111
runs-on: ubuntu-22.04
12+
strategy:
13+
matrix:
14+
compiler: [clang, gcc]
1215
steps:
1316
- name: Checkout
1417
uses: actions/checkout@v3
@@ -27,8 +30,10 @@ jobs:
2730
uses: actions/cache@v4
2831
with:
2932
path: ~/.ccache
30-
key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
33+
key: ubuntu-22.04-ccache-${{ matrix.compiler }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
3134
restore-keys: |
32-
ubuntu-22.04-ccache-
35+
ubuntu-22.04-ccache-${{ matrix.compiler }}-
3336
- name: Build
3437
uses: ./.github/actions/build
38+
with:
39+
compiler: ${{ matrix.compiler }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ __pycache__/
4646

4747
/compile_commands.json
4848

49+
/build
4950
/build_*
5051
/build-*
5152

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
cmake_minimum_required(VERSION 3.15)
2-
project(YDB-CPP-SDK LANGUAGES C CXX ASM)
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
file(READ "src/version.h" YDB_SDK_VERSION_FILE_RAW)
4+
string(REGEX MATCH "YDB_SDK_VERSION = \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${YDB_SDK_VERSION_FILE_RAW})
5+
set(YDB_SDK_VERSION ${CMAKE_MATCH_1})
6+
message(STATUS "YDB С++ SDK version: ${YDB_SDK_VERSION}")
7+
8+
project(YDB-CPP-SDK VERSION ${YDB_SDK_VERSION} LANGUAGES C CXX ASM)
39

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

2426
#[=============================================================================[
2527
NOTE: if `ccache` is used with the environment variable `CCACHE_BASEDIR`,

0 commit comments

Comments
 (0)