Define a new set of cmake tests.

These more closely follow the standard practices of our users, where dependencies are pre-installed instead of using our provided sub-modules.  This will prevent issues such as #12201 from reoccuring.

Additionally, this cl bumps our Abseil dependency to the latest release, and fixes a GTest issue that went previously unnoticed.

PiperOrigin-RevId: 529490402
pull/12669/head
Mike Kruskal 2023-05-04 12:57:03 -07:00 committed by Copybara-Service
parent e89b2f5251
commit 7714d57c91
3 changed files with 93 additions and 90 deletions

View File

@ -94,23 +94,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
@ -120,53 +108,103 @@ jobs:
with:
ref: ${{ inputs.safe-checkout }}
# Initialize/update the submodule from remote to validate a new fetch based on .gitmodules
# We have to do this separately since actions/checkout doesn't support the "--remote" flag
- name: Update submodules
run: git submodule update --init --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:7058879cac0224e443043eae2de82c13a63a54dd31855dac020c5522aa573cd2
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
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
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-install
- name: Run tests
uses: protocolbuffers/protobuf-ci/docker@v1
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 \&\&
/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: protocolbuffers/protobuf-ci/ccache@v1
with:
cache-prefix: linux-cmake-examples
- name: Run tests
uses: protocolbuffers/protobuf-ci/docker@v1
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: ${{ matrix.command }} ${{ env.CCACHE_CMAKE_FLAGS }}
linux-cmake-install:
name: Linux CMake Install
runs-on: ubuntu-latest
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Update submodules
run: git submodule update --init --recursive
- name: Setup ccache
uses: protocolbuffers/protobuf-ci/ccache@v1
with:
cache-prefix: linux-cmake-install
- 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: >-
/install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }} \&\&
/test.sh
${{ env.CCACHE_CMAKE_FLAGS }}
-Dprotobuf_REMOVE_INSTALLED_HEADERS=ON
-Dprotobuf_BUILD_PROTOBUF_BINARIES=OFF
-Dprotobuf_BUILD_CONFORMANCE=ON
-DCMAKE_CXX_STANDARD=14
/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
@ -176,9 +214,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Update submodules
run: git submodule update --init --recursive
submodules: recursive
- name: Setup ccache
uses: protocolbuffers/protobuf-ci/ccache@v1
@ -200,37 +236,6 @@ jobs:
ctest --verbose --parallel 20;
ccache -s'
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 }}
submodules: recursive
- name: Setup ccache
uses: protocolbuffers/protobuf-ci/ccache@v1
with:
cache-prefix: linux-cmake-examples
- 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: >-
/install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }} \&\&
cd examples \&\&
mkdir build \&\&
cmake
${{ env.CCACHE_CMAKE_FLAGS }}
-Dprotobuf_BUILD_PROTOBUF_BINARIES=OFF
-DCMAKE_CXX_STANDARD=14
-S . -B build \&\&
cmake --build build
non-linux:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
@ -307,9 +312,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Update submodules
run: git submodule update --init --recursive
submodules: recursive
- name: Setup ccache
uses: protocolbuffers/protobuf-ci/ccache@v1

View File

@ -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

View File

@ -42,8 +42,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"):