Skip to content

feat logging: extract LogHelper and log macros to 'shared' #1893

feat logging: extract LogHelper and log macros to 'shared'

feat logging: extract LogHelper and log macros to 'shared' #1893

Workflow file for this run

name: CI
'on':
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
ASAN_OPTIONS: detect_odr_violation=2
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- cmake-flags: >-
-DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_C_COMPILER=clang-14
-DUSERVER_FEATURE_MYSQL=1
-DUSERVER_SANITIZE="ub addr"
-DCMAKE_BUILD_TYPE=Debug
-DUSERVER_NAMESPACE=userver_ns
-DUSERVER_NAMESPACE_BEGIN="namespace userver_ns { inline namespace
v1 {"
-DUSERVER_NAMESPACE_END="}}"
-DUSERVER_PG_SERVER_INCLUDE_DIR=/usr/include/postgresql/15/server
-DUSERVER_PG_SERVER_LIBRARY_DIR=/usr/lib/postgresql/15/lib
os: ubuntu-22.04
info: clang-14 + debug + sanitize addr+ub
tests-flags: ''
- cmake-flags: >-
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 -DUSERVER_FEATURE_REDIS_HI_MALLOC=1
-DUSERVER_NO_WERROR=1 -DUSERVER_SANITIZE="ub addr" -DCMAKE_BUILD_TYPE=Debug
os: ubuntu-20.04
info: g++-9 + debug + sanitize addr+ub
tests-flags: '--gtest_filter=-HttpClient.Cancel*:HttpClient.Retr*:HttpClient.RedirectHeaders'
- cmake-flags: >-
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 -DUSERVER_FEATURE_REDIS_HI_MALLOC=1
-DUSERVER_FEATURE_MYSQL=1
-DUSERVER_NO_WERROR=1 -DCMAKE_BUILD_TYPE=Release
os: ubuntu-20.04
info: g++-9 + release
tests-flags: '--gtest_filter=-HttpClient.RedirectHeaders'
# GCC-8 - testing minimal required compiler
- cmake-flags: >-
-DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_C_COMPILER=gcc-8
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 -DUSERVER_FEATURE_REDIS_HI_MALLOC=1
-DUSERVER_FEATURE_MYSQL=1
-DUSERVER_NO_WERROR=1 -DCMAKE_BUILD_TYPE=Debug
os: ubuntu-20.04
info: g++-8 + debug
tests-flags: '--gtest_filter=-HttpClient.RedirectHeaders'
name: '${{matrix.os}}: ${{matrix.info}}'
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Reuse ccache directory
uses: actions/cache@v2
with:
path: ~/.ccache
key: '${{matrix.os}} ${{matrix.info}} ccache-dir ${{github.ref}} run-${{github.run_number}}'
restore-keys: |
${{matrix.os}} ${{matrix.info}} ccache-dir ${{github.ref}} run-'
${{matrix.os}} ${{matrix.info}} ccache-
- name: Free disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/lib/php* /opt/ghc || true
df -h
- name: Install packages
run: |
# Instructions from https://clickhouse.com/docs/en/getting-started/install/
sudo apt-get install -y apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754
echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
sudo ./mariadb_repo_setup
sudo apt update
sudo apt install --allow-downgrades -y clickhouse-common-static libmariadb-dev $(cat scripts/docs/en/deps/${{matrix.os}}.md | tr '\n' ' ')
if [ "${{matrix.os}}" = "ubuntu-22.04" ]; then
# GH Ubuntu image has libpq version 15+ from pg's repo that is API incompatible with postgresql-14.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7FCC7D46ACCC4CF8
echo "deb https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt install -y postgresql-15 postgresql-client-15 postgresql-server-dev-15
fi
if [ "${{matrix.info}}" = "g++-8 + debug" ]; then
sudo apt install --allow-downgrades -y g++-8
fi
- name: Install RabbitMQ packages
run: |
./scripts/rabbitmq/ubuntu_install_rabbitmq_server.sh
- name: Setup ccache
run: |
ccache -M 2.0GB
ccache -s
- name: Run cmake
run: |
mkdir build_debug
cd build_debug
cmake ${{matrix.cmake-flags}} ..
- name: Run clang-tidy
if: matrix.info == 'clang-14 + debug + sanitize addr+ub'
run: |
[[ -z "${GITHUB_BASE_REF}" ]] && BRANCH_VAR=HEAD~1 || BRANCH_VAR=origin/${GITHUB_BASE_REF}
echo "${BRANCH_VAR}"
echo "$(git diff --name-only ${BRANCH_VAR})"
EXCLUDE_PATTERNS="-e '.pb.cc' -e '.pb.cpp' -e 'benchmark.cpp' -e '/boost_stacktrace/' -e '/pq-extra/' -e '/tools/' -e '/uboost_coro/' -e 'third_party' "
LIST_CHECK_FILES=$(git diff --name-only ${BRANCH_VAR} | grep --color=never '.cpp' | grep -v ${EXCLUDE_PATTERNS} | tr '\n' ' ')
if [[ -n ${LIST_CHECK_FILES} ]]
then
sudo apt install -y clang-tidy-14
curl -o tools/run-clang-tidy https://raw.githubusercontent.com/llvm-mirror/clang-tools-extra/release_90/clang-tidy/tool/run-clang-tidy.py
python3 ./tools/run-clang-tidy -clang-tidy-binary clang-tidy-14 -p build_debug -q -j$(nproc) ${LIST_CHECK_FILES}
else
echo "Nothing check in clang-tidy"
fi
- name: Compile
run: |
pwd
cd build_debug
make -j$(nproc)
- name: Run tests (universal)
run: |
echo "UBSAN_OPTIONS=${UBSAN_OPTIONS} ASAN_OPTIONS=${ASAN_OPTIONS}"
cd build_debug
./userver/universal/userver-universal_unittest ${{matrix.tests-flags}}
- name: Run tests (core)
run: |
cd build_debug
./userver/core/userver-core_unittest ${{matrix.tests-flags}}
- name: Run tests (clickhouse)
run: |
cd build_debug
mkdir userver/clickhouse || :
cd userver/clickhouse
ctest -V
- name: Run tests (rabbitmq)
run: |
cd build_debug
mkdir userver/rabbitmq || :
cd userver/rabbitmq
ctest -V
- name: Run tests (mysql)
run: |
sudo apt install mariadb-server
cd build_debug
mkdir userver/mysql || :
cd userver/mysql
ctest -V
- name: Run tests (postgresql)
run: |
cd build_debug
mkdir userver/postgresql || :
cd userver/postgresql
ctest -V
- name: Run tests (redis)
run: |
cd build_debug/userver/redis/
ctest -V
- name: Run tests (mongo)
# libbson unnecessarily overaligns structures and GCC-9 does not support overaligned new
if: matrix.info != 'g++-9 + debug + sanitize addr+ub'
run: |
cd build_debug
mkdir userver/mongo || :
cd userver/mongo
if [ -f ./userver-mongo_unittest ]; then ./userver-mongo_unittest ; fi
# Mongo is not available on Ubuntu 22.04 from default repos
if [ "${{matrix.os}}" != "ubuntu-22.04" ]; then ctest -V -R userver-mongo_mongotest ; fi
- name: Run tests (gRPC)
# TODO: Sanitizer detects bool with value other than 1 or 0
if: matrix.info != 'clang-14 + debug + sanitize addr+ub'
run: |
cd build_debug
mkdir userver/grpc || :
cd userver/grpc
ctest -V