Fix: Find protobuf config if possible #7750
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ubuntu | |
| 'on': | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| - feature/** | |
| env: | |
| JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64 | |
| UBSAN_OPTIONS: print_stacktrace=1 | |
| ASAN_OPTIONS: detect_odr_violation=2 | |
| CCACHE_DIR: /home/runner/.cache/ccache | |
| CCACHE_NOHASHDIR: true | |
| CPM_SOURCE_CACHE: /home/runner/.cache/CPM | |
| REDIS_SLEEP_WORKAROUND_SECONDS: 60 | |
| jobs: | |
| posix: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - cmake-flags: >- | |
| -GNinja | |
| -DCMAKE_CXX_COMPILER=clang++-18 | |
| -DCMAKE_C_COMPILER=clang-18 | |
| -DCMAKE_BUILD_TYPE=Debug | |
| -DCMAKE_CXX_STANDARD=17 | |
| -DUSERVER_SANITIZE="ub addr" | |
| -DUSERVER_NO_WERROR=0 | |
| -DUSERVER_BUILD_ALL_COMPONENTS=1 | |
| -DUSERVER_BUILD_SAMPLES=1 | |
| -DUSERVER_BUILD_TESTS=1 | |
| -DUSERVER_NAMESPACE=userver_ns | |
| -DUSERVER_NAMESPACE_BEGIN="namespace userver_ns { inline namespace | |
| v1 {" | |
| -DUSERVER_NAMESPACE_END="}}" | |
| os: ubuntu-24.04 | |
| info: clang-18 + debug + sanitize addr+ub | |
| id: ubuntu24_clang18_debug_sanitize-addr-ub | |
| tests-flags: '' | |
| tests-env: '' | |
| - cmake-flags: >- | |
| -GNinja | |
| -DCMAKE_CXX_COMPILER=g++-13 | |
| -DCMAKE_C_COMPILER=gcc-13 | |
| -DCMAKE_BUILD_TYPE=Release | |
| -DCMAKE_CXX_STANDARD=17 | |
| -DUSERVER_SANITIZE="" | |
| -DUSERVER_NO_WERROR=1 | |
| -DUSERVER_BUILD_ALL_COMPONENTS=1 | |
| -DUSERVER_BUILD_SAMPLES=1 | |
| -DUSERVER_BUILD_TESTS=1 | |
| os: ubuntu-24.04 | |
| info: gcc-13 + release | |
| id: ubuntu24_gcc13_release | |
| tests-flags: '--gtest_filter=-StackUsageMonitorTest.BacktraceLogging' | |
| tests-env: '' | |
| - cmake-flags: >- | |
| -GNinja | |
| -DCMAKE_CXX_COMPILER=clang++-14 | |
| -DCMAKE_C_COMPILER=clang-14 | |
| -DCMAKE_BUILD_TYPE=Debug | |
| -DCMAKE_CXX_STANDARD=17 | |
| -DUSERVER_SANITIZE="ub addr" | |
| -DUSERVER_NO_WERROR=0 | |
| -DUSERVER_BUILD_ALL_COMPONENTS=1 | |
| -DUSERVER_BUILD_SAMPLES=1 | |
| -DUSERVER_BUILD_TESTS=1 | |
| -DUSERVER_NAMESPACE=userver_ns | |
| -DUSERVER_NAMESPACE_BEGIN="namespace userver_ns { inline namespace | |
| v1 {" | |
| -DUSERVER_NAMESPACE_END="}}" | |
| os: ubuntu-22.04 | |
| info: clang-14 + debug + sanitize addr+ub | |
| id: ubuntu22_clang14_debug_sanitize-addr-ub | |
| tests-flags: '' | |
| tests-env: '' | |
| # GCC-10 - testing minimal required compiler | |
| - cmake-flags: >- | |
| -GNinja | |
| -DCMAKE_CXX_COMPILER=g++-10 | |
| -DCMAKE_C_COMPILER=gcc-10 | |
| -DCMAKE_BUILD_TYPE=Release | |
| -DCMAKE_CXX_STANDARD=17 | |
| -DUSERVER_USE_LD=gold | |
| -DUSERVER_BUILD_ALL_COMPONENTS=1 | |
| -DUSERVER_BUILD_SAMPLES=1 | |
| -DUSERVER_BUILD_TESTS=1 | |
| -DUSERVER_NO_WERROR=1 | |
| os: ubuntu-22.04 | |
| info: g++-10 + release | |
| id: ubuntu22_gcc10_release | |
| tests-flags: '--gtest_filter=-StackUsageMonitorTest.BacktraceLogging' | |
| tests-env: '' | |
| name: '${{matrix.os}}: ${{matrix.info}}' | |
| runs-on: ${{matrix.os}} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Restore cached directories | |
| id: restore-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{env.CCACHE_DIR}} | |
| ${{env.CPM_SOURCE_CACHE}} | |
| key: 'ubuntu-cache-dir ${{matrix.id}} ${{github.ref}} run-${{github.run_number}}' | |
| restore-keys: | | |
| ubuntu-cache-dir ${{matrix.id}} ${{github.ref}} | |
| ubuntu-cache-dir ${{matrix.id}} | |
| - name: Setup ramdrive for testsuites | |
| run: | | |
| sudo mkdir -p "/mnt/ramdisk/$USER" | |
| sudo chmod 777 "/mnt/ramdisk/$USER" | |
| sudo mount -t tmpfs -o size=2048M tmpfs "/mnt/ramdisk/$USER" | |
| - name: Free disk space | |
| run: ./scripts/githubci_free_space.sh | |
| - name: Add confluentinc repositories | |
| if: matrix.os != 'ubuntu-24.04' | |
| run: | | |
| # Adding librdkafka confluent repositories as in https://docs.confluent.io/platform/current/installation/installing_cp/deb-ubuntu.html#get-the-software | |
| gpg_retrieve_keyserver() { | |
| GNUPGHOME=$(mktemp -d) | |
| GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring --keyring "/usr/share/keyrings/$2.gpg" --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $1 | |
| rm -rf "$GNUPGHOME" | |
| chmod a+r "/usr/share/keyrings/$2.gpg" | |
| } | |
| gpg_retrieve_keyserver 8B1DA6120C2BF624 confluent | |
| printf "\ | |
| deb [arch=amd64 signed-by=/usr/share/keyrings/confluent.gpg] https://packages.confluent.io/deb/7.6 stable main\n\ | |
| deb [signed-by=/usr/share/keyrings/confluent.gpg] https://packages.confluent.io/clients/deb $(lsb_release -cs) main\n" \ | |
| | sudo tee /etc/apt/sources.list.d/confluent.list | |
| - name: Add missing repositories | |
| run: | | |
| sudo apt update | |
| # Instructions from https://clickhouse.com/docs/en/getting-started/install/ | |
| sudo apt install -y apt-transport-https ca-certificates dirmngr | |
| curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | sudo gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg arch=amd64] https://packages.clickhouse.com/deb stable main" | sudo tee /etc/apt/sources.list.d/clickhouse.list | |
| # Adding mariadb repositories (from https://www.linuxcapable.com/how-to-install-mariadb-on-ubuntu-linux/ ) | |
| curl -fsSL https://mariadb.org/mariadb_release_signing_key.pgp | sudo gpg --dearmor -o "/usr/share/keyrings/mariadb.gpg" | |
| sudo chmod a+r "/usr/share/keyrings/mariadb.gpg" | |
| # Restore the correct URL after https://jira.mariadb.org/browse/MDBF-651 | |
| #echo "deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/mariadb.gpg] https://deb.mariadb.org/10.11/ubuntu $(lsb_release -cs) main" \ | |
| # | tee /etc/apt/sources.list.d/mariadb.list | |
| echo "deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/mariadb.gpg] https://mirror.kumi.systems/mariadb/repo/10.11/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/mariadb.list | |
| # Adding mongodb repositories | |
| 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 | |
| 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" \ | |
| | sudo tee -a /etc/apt/sources.list.d/mongodb-org-7.0.list | |
| # Mongo is not officially supported on Ubuntu 24.04, so install it from jammy | |
| - name: Install common deps | |
| run: | | |
| sudo apt update | |
| sudo apt purge -y libpq5 libpq-dev postgresql-* | |
| sudo apt install --allow-downgrades -y clickhouse-common-static redis-server postgresql $(cat scripts/docs/en/deps/${{matrix.os}}.md | tr '\n' ' ') | |
| - name: Setup ccache | |
| run: | | |
| ccache -M 2.0GB | |
| ccache -s -v | |
| - name: Install Kafka | |
| run: | | |
| sudo ./scripts/kafka/ubuntu_install_kafka.sh | |
| - name: Install RabbitMQ packages | |
| run: | | |
| ./scripts/rabbitmq/ubuntu_install_rabbitmq_server.sh | |
| - name: Install gdb and pytest | |
| run: | | |
| sudo apt install -y gdb python3-pytest | |
| - name: Run cmake | |
| run: | | |
| cmake -S . -B build_debug ${{matrix.cmake-flags}} | |
| - name: Reconfigure cmake | |
| run: | | |
| cmake -S . -B build_debug ${{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 '/pq-extra/' -e '/tools/' -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 | |
| cmake --build . -j $(nproc) | |
| - name: Save cached directories | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{env.CCACHE_DIR}} | |
| ${{env.CPM_SOURCE_CACHE}} | |
| key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
| - name: Show cache stats | |
| run: | | |
| du -h -d 1 ${{env.CCACHE_DIR}} | |
| du -h -d 1 ${{env.CPM_SOURCE_CACHE}} | |
| ccache -s -v | |
| - name: Run tests (universal) | |
| run: | | |
| echo "UBSAN_OPTIONS=${UBSAN_OPTIONS} ASAN_OPTIONS=${ASAN_OPTIONS}" | |
| cd build_debug | |
| ./universal/userver-universal-unittest ${{matrix.tests-flags}} | |
| - name: Run tests (libraries) | |
| run: | | |
| cd build_debug | |
| mkdir libraries || : | |
| cd libraries | |
| ctest -V | |
| - name: Run tests (core) | |
| run: | | |
| cd build_debug | |
| ./core/userver-core-unittest ${{matrix.tests-flags}} | |
| - name: Run tests (kafka) | |
| run: | | |
| cd build_debug | |
| mkdir kafka || : | |
| cd kafka | |
| ctest -V | |
| - name: Run tests (clickhouse) | |
| run: | | |
| cd build_debug | |
| mkdir clickhouse || : | |
| cd clickhouse | |
| ctest -V | |
| - name: Run tests (rabbitmq) | |
| run: | | |
| cd build_debug | |
| mkdir rabbitmq || : | |
| cd rabbitmq | |
| ctest -V | |
| - name: Run tests (postgresql) | |
| run: | | |
| cd build_debug | |
| mkdir postgresql || : | |
| cd postgresql | |
| ${{matrix.tests-env}} ctest -V | |
| - name: Run tests (redis) | |
| run: | | |
| cd build_debug/redis/ | |
| ctest -V | |
| - name: Run tests (mongo) | |
| run: | | |
| sudo apt install -y mongodb-mongosh | |
| cd build_debug | |
| mkdir mongo || : | |
| cd 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) | |
| if: matrix.os != 'ubuntu-24.04' | |
| run: | | |
| cd build_debug | |
| mkdir grpc || : | |
| cd grpc | |
| ulimit -n 4096 && ctest -V | |
| - name: Run tests (mysql) | |
| # MySQL benchmarks do not work on new Ubuntu | |
| if: matrix.os != 'ubuntu-24.04' | |
| run: | | |
| sudo apt install -y mariadb-server | |
| cd build_debug | |
| mkdir mysql || : | |
| cd mysql | |
| ctest -V | |
| - name: Run tests (gdb) | |
| run: | | |
| cd build_debug/scripts/gdb/tests | |
| ctest -V | |
| - name: Run tests (sqlite) | |
| run: | | |
| cd build_debug/sqlite | |
| ctest -V |