Skip to content

Commit 41c038a

Browse files
committed
Added gcc workflow
1 parent d122ca9 commit 41c038a

File tree

6 files changed

+134
-24
lines changed

6 files changed

+134
-24
lines changed

.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${{ inputs.compiler == 'gcc' && '-gcc' || '' }}
17+
rm -rf ../build${{ inputs.compiler == 'gcc' && '-gcc' || '' }}/*
18+
cmake --preset release-test-with-ccache-basedir${{ inputs.compiler == 'gcc' && '-gcc' || '' }}
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 release${{ inputs.compiler == 'gcc' && '-gcc' || '' }} -- -j32
2026
ccache -s

.github/workflows/examples.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
ydb-version: [24.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${{ matrix.compiler == 'gcc' && '-gcc' || '' }}
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: 15 additions & 8 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 -j32 --preset release-unit${{ matrix.compiler == 'gcc' && '-gcc' || '' }}
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:
6569
ydb-version: [23.3, 24.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 -j32 --preset release-integration${{ matrix.compiler == 'gcc' && '-gcc' || '' }}

.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 }}

CMakePresets.json

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,84 @@
3030
"hidden": true,
3131
"toolchainFile": "${sourceDir}/clang.toolchain"
3232
},
33+
{
34+
"name": "gcc-toolchain",
35+
"hidden": true,
36+
"toolchainFile": "${sourceDir}/gcc.toolchain"
37+
},
3338
{
3439
"name": "release",
3540
"inherits": [
3641
"ninja-generator",
3742
"release-build",
3843
"clang-toolchain"
3944
],
40-
"displayName": "Default Release Config",
45+
"displayName": "Default Release Config (Clang)",
4146
"description": "Default release build configuration using Ninja generator and Clang compiler",
4247
"binaryDir": "${sourceDir}/../build"
4348
},
49+
{
50+
"name": "release-gcc",
51+
"inherits": [
52+
"ninja-generator",
53+
"release-build",
54+
"gcc-toolchain"
55+
],
56+
"displayName": "Default Release Config (GCC)",
57+
"description": "Default release build configuration using Ninja generator and GCC compiler",
58+
"binaryDir": "${sourceDir}/../build-gcc"
59+
},
4460
{
4561
"name": "release-test",
4662
"inherits": "release",
47-
"displayName": "Default Release Test Config",
63+
"displayName": "Default Release Test Config (Clang)",
4864
"description": "Default release build configuration with all tests and examples",
4965
"cacheVariables": {
5066
"YDB_SDK_TESTS": "TRUE",
5167
"YDB_SDK_EXAMPLES": "TRUE"
5268
}
5369
},
70+
{
71+
"name": "release-test-gcc",
72+
"inherits": "release-gcc",
73+
"displayName": "Default Release Test Config (GCC)",
74+
"description": "Default release build configuration with all tests and examples using GCC",
75+
"cacheVariables": {
76+
"YDB_SDK_TESTS": "TRUE",
77+
"YDB_SDK_EXAMPLES": "TRUE"
78+
}
79+
},
5480
{
5581
"name": "release-test-with-ccache-basedir",
5682
"inherits": "release-test",
57-
"displayName": "Release Test Config CCACHE_BASEDIR Case",
83+
"displayName": "Release Test Config CCACHE_BASEDIR Case (Clang)",
5884
"description": "Only for the case when using CCACHE_BASEDIR",
5985
"cacheVariables": {
6086
"ARCADIA_ROOT": "../ydb-cpp-sdk",
6187
"ARCADIA_BUILD_ROOT": "."
6288
}
89+
},
90+
{
91+
"name": "release-test-with-ccache-basedir-gcc",
92+
"inherits": "release-test-gcc",
93+
"displayName": "Release Test Config CCACHE_BASEDIR Case (GCC)",
94+
"description": "Only for the case when using CCACHE_BASEDIR with GCC",
95+
"cacheVariables": {
96+
"ARCADIA_ROOT": "../ydb-cpp-sdk",
97+
"ARCADIA_BUILD_ROOT": "."
98+
}
6399
}
64100
],
65101
"buildPresets": [
66102
{
67103
"name": "release",
68104
"configurePreset": "release",
69-
"displayName": "Default Release Build"
105+
"displayName": "Default Release Build (Clang)"
106+
},
107+
{
108+
"name": "release-gcc",
109+
"configurePreset": "release-gcc",
110+
"displayName": "Default Release Build (GCC)"
70111
}
71112
],
72113
"testPresets": [
@@ -84,7 +125,17 @@
84125
"name": "release",
85126
"inherits": "common",
86127
"configurePreset": "release-test",
87-
"displayName": "Default Release Tests",
128+
"displayName": "Default Release Tests (Clang)",
129+
"environment": {
130+
"YDB_ENDPOINT": "localhost:2136",
131+
"YDB_DATABASE": "/local"
132+
}
133+
},
134+
{
135+
"name": "release-gcc",
136+
"inherits": "common",
137+
"configurePreset": "release-test-gcc",
138+
"displayName": "Default Release Tests (GCC)",
88139
"environment": {
89140
"YDB_ENDPOINT": "localhost:2136",
90141
"YDB_DATABASE": "/local"
@@ -94,7 +145,18 @@
94145
"name": "release-unit",
95146
"inherits": "common",
96147
"configurePreset": "release-test",
97-
"displayName": "Default Unit Release Tests",
148+
"displayName": "Default Unit Release Tests (Clang)",
149+
"filter" : {
150+
"include": {
151+
"label": "unit"
152+
}
153+
}
154+
},
155+
{
156+
"name": "release-unit-gcc",
157+
"inherits": "common",
158+
"configurePreset": "release-test-gcc",
159+
"displayName": "Default Unit Release Tests (GCC)",
98160
"filter" : {
99161
"include": {
100162
"label": "unit"
@@ -105,7 +167,22 @@
105167
"name": "release-integration",
106168
"inherits": "common",
107169
"configurePreset": "release-test",
108-
"displayName": "Default Integration Release Tests",
170+
"displayName": "Default Integration Release Tests (Clang)",
171+
"filter" : {
172+
"include": {
173+
"label": "integration"
174+
}
175+
},
176+
"environment": {
177+
"YDB_ENDPOINT": "localhost:2136",
178+
"YDB_DATABASE": "/local"
179+
}
180+
},
181+
{
182+
"name": "release-integration-gcc",
183+
"inherits": "common",
184+
"configurePreset": "release-test-gcc",
185+
"displayName": "Default Integration Release Tests (GCC)",
109186
"filter" : {
110187
"include": {
111188
"label": "integration"

gcc.toolchain

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(CMAKE_C_COMPILER gcc)
2+
set(CMAKE_CXX_COMPILER g++)
3+
set(CMAKE_EXE_LINKER_FLAGS "-rdynamic")
4+
set(CMAKE_SHARED_LINKER_FLAGS "")
5+
set(CMAKE_C_STANDARD_LIBRARIES "-lc -lm")
6+
set(CMAKE_CXX_STANDARD_LIBRARIES "-lc -lm")
7+
8+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C compiler flags")
9+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -UNDEBUG" CACHE STRING "C++ compiler flags")
10+
11+
set(ENV{CC} gcc)
12+
set(ENV{CXX} g++)

0 commit comments

Comments
 (0)