diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index 081503322a03..38032b0e3176 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -95,23 +95,11 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: include: - - command: >- - /test.sh - -Dprotobuf_BUILD_CONFORMANCE=ON - -Dprotobuf_BUILD_EXAMPLES=ON - -DCMAKE_CXX_STANDARD=14 + - flags: -Dprotobuf_BUILD_EXAMPLES=ON - name: Ninja - command: >- - /test.sh - -G Ninja - -Dprotobuf_BUILD_CONFORMANCE=ON - -DCMAKE_CXX_STANDARD=14 + flags: -G Ninja - name: Shared - command: >- - /test.sh - -Dprotobuf_BUILD_CONFORMANCE=ON - -Dprotobuf_BUILD_SHARED_LIBS=ON - -DCMAKE_CXX_STANDARD=14 + flags: -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_EXAMPLES=ON name: Linux CMake ${{ matrix.name}} runs-on: ubuntu-latest @@ -119,7 +107,6 @@ jobs: - name: Checkout pending changes uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: - submodules: recursive ref: ${{ inputs.safe-checkout }} - name: Setup ccache @@ -130,9 +117,13 @@ jobs: - name: Run tests uses: ./.github/actions/docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e0eb6c69b7551d89f0dbdbe11906077a1d501229c28db39623b945e0c5d7029a + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:7058879cac0224e443043eae2de82c13a63a54dd31855dac020c5522aa573cd2 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - command: ${{ matrix.command }} ${{ env.CCACHE_CMAKE_FLAGS }} + command: >- + /test.sh ${{ matrix.flags}} ${{ env.CCACHE_CMAKE_FLAGS }} + -DCMAKE_CXX_STANDARD=14 -Dprotobuf_BUILD_TESTS=ON + -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package + linux-cmake-install: name: Linux CMake Install @@ -141,8 +132,8 @@ jobs: - name: Checkout pending changes uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: - submodules: recursive ref: ${{ inputs.safe-checkout }} + submodules: recursive - name: Setup ccache uses: ./.github/actions/ccache @@ -152,16 +143,69 @@ jobs: - name: Run tests uses: ./.github/actions/docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e0eb6c69b7551d89f0dbdbe11906077a1d501229c28db39623b945e0c5d7029a + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:7058879cac0224e443043eae2de82c13a63a54dd31855dac020c5522aa573cd2 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: >- - /install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }} \&\& + /install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }} -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package \&\& /test.sh ${{ env.CCACHE_CMAKE_FLAGS }} -Dprotobuf_REMOVE_INSTALLED_HEADERS=ON -Dprotobuf_BUILD_PROTOBUF_BINARIES=OFF -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=14 + -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package + + linux-cmake-examples: + name: Linux CMake Examples + runs-on: ubuntu-latest + steps: + - name: Checkout pending changes + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + ref: ${{ inputs.safe-checkout }} + + - name: Setup ccache + uses: ./.github/actions/ccache + with: + cache-prefix: linux-cmake-examples + + - name: Run tests + uses: ./.github/actions/docker + with: + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:7058879cac0224e443043eae2de82c13a63a54dd31855dac020c5522aa573cd2 + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + command: >- + /install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }} + -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package + -Dprotobuf_BUILD_EXAMPLES=OFF \&\& + cd examples \&\& + mkdir build \&\& + cmake -S . -B build -DCMAKE_CXX_STANDARD=14 \&\& + cmake --build build + + linux-cmake-submodules: + name: Linux CMake Submodules + runs-on: ubuntu-latest + steps: + - name: Checkout pending changes + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + ref: ${{ inputs.safe-checkout }} + submodules: recursive + + - name: Setup ccache + uses: protocolbuffers/protobuf-ci/ccache@v1 + with: + cache-prefix: linux-cmake-${{ matrix.name }} + + - name: Run tests + uses: protocolbuffers/protobuf-ci/docker@v1 + with: + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e0eb6c69b7551d89f0dbdbe11906077a1d501229c28db39623b945e0c5d7029a + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + command: >- + /test.sh ${{ env.CCACHE_CMAKE_FLAGS }} + -Dprotobuf_BUILD_CONFORMANCE=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14 linux-cmake-32-bit: name: Linux CMake 32-bit @@ -170,16 +214,16 @@ jobs: - name: Checkout pending changes uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: - submodules: recursive ref: ${{ inputs.safe-checkout }} + submodules: recursive - name: Setup ccache - uses: ./.github/actions/ccache + uses: protocolbuffers/protobuf-ci/ccache@v1 with: cache-prefix: linux-cmake-32-bit - name: Run tests - uses: ./.github/actions/docker + uses: protocolbuffers/protobuf-ci/docker@v1 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/32bit@sha256:f99f051daa8b12f4ebad5927f389bc71372f771ab080290ab451cbaf1648f9ea platform: linux/386 @@ -260,8 +304,8 @@ jobs: - name: Checkout pending changes uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: - submodules: recursive ref: ${{ inputs.safe-checkout }} + submodules: recursive - name: Setup ccache uses: protocolbuffers/protobuf-ci/ccache@v1 diff --git a/cmake/gtest.cmake b/cmake/gtest.cmake index 5562380cae6a..b891db9fe3c7 100644 --- a/cmake/gtest.cmake +++ b/cmake/gtest.cmake @@ -1,7 +1,7 @@ option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF) if (protobuf_USE_EXTERNAL_GTEST) - find_package(GTest REQUIRED) + find_package(GTest REQUIRED CONFIG) else() if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt") message(FATAL_ERROR @@ -32,9 +32,9 @@ else() "GTEST_CREATE_SHARED_LIBRARY=1" ) - if (protobuf_INSTALL) - set(protobuf_INSTALL_TESTS ON) - endif() + endif() + if (protobuf_INSTALL) + set(protobuf_INSTALL_TESTS ON) endif() target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) diff --git a/cmake/protobuf-generate.cmake b/cmake/protobuf-generate.cmake index 5a4ff391e0ed..57e8cc9d1070 100644 --- a/cmake/protobuf-generate.cmake +++ b/cmake/protobuf-generate.cmake @@ -137,7 +137,7 @@ function(protobuf_generate) add_custom_command( OUTPUT ${_generated_srcs} - COMMAND ${protobuf_PROTOC_EXE} + COMMAND protobuf::protoc ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} ${protobuf_PROTOC_EXE} ${protobuf_generate_DEPENDENCIES} COMMENT ${_comment} diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 113629689c92..634bbba67fc4 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 2.8.12) # Project project(protobuf-examples) +find_package(GTest REQUIRED CONFIG) + # Find required protobuf package find_package(protobuf CONFIG REQUIRED) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 6141a50859d8..1bf8b9bece55 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -40,8 +40,8 @@ def protobuf_deps(): _github_archive( name = "com_google_absl", repo = "https://github.com/abseil/abseil-cpp", - commit = "b971ac5250ea8de900eae9f95e06548d14cd95fe", # Abseil LTS 20230125.2 - sha256 = "f7c2cb2c5accdcbbbd5c0c59f241a988c0b1da2a3b7134b823c0bd613b1a6880", + commit = "c2435f8342c2d0ed8101cb43adfd605fdc52dca2", # Abseil LTS 20230125.3 + sha256 = "ea1d31db00eb37e607bfda17ffac09064670ddf05da067944c4766f517876390", ) if not native.existing_rule("zlib"): diff --git a/third_party/abseil-cpp b/third_party/abseil-cpp index 78be63686ba7..c2435f8342c2 160000 --- a/third_party/abseil-cpp +++ b/third_party/abseil-cpp @@ -1 +1 @@ -Subproject commit 78be63686ba732b25052be15f8d6dee891c05749 +Subproject commit c2435f8342c2d0ed8101cb43adfd605fdc52dca2