|
|
|
name: C++ Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
safe-checkout:
|
|
|
|
required: true
|
|
|
|
description: "The SHA key for the commit we want to run over"
|
|
|
|
type: string
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linux:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # Don't cancel all jobs if one fails.
|
|
|
|
matrix:
|
|
|
|
config:
|
|
|
|
- { name: Optimized, flags: --config=opt }
|
|
|
|
- { name: Debug, flags: --config=dbg }
|
|
|
|
- { name: ASAN, flags: --config=asan }
|
|
|
|
- { name: MSAN, flags: --config=kokoro-msan }
|
|
|
|
- { name: TSAN, flags: --config=tsan }
|
|
|
|
- { name: UBSAN, flags: --config=ubsan }
|
|
|
|
- { name: No-RTTI, flags: --cxxopt=-fno-rtti }
|
|
|
|
include:
|
|
|
|
# Set defaults
|
|
|
|
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:dbd2f15fb69734d72c3fd10cb819bbe2ce4890acf49e9a2f9403983fe48e8807
|
|
|
|
- targets: //pkg/... //src/... @com_google_protobuf_examples//...
|
|
|
|
|
|
|
|
# Override cases with custom images
|
|
|
|
- config: { name: "TCMalloc" }
|
|
|
|
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:9d975616c3fd44d5a091aeb60ee94f37e22fb367d471d258fc18cb4a2387c943"
|
|
|
|
targets: "//src/..."
|
|
|
|
- config: { name: "aarch64" }
|
|
|
|
targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test"
|
|
|
|
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-e863f8ec6b1dfe41f7dc573bac9c8072a0a68b1b"
|
|
|
|
- config: { name: "Bazel4" }
|
|
|
|
targets: "//src/..."
|
|
|
|
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:4.2.3-3b71de326b62f67bf754c4dc4016d6a2fa9dd664"
|
|
|
|
name: Linux ${{ matrix.config.name }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
- name: Run tests
|
|
|
|
uses: ./.github/actions/bazel-docker
|
|
|
|
with:
|
|
|
|
image: ${{ matrix.image }}
|
|
|
|
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
|
|
|
bazel-cache: cpp_linux/${{ matrix.config.name }}
|
|
|
|
bazel: test ${{ matrix.targets }} ${{ matrix.config.flags }} --distinct_host_configuration=false
|
|
|
|
|
|
|
|
linux-cmake:
|
|
|
|
strategy:
|
|
|
|
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
|
|
|
|
- name: Ninja
|
|
|
|
command: >-
|
|
|
|
/test.sh
|
|
|
|
-G Ninja
|
|
|
|
-Dprotobuf_BUILD_CONFORMANCE=ON
|
|
|
|
-DCMAKE_CXX_STANDARD=14
|
|
|
|
- name: Shared
|
|
|
|
command: >-
|
|
|
|
/test.sh
|
|
|
|
-Dprotobuf_BUILD_CONFORMANCE=ON
|
|
|
|
-Dprotobuf_BUILD_SHARED_LIBS=ON
|
|
|
|
-DCMAKE_CXX_STANDARD=14
|
|
|
|
|
|
|
|
name: Linux CMake ${{ matrix.name}}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
|
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/ccache
|
|
|
|
with:
|
|
|
|
cache-prefix: linux-cmake-${{ matrix.name }}
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e8282f42b1c1c0e6227d746e861954fd6fad0bd2e7424e6ceb23c249289a4016
|
|
|
|
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:
|
|
|
|
submodules: recursive
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
|
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/ccache
|
|
|
|
with:
|
|
|
|
cache-prefix: linux-cmake-install
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e8282f42b1c1c0e6227d746e861954fd6fad0bd2e7424e6ceb23c249289a4016
|
|
|
|
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
|
|
|
|
|
|
|
|
linux-cmake-32-bit:
|
|
|
|
name: Linux CMake 32-bit
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
|
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/ccache
|
|
|
|
with:
|
|
|
|
cache-prefix: linux-cmake-32-bit
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/32bit@sha256:f99f051daa8b12f4ebad5927f389bc71372f771ab080290ab451cbaf1648f9ea
|
|
|
|
platform: linux/386
|
|
|
|
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
|
|
|
command: >-
|
|
|
|
/bin/bash -c '
|
|
|
|
cd /workspace;
|
|
|
|
ccache -z;
|
|
|
|
cmake . -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }};
|
|
|
|
cmake --build . --parallel 20;
|
|
|
|
ctest --verbose --parallel 20;
|
|
|
|
ccache -s'
|
|
|
|
|
|
|
|
non-linux:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # Don't cancel all jobs if one fails.
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: MacOS
|
|
|
|
os: macos-12
|
|
|
|
bazel: //src/...
|
|
|
|
- name: Windows
|
|
|
|
os: windows-2019
|
|
|
|
bazel: //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance
|
|
|
|
name: ${{ matrix.name }} Bazel
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
- name: Run tests
|
|
|
|
uses: ./.github/actions/bazel
|
|
|
|
with:
|
|
|
|
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
|
|
|
bazel: test ${{ matrix.bazel }}
|
|
|
|
bazel-cache: cpp_${{ matrix.os }}
|
|
|
|
|
|
|
|
macos-cmake:
|
|
|
|
name: MacOS CMake
|
|
|
|
runs-on: macos-12
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
|
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/ccache
|
|
|
|
with:
|
|
|
|
cache-prefix: macos-cmake
|
|
|
|
|
|
|
|
- name: Configure CMake
|
|
|
|
uses: ./.github/actions/bash
|
|
|
|
with:
|
|
|
|
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
|
|
|
command: cmake . -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }}
|
|
|
|
- name: Build
|
|
|
|
run: cmake --build . --parallel 8
|
|
|
|
- name: Test
|
|
|
|
run: ctest --verbose -C Debug
|
|
|
|
|
|
|
|
- name: Report ccache stats
|
|
|
|
shell: bash
|
|
|
|
run: ccache -s -v
|
|
|
|
|
|
|
|
windows-cmake:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false # Don't cancel all jobs if one fails.
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: Visual Studio
|
|
|
|
flags: >-
|
|
|
|
-Dprotobuf_BUILD_SHARED_LIBS=OFF
|
|
|
|
-Dprotobuf_BUILD_EXAMPLES=ON
|
|
|
|
- name: Shared
|
|
|
|
flags: -Dprotobuf_BUILD_SHARED_LIBS=ON
|
|
|
|
|
|
|
|
name: Windows CMake ${{ matrix.name}}
|
|
|
|
runs-on: windows-2019
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
|
|
|
|
- name: Setup MSVC
|
|
|
|
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
|
|
|
|
with:
|
|
|
|
arch: x64
|
|
|
|
vsversion: '2019'
|
|
|
|
|
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/ccache
|
|
|
|
with:
|
|
|
|
cache-prefix: windows-cmake-${{ matrix.name }}
|
|
|
|
|
|
|
|
- name: Configure CMake
|
|
|
|
uses: ./.github/actions/bash
|
|
|
|
with:
|
|
|
|
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
|
|
|
command: |
|
|
|
|
cmake . -G "Visual Studio 16 2019" -A x64 \
|
|
|
|
${{ env.CCACHE_CMAKE_FLAGS }} \
|
|
|
|
-Dprotobuf_BUILD_CONFORMANCE=OFF \
|
|
|
|
-Dprotobuf_WITH_ZLIB=OFF \
|
|
|
|
${{ matrix.flags }}
|
|
|
|
|
|
|
|
- name: Build for Windows 15 2017
|
|
|
|
run: >-
|
|
|
|
msbuild.exe protobuf.sln /p:MultiProcessorCompilation=true /p:CL_MPCount=8 /maxcpucount:8 /p:BuildInParallel=true
|
|
|
|
/p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=15.0
|
|
|
|
${{ env.CCACHE_MSBUILD_FLAGS }}
|
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
run: ctest --verbose -C Debug
|
|
|
|
|
|
|
|
- name: Report ccache stats
|
|
|
|
run: ${{ github.workspace }}\ccache.exe -s -v
|
|
|
|
|
|
|
|
windows-cmake-install:
|
|
|
|
name: Windows CMake Install
|
|
|
|
runs-on: windows-2019
|
|
|
|
steps:
|
|
|
|
- name: Checkout pending changes
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
ref: ${{ inputs.safe-checkout }}
|
|
|
|
|
|
|
|
- name: Setup MSVC
|
|
|
|
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
|
|
|
|
with:
|
|
|
|
arch: x64
|
|
|
|
vsversion: '2019'
|
|
|
|
|
|
|
|
- name: Setup ccache
|
|
|
|
uses: ./.github/actions/ccache
|
|
|
|
with:
|
|
|
|
cache-prefix: windows-cmake
|
|
|
|
|
|
|
|
- name: Configure CMake for Install
|
|
|
|
uses: ./.github/actions/bash
|
|
|
|
with:
|
|
|
|
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
|
|
|
command: |
|
|
|
|
mkdir build
|
|
|
|
pushd build
|
|
|
|
cmake .. -G "Visual Studio 16 2019" -A x64 \
|
|
|
|
${{ env.CCACHE_CMAKE_FLAGS }} \
|
|
|
|
-Dprotobuf_BUILD_CONFORMANCE=OFF \
|
|
|
|
-Dprotobuf_WITH_ZLIB=OFF
|
|
|
|
popd
|
|
|
|
|
|
|
|
- name: Build and Install Protobuf for Windows 15 2017
|
|
|
|
run: |
|
|
|
|
pushd build
|
|
|
|
msbuild.exe INSTALL.vcxproj /p:Platform=x64 /p:VisualStudioVersion=15.0 /p:MultiProcessorCompilation=true /p:CL_MPCount=8 /maxcpucount:8 /p:BuildInParallel=true ${{ env.CCACHE_MSBUILD_FLAGS }}
|
|
|
|
popd
|
|
|
|
|
|
|
|
- name: Clear CMake cache
|
|
|
|
shell: bash
|
|
|
|
run: rm -rf build/*
|
|
|
|
|
|
|
|
- name: Configure CMake
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cmake . -G "Visual Studio 16 2019" -A x64 \
|
|
|
|
${{ env.CCACHE_CMAKE_FLAGS }} \
|
|
|
|
-Dprotobuf_REMOVE_INSTALLED_HEADERS=ON \
|
|
|
|
-Dprotobuf_BUILD_PROTOBUF_BINARIES=OFF \
|
|
|
|
-Dprotobuf_BUILD_CONFORMANCE=OFF \
|
|
|
|
-Dprotobuf_WITH_ZLIB=OFF
|
|
|
|
|
|
|
|
- name: Build for Windows 15 2017
|
|
|
|
run: >-
|
|
|
|
msbuild.exe protobuf.sln /p:MultiProcessorCompilation=true /p:CL_MPCount=8 /maxcpucount:8 /p:BuildInParallel=true
|
|
|
|
/p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=15.0
|
|
|
|
${{ env.CCACHE_MSBUILD_FLAGS }}
|
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
run: ctest --verbose -C Debug
|
|
|
|
|
|
|
|
- name: Report ccache stats
|
|
|
|
run: ${{ github.workspace }}\ccache.exe -s -v
|