Skip to content

Commit 6301349

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/ci-create-service
2 parents 5905218 + f122b64 commit 6301349

File tree

2,672 files changed

+76643
-32823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,672 files changed

+76643
-32823
lines changed

.clang-tidy

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ Checks:
7272
,-hicpp-special-member-functions\
7373
,-hicpp-uppercase-literal-suffix\
7474
,-hicpp-vararg\
75+
,-misc-const-correctness\
7576
,-misc-include-cleaner\
7677
,-misc-no-recursion\
7778
,-misc-unconventional-assign-operator\
79+
,-misc-use-anonymous-namespace\
7880
,-modernize-avoid-c-arrays\
7981
,-modernize-pass-by-value\
8082
,-modernize-return-braced-init-list\
@@ -102,11 +104,75 @@ Checks:
102104
"
103105

104106
WarningsAsErrors: '*'
105-
HeaderFilterRegex: '/userver/(build|clickhouse|core|grpc|mongo|postgresql|redis|shared|tools)/'
107+
HeaderFilterRegex: '/userver/(build|clickhouse|core|grpc|mongo|postgresql|redis|kafka|shared|tools)/'
106108
CheckOptions:
107109
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
108110
value: '1'
109111
- key: readability-redundant-access-specifiers.CheckFirstDeclaration
110112
value: '1'
111113
- key: modernize-loop-convert.UseCxx20ReverseRanges
112114
value: 'false'
115+
116+
- key: readability-identifier-naming.ClassCase
117+
value: CamelCase
118+
# Allow DISABLED_CamelCase to skip gtest tests.
119+
- key: readability-identifier-naming.ClassIgnoredRegexp
120+
value: '^DISABLED_([A-Z][a-z]+)+$'
121+
- key: readability-identifier-naming.StructCase
122+
value: CamelCase
123+
- key: readability-identifier-naming.EnumCase
124+
value: CamelCase
125+
- key: readability-identifier-naming.UnionCase
126+
value: CamelCase
127+
- key: readability-identifier-naming.MemberCase
128+
value: lower_case
129+
- key: readability-identifier-naming.PrivateMemberSuffix
130+
value: '_'
131+
- key: readability-identifier-naming.ProtectedMemberSuffix
132+
value: '_'
133+
- key: readability-identifier-naming.MethodCase
134+
value: CamelCase
135+
- key: readability-identifier-naming.PublicMethodIgnoredRegexp
136+
value: "(begin|end|empty|size|ysize|front|back|parse|format)"
137+
# - key: readability-identifier-naming.FunctionCase
138+
# value: CamelCase
139+
# - key: readability-identifier-naming.ParameterCase
140+
# value: lower_case
141+
# - key: readability-identifier-naming.ParameterPackCase
142+
# value: lower_case
143+
# - key: readability-identifier-naming.VariableCase
144+
# value: lower_case
145+
# - key: readability-identifier-naming.ConstexprVariableCase
146+
# value: CamelCase
147+
# - key: readability-identifier-naming.ConstexprVariablePrefix
148+
# value: k
149+
# - key: readability-identifier-naming.GlobalVariableCase
150+
# value: CamelCase
151+
# - key: readability-identifier-naming.GlobalVariablePrefix
152+
# value: k
153+
# - key: readability-identifier-naming.StaticVariableCase
154+
# value: CamelCase
155+
# - key: readability-identifier-naming.StaticVariablePrefix
156+
# value: k
157+
- key: readability-identifier-naming.MacroDefinitionCase
158+
value: UPPER_CASE
159+
- key: readability-identifier-naming.NamespaceCase
160+
value: lower_case
161+
# Allow NCamelCase for NMonitoring.
162+
- key: readability-identifier-naming.NamespaceIgnoredRegexp
163+
value: ^N([A-Z][a-z]+)+$
164+
# Allow kCamelCase.
165+
- key: readability-identifier-naming.ValueTemplateParameterIgnoredRegexp
166+
value: ^k([A-Z][a-z]+)+$
167+
- key: readability-identifier-naming.ConceptCase
168+
value: CamelCase
169+
- key: readability-identifier-naming.TemplateParameterCase
170+
value: CamelCase
171+
- key: readability-identifier-naming.TemplateTemplateParameterCase
172+
value: CamelCase
173+
- key: readability-identifier-naming.TypedefCase
174+
value: CamelCase
175+
- key: readability-identifier-naming.TypeTemplateParameterCase
176+
value: CamelCase
177+
- key: readability-identifier-naming.ValueTemplateParameterCase
178+
value: CamelCase

.cmake-format.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# ----------------------------------
2+
# Options affecting listfile parsing
3+
# ----------------------------------
4+
with section('parse'): # noqa: F821
5+
# Specify structure for custom cmake functions
6+
# pargs - positional arguments
7+
# kwargs - keyword arguments
8+
additional_commands = {
9+
'userver_module': {
10+
'pargs': 1,
11+
'kwargs': {
12+
'SOURCE_DIR': '*',
13+
'INSTALL_COMPONENT': '*',
14+
'LINK_LIBRARIES': '*',
15+
'LINK_LIBRARIES_PRIVATE': '*',
16+
'UTEST_SOURCES': '*',
17+
'UTEST_DIRS': '*',
18+
'UTEST_LINK_LIBRARIES': '*',
19+
'INCLUDE_DIRS': '*',
20+
'DBTEST_SOURCES': '*',
21+
'DBTEST_DATABASES': '*',
22+
'DBTEST_DIRS': '*',
23+
'DBTEST_ENV': '*',
24+
'DBTEST_LINK_LIBRARIES': '*',
25+
'UBENCH_DIRS': '*',
26+
'UBENCH_DATABASES': '*',
27+
'UBENCH_SOURCES': '*',
28+
'UBENCH_LINK_LIBRARIES': '*',
29+
'UBENCH_ENV': '*',
30+
'POSTGRES_TEST_DSN': '*',
31+
},
32+
'flags': ['NO_INSTALL', 'NO_CORE_LINK', 'GENERATE_DYNAMIC_CONFIGS'],
33+
},
34+
'_userver_directory_install': {
35+
'kwargs': {
36+
'COMPONENT': '*',
37+
'DIRECTORY': '*',
38+
'PROGRAMS': '*',
39+
'FILES': '*',
40+
'DESTINATION': '*',
41+
},
42+
},
43+
'userver_target_generate_openapi_client': {
44+
'pargs': 1,
45+
'kwargs': {
46+
'NAME': '*',
47+
'OUTPUT_DIR': '*',
48+
'SCHEMAS': '*',
49+
'UTEST_LINK_LIBRARIES': '*',
50+
},
51+
},
52+
'userver_target_generate_chaotic': {
53+
'pargs': 1,
54+
'kwargs': {
55+
'ARGS': '*',
56+
'FORMAT': '*',
57+
'OUTPUT_DIR': '*',
58+
'SCHEMAS': '*',
59+
'RELATIVE_TO': '*',
60+
},
61+
'flags': ['UNIQUE'],
62+
},
63+
'userver_venv_setup': {
64+
'kwargs': {
65+
'NAME': '*',
66+
'PYTHON_OUTPUT_VAR': '*',
67+
'REQUIREMENTS': '*',
68+
},
69+
'flags': ['UNIQUE'],
70+
},
71+
'userver_add_grpc_library': {
72+
'pargs': 1,
73+
'kwargs': {
74+
'PROTOS': '*',
75+
'INCLUDE_DIRECTORIES': '*',
76+
},
77+
},
78+
'userver_chaos_testsuite_add': {
79+
'kwargs': {
80+
'ENV': '*',
81+
},
82+
},
83+
}
84+
85+
# -----------------------------
86+
# Options affecting formatting.
87+
# -----------------------------
88+
with section('format'): # noqa: F821
89+
# Disable formatting entirely, making cmake-format a no-op
90+
disable = False
91+
92+
# How wide to allow formatted cmake files
93+
line_width = 120
94+
95+
# How many spaces to tab for indent
96+
tab_size = 4
97+
98+
# If true, lines are indented using tab characters (utf-8 0x09) instead of
99+
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
100+
# require a fractional tab character, the behavior of the fractional
101+
# indentation is governed by <fractional_tab_policy>
102+
use_tabchars = False
103+
104+
# If <use_tabchars> is True, then the value of this variable indicates how
105+
# fractional indentions are handled during whitespace replacement. If set to
106+
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
107+
# to `round-up` fractional indentation is replaced with a single tab character
108+
# (utf-8 0x09) effectively shifting the column to the next tabstop
109+
fractional_tab_policy = 'use-space'
110+
111+
# If a statement is wrapped to more than one line, than dangle the closing
112+
# parenthesis on its own line.
113+
dangle_parens = True

.github/workflows/alpine.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424

25-
name: ubuntu-24.04 (build-only)
25+
name: alpine (build-only)
2626
runs-on: ubuntu-24.04
2727

2828
env:
2929
CMAKE_PROGRAM_PATH: /usr/lib/llvm17/bin
3030
CMAKE_FLAGS: >-
3131
-DCMAKE_BUILD_TYPE=Debug
32+
-DCMAKE_CXX_STANDARD=17
3233
-DUSERVER_USE_LD=lld
3334
-DUSERVER_NO_WERROR=OFF
3435
-DUSERVER_BUILD_ALL_COMPONENTS=1
@@ -45,7 +46,7 @@ jobs:
4546
-DUSERVER_FORCE_DOWNLOAD_GRPC=1
4647
4748
steps:
48-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v5
4950
with:
5051
fetch-depth: 0
5152

.github/workflows/ci-conan.yml

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,67 +14,92 @@ env:
1414
jobs:
1515
build:
1616
runs-on: ${{ matrix.os }}
17-
name: ${{ matrix.os }}
17+
container: ${{ matrix.container }}
18+
name: "${{ matrix.os }} (container: ${{ matrix.container || 'GithubCI' }})"
1819
strategy:
1920
fail-fast: false
2021
matrix:
2122
include:
2223
- os: ubuntu-22.04
2324
conanflags: ''
24-
- os: macos-latest
25+
tests-env: 'JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64'
26+
- os: ubuntu-22.04
27+
container: ubuntu:22.04
28+
conanflags: ''
29+
tests-env: 'JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64'
30+
- os: macos-14
2531
conanflags: '-o python_path=python3.11'
32+
tests-env: ''
2633

2734
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
35+
- name: Install sudo
36+
if: matrix.container == 'ubuntu:22.04'
37+
run: |
38+
DEBIAN_FRONTEND=noninteractive apt update
39+
DEBIAN_FRONTEND=noninteractive apt install -y sudo
3040
3141
- name: Install Ubuntu packages
3242
if: matrix.os == 'ubuntu-22.04'
3343
run: |
34-
sudo apt update
35-
sudo apt install -y \
36-
gcc g++ cmake wget git clang-format \
44+
sudo DEBIAN_FRONTEND=noninteractive apt update
45+
sudo DEBIAN_FRONTEND=noninteractive apt install -y \
46+
libpq-dev \
47+
gcc g++ cmake git clang-format \
3748
python3 python3-pip python3-venv
3849
39-
- name: Install test dependencies
40-
if: matrix.os == 'ubuntu-22.04'
41-
run: |
42-
wget -qO- https://pgp.mongodb.com/server-7.0.asc | sudo gpg --dearmor | sudo tee /usr/share/keyrings/mongodb-server-7.0.gpg >/dev/null
43-
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" \
44-
| sudo tee -a /etc/apt/sources.list.d/mongodb-org-7.0.list
45-
46-
sudo apt update
47-
sudo apt install -y postgresql redis mongodb-org mongodb-mongosh
48-
sudo ./scripts/kafka/ubuntu_install_kafka.sh
49-
./scripts/rabbitmq/ubuntu_install_rabbitmq_server.sh
50-
5150
- name: Install MacOS packages
52-
if: matrix.os == 'macos-latest'
51+
if: matrix.os == 'macos-14'
5352
run: |
5453
brew update
5554
brew tap mongodb/brew
5655
brew install clang-format postgresql redis kafka rabbitmq mongodb-community
5756
brew install [email protected]
5857
58+
- name: Checkout
59+
uses: actions/checkout@v5
60+
61+
- name: Change permissions
62+
if: matrix.container == 'ubuntu:22.04'
63+
run: |
64+
useradd -m -G sudo -s /bin/bash test-user
65+
chown -R test-user .
66+
5967
- name: Install common packages
6068
run: |
6169
pip install "conan==2.8.0"
6270
pip install numpy
63-
conan profile detect
64-
conan profile show
71+
${{ matrix.container && 'sudo -u test-user' }} conan profile detect
72+
${{ matrix.container && 'sudo -u test-user' }} conan profile show
6573
6674
- name: Run conan
6775
run: |
68-
conan create . --build=missing -s:a compiler.cppstd=17 -pr:b=default ${{matrix.conanflags}}
76+
${{ matrix.container && 'sudo -u test-user' }} git config --global --add safe.directory `pwd`
77+
${{ matrix.container && 'sudo -u test-user' }} conan create . --build=missing -s:a compiler.cppstd=17 -pr:b=default ${{matrix.conanflags}}
6978
70-
- name: Test userver conan package
79+
- name: Install test dependencies
80+
if: matrix.os == 'ubuntu-22.04'
7181
run: |
82+
sudo DEBIAN_FRONTEND=noninteractive apt install -y curl wget lsb-release
83+
84+
wget -qO- https://pgp.mongodb.com/server-7.0.asc | sudo gpg --dearmor | sudo tee /usr/share/keyrings/mongodb-server-7.0.gpg >/dev/null
85+
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" \
86+
| sudo tee -a /etc/apt/sources.list.d/mongodb-org-7.0.list
87+
88+
sudo DEBIAN_FRONTEND=noninteractive apt update
89+
sudo DEBIAN_FRONTEND=noninteractive apt install -y postgresql redis mongodb-org mongodb-mongosh locales
90+
${{ matrix.container && 'sudo locale-gen en_US.UTF-8' }}
91+
${{ matrix.container && 'update-locale LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"' }}
92+
sudo ./scripts/kafka/ubuntu_install_kafka.sh
93+
sudo ./scripts/rabbitmq/ubuntu_install_rabbitmq_server.sh
94+
95+
- name: Test userver conan package
96+
run: |-
7297
mv libraries/easy/samples/3_json samples/
7398
mv scripts/tests/conanfile.py samples/
7499
rm -rf userver/cmake/
75100
cd samples/
76101
77-
USERVER_VERSION=$(conan list -c -v quiet userver/* | tail -n 1)
102+
USERVER_VERSION=$(${{ matrix.container && 'sudo -u test-user' }} conan list -c -v quiet userver/* | tail -n 1)
78103
for SAMPLE in \
79104
3_json \
80105
chaotic_service \
@@ -85,12 +110,13 @@ jobs:
85110
https_service \
86111
postgres_service \
87112
redis_service \
88-
kafka_service \
113+
${{ matrix.container && ' ' || 'kafka_service' }} \
89114
rabbitmq_service \
90115
mongo_service \
91116
s3api \
92117
; do
93118
mv conanfile.py $SAMPLE/
94-
conan test $SAMPLE/ --build=never -s:a compiler.cppstd=17 -pr:b=default ${{matrix.conanflags}} ${USERVER_VERSION}
119+
echo "Run: ${{ matrix.container && 'sudo -u test-user' }} ${{matrix.tests-env}} conan test $SAMPLE/ --build=never -s:a compiler.cppstd=17 -pr:b=default ${{matrix.conanflags}} ${USERVER_VERSION}"
120+
${{ matrix.container && 'sudo -u test-user' }} ${{matrix.tests-env}} conan test $SAMPLE/ --build=never -s:a compiler.cppstd=17 -pr:b=default ${{matrix.conanflags}} ${USERVER_VERSION}
95121
mv $SAMPLE/conanfile.py ./
96122
done

0 commit comments

Comments
 (0)