Skip to content

Commit 85437b5

Browse files
authored
Merge pull request #429 from Enmk/CICD_fixing_linux
CI/CD fix
2 parents 9c3c857 + 5aab78e commit 85437b5

File tree

7 files changed

+134
-39
lines changed

7 files changed

+134
-39
lines changed

.github/workflows/linux.yml

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
schedule:
55
- cron: '0 0 * * 1'
66
push:
7-
branches: [ master ]
7+
branches: [ '*' ]
88
pull_request:
99
branches: [ master ]
1010

@@ -22,43 +22,53 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
os: [ubuntu-20.04]
26-
compiler: [clang-6, clang-10-libc++, gcc-7, gcc-8, gcc-9]
25+
compiler: [clang-11, clang-14, clang-18, gcc-9, gcc-12, gcc-14]
2726
ssl: [ssl_ON, ssl_OFF]
2827
dependencies: [dependencies_BUILT_IN]
2928

3029
include:
31-
- compiler: clang-6
32-
COMPILER_INSTALL: clang-6.0 libc++-dev
33-
C_COMPILER: clang-6.0
34-
CXX_COMPILER: clang++-6.0
35-
36-
- compiler: clang-10-libc++
37-
COMPILER_INSTALL: clang-10 libc++-dev
38-
C_COMPILER: clang-10
39-
CXX_COMPILER: clang++-10
40-
41-
- compiler: gcc-7
42-
COMPILER_INSTALL: gcc-7 g++-7
43-
C_COMPILER: gcc-7
44-
CXX_COMPILER: g++-7
45-
46-
- compiler: gcc-8
47-
COMPILER_INSTALL: gcc-8 g++-8
48-
C_COMPILER: gcc-8
49-
CXX_COMPILER: g++-8
30+
- compiler: clang-11
31+
os: ubuntu-22.04
32+
COMPILER_INSTALL: clang-11 libc++-11-dev
33+
C_COMPILER: clang-11
34+
CXX_COMPILER: clang++-11
35+
36+
- compiler: clang-14
37+
os: ubuntu-24.04
38+
COMPILER_INSTALL: clang-14 libc++-14-dev
39+
C_COMPILER: clang-14
40+
CXX_COMPILER: clang++-14
41+
42+
- compiler: clang-18
43+
os: ubuntu-24.04
44+
COMPILER_INSTALL: clang-18 libc++-18-dev
45+
C_COMPILER: clang-18
46+
CXX_COMPILER: clang++-18
5047

5148
- compiler: gcc-9
49+
os: ubuntu-22.04
5250
COMPILER_INSTALL: gcc-9 g++-9
5351
C_COMPILER: gcc-9
5452
CXX_COMPILER: g++-9
5553

54+
- compiler: gcc-12
55+
os: ubuntu-24.04
56+
COMPILER_INSTALL: gcc-12 g++-12
57+
C_COMPILER: gcc-12
58+
CXX_COMPILER: g++-12
59+
60+
- compiler: gcc-14
61+
os: ubuntu-24.04
62+
COMPILER_INSTALL: gcc-14 g++-14
63+
C_COMPILER: gcc-14
64+
CXX_COMPILER: g++-14
65+
5666
- ssl: ssl_ON
5767
SSL_CMAKE_OPTION: -D WITH_OPENSSL=ON
5868

5969
- dependencies: dependencies_SYSTEM
6070
compiler: compiler_SYSTEM
61-
os: ubuntu-22.04
71+
os: ubuntu-24.04
6272
COMPILER_INSTALL: gcc g++
6373
C_COMPILER: gcc
6474
CXX_COMPILER: g++
@@ -77,9 +87,8 @@ jobs:
7787

7888
- name: Install dependencies
7989
run: |
80-
sudo apt-get update && \
90+
sudo apt-get update
8191
sudo apt-get install -y \
82-
docker \
8392
cmake \
8493
${{matrix.COMPILER_INSTALL}} \
8594
${{matrix.DEPENDENCIES_INSTALL}}
@@ -92,6 +101,7 @@ jobs:
92101
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
93102
sudo apt update -q
94103
sudo apt install docker-ce docker-ce-cli containerd.io
104+
sudo docker run hello-world
95105
96106
- name: Configure project
97107
run: |

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
schedule:
55
- cron: '0 0 * * 1'
66
push:
7-
branches: [ master ]
7+
branches: [ '*' ]
88
pull_request:
99
branches: [ master ]
1010
release:

.github/workflows/windows_mingw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
schedule:
55
- cron: '0 0 * * 1'
66
push:
7-
branches: [ master ]
7+
branches: [ '*' ]
88
pull_request:
99
branches: [ master ]
1010

.github/workflows/windows_msvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
schedule:
55
- cron: '0 0 * * 1'
66
push:
7-
branches: [ master ]
7+
branches: [ '*' ]
88
pull_request:
99
branches: [ master ]
1010

ut/utils_comparison.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,15 @@ ::testing::AssertionResult CompareCotainersRecursive(const LeftContainer& left,
141141
template <typename Container>
142142
struct PrintContainer;
143143

144+
144145
template <typename Left, typename Right>
145146
::testing::AssertionResult CompareRecursive(const Left & left, const Right & right) {
146-
if constexpr (!is_string_v<Left> && !is_string_v<Right>
147-
&& (is_container_v<Left> || std::is_base_of_v<clickhouse::Column, std::decay_t<Left>>)
148-
&& (is_container_v<Right> || std::is_base_of_v<clickhouse::Column, std::decay_t<Right>>) ) {
147+
using L = std::decay_t<Left>;
148+
using R = std::decay_t<Right>;
149+
150+
if constexpr (!is_string_v<L> && !is_string_v<R>
151+
&& (is_container_v<L> || std::is_base_of_v<clickhouse::Column, L>)
152+
&& (is_container_v<R> || std::is_base_of_v<clickhouse::Column, R>) ) {
149153

150154
const auto & l = maybeWrapColumnAsContainer(left);
151155
const auto & r = maybeWrapColumnAsContainer(right);
@@ -155,24 +159,29 @@ ::testing::AssertionResult CompareRecursive(const Left & left, const Right & rig
155159
else
156160
return result << "\nExpected container: " << PrintContainer{l}
157161
<< "\nActual container : " << PrintContainer{r};
162+
}
163+
else if constexpr (std::is_same_v<char const *, L> || std::is_same_v<char *, L>) {
164+
return CompareRecursive(std::string_view(left), right);
165+
}
166+
else if constexpr (std::is_same_v<char const *, R> || std::is_same_v<char *, R>) {
167+
return CompareRecursive(left, std::string_view(right));
158168
} else {
159169
if (left != right) {
160-
161170
// Handle std::optional<float>(nan)
162-
// I'm too lazy to code comparison against std::nullopt, but this shpudn't be a problem in real life.
163-
// RN comparing against std::nullopt, you'll receive an compilation error.
164-
if constexpr (is_instantiation_of<std::optional, Left>::value && is_instantiation_of<std::optional, Right>::value)
171+
// I'm too lazy to code comparison against std::nullopt, but this shouldn't be a problem in real life.
172+
// RN comparing against std::nullopt, you'll get a compilation error.
173+
if constexpr (is_instantiation_of<std::optional, L>::value && is_instantiation_of<std::optional, R>::value)
165174
{
166175
if (left.has_value() && right.has_value())
167176
return CompareRecursive(*left, *right);
168177
}
169-
else if constexpr (is_instantiation_of<std::optional, Left>::value) {
178+
else if constexpr (is_instantiation_of<std::optional, L>::value) {
170179
if (left)
171180
return CompareRecursive(*left, right);
172-
} else if constexpr (is_instantiation_of<std::optional, Right>::value) {
181+
} else if constexpr (is_instantiation_of<std::optional, R>::value) {
173182
if (right)
174183
return CompareRecursive(left, *right);
175-
} else if constexpr (std::is_floating_point_v<Left> && std::is_floating_point_v<Right>) {
184+
} else if constexpr (std::is_floating_point_v<L> && std::is_floating_point_v<R>) {
176185
if (std::isnan(left) && std::isnan(right))
177186
return ::testing::AssertionSuccess();
178187
}

ut/utils_meta.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct is_instantiation_of< Template, Template<Args...> > : std::true_type {};
5252
template <typename T>
5353
inline constexpr bool is_string_v = std::is_same_v<std::string, std::decay_t<T>> || std::is_same_v<std::string_view, std::decay_t<T>>;
5454

55+
5556
// https://stackoverflow.com/a/34111095
5657
template <typename...>
5758
struct is_one_of {

ut/utils_ut.cpp

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,84 @@ TEST(CompareRecursive, CompareValues) {
1212
EXPECT_TRUE(CompareRecursive(1.0, 1.0));
1313
EXPECT_TRUE(CompareRecursive(1.0L, 1.0L));
1414

15+
EXPECT_TRUE(CompareRecursive('a', 'a'));
16+
}
17+
18+
TEST(CompareRecursive, CompareStrings) {
19+
// literals
1520
EXPECT_TRUE(CompareRecursive("1.0L", "1.0L"));
16-
EXPECT_TRUE(CompareRecursive(std::string{"1.0L"}, std::string{"1.0L"}));
21+
EXPECT_TRUE(CompareRecursive("1.0L", std::string("1.0L")));
22+
EXPECT_TRUE(CompareRecursive(std::string("1.0L"), "1.0L"));
23+
EXPECT_TRUE(CompareRecursive("1.0L", std::string_view("1.0L")));
24+
EXPECT_TRUE(CompareRecursive(std::string_view("1.0L"), "1.0L"));
25+
26+
// array
27+
const char str[] = "1.0L";
28+
EXPECT_TRUE(CompareRecursive("1.0L", str));
29+
EXPECT_TRUE(CompareRecursive(str, "1.0L"));
30+
EXPECT_TRUE(CompareRecursive(str, str));
31+
EXPECT_TRUE(CompareRecursive(str, std::string("1.0L")));
32+
EXPECT_TRUE(CompareRecursive(std::string("1.0L"), str));
33+
EXPECT_TRUE(CompareRecursive(str, std::string_view("1.0L")));
34+
EXPECT_TRUE(CompareRecursive(std::string_view("1.0L"), str));
35+
36+
// pointer
37+
const char *str2 = "1.0L";
38+
EXPECT_TRUE(CompareRecursive("1.0L", str2));
39+
EXPECT_TRUE(CompareRecursive(str2, "1.0L"));
40+
EXPECT_TRUE(CompareRecursive(str2, str2));
41+
EXPECT_TRUE(CompareRecursive(str2, str));
42+
EXPECT_TRUE(CompareRecursive(str, str2));
43+
EXPECT_TRUE(CompareRecursive(str2, std::string("1.0L")));
44+
EXPECT_TRUE(CompareRecursive(std::string("1.0L"), str2));
45+
EXPECT_TRUE(CompareRecursive(str2, std::string_view("1.0L")));
46+
EXPECT_TRUE(CompareRecursive(std::string_view("1.0L"), str2));
47+
48+
// string & string_view
49+
EXPECT_TRUE(CompareRecursive(std::string{"1.0L"}, std::string{"1.0L"}));
1750
EXPECT_TRUE(CompareRecursive(std::string_view{"1.0L"}, std::string_view{"1.0L"}));
51+
EXPECT_TRUE(CompareRecursive(std::string{"1.0L"}, std::string_view{"1.0L"}));
52+
EXPECT_TRUE(CompareRecursive(std::string_view{"1.0L"}, std::string{"1.0L"}));
53+
}
54+
55+
TEST(CompareRecursive, CompareContainerOfStrings) {
56+
const std::vector<const char*> vector_of_cstrings = {
57+
"abc",
58+
"cde",
59+
"ghi"
60+
};
61+
62+
const std::vector<std::string> vector_of_strings = {
63+
"abc",
64+
"cde",
65+
"ghi"
66+
};
67+
68+
const std::vector<std::string_view> vector_of_string_views = {
69+
"abc",
70+
"cde",
71+
"ghi"
72+
};
73+
74+
{
75+
// same values, but different pointers
76+
const std::vector<const char*> vector_of_cstrings2 = {
77+
vector_of_strings[0].data(),
78+
vector_of_strings[1].data(),
79+
vector_of_strings[2].data(),
80+
};
81+
EXPECT_TRUE(CompareRecursive(vector_of_cstrings, vector_of_cstrings2));
82+
}
83+
84+
EXPECT_TRUE(CompareRecursive(vector_of_strings, vector_of_strings));
85+
EXPECT_TRUE(CompareRecursive(vector_of_strings, vector_of_cstrings));
86+
EXPECT_TRUE(CompareRecursive(vector_of_cstrings, vector_of_strings));
87+
88+
EXPECT_TRUE(CompareRecursive(vector_of_string_views, vector_of_string_views));
89+
EXPECT_TRUE(CompareRecursive(vector_of_strings, vector_of_string_views));
90+
EXPECT_TRUE(CompareRecursive(vector_of_string_views, vector_of_strings));
91+
EXPECT_TRUE(CompareRecursive(vector_of_strings, vector_of_string_views));
92+
EXPECT_TRUE(CompareRecursive(vector_of_string_views, vector_of_strings));
1893
}
1994

2095
TEST(CompareRecursive, CompareContainers) {

0 commit comments

Comments
 (0)