Skip to content

build(deps): refactor CMake files for finding Protobuf #716

build(deps): refactor CMake files for finding Protobuf

build(deps): refactor CMake files for finding Protobuf #716

Workflow file for this run

# SPDX-License-Identifier: Apache-2.0
name: Build & Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Ubuntu
run: ./scripts/setup-ubuntu.sh
- name: Check License Header
uses: apache/skywalking-eyes/header@v0.4.0
- name: Formatting Cmake files
run: ./scripts/run-cmake-format.sh
- name: Formatting Clang files
run: ./scripts/run-clang-format.sh
- name: Checking formatting
run: git diff --exit-code
ubuntu-build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Ubuntu
run: ./scripts/setup-ubuntu.sh
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build/_deps
key: ${{ runner.os }}-cmake-deps
restore-keys: |
${{ runner.os }}-cmake-deps
- name: Set up ccache
uses: hendrikmuhs/ccache-action@1bbbcda0748b3e340dee71a314fa68ffcbd6df79 # v1.2.21
with:
key: ${{ runner.os }}
max-size: 500M
- name: Configure CMake
run: |
cmake --version
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TZ_LIB=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: |
cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure --timeout 30
windows-build-and-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build/_deps
key: ${{ runner.os }}-cmake-deps
restore-keys: |
${{ runner.os }}-cmake-deps
- name: Set up sccache
uses: hendrikmuhs/ccache-action@1bbbcda0748b3e340dee71a314fa68ffcbd6df79 # v1.2.21
with:
variant: sccache
key: ${{ runner.os }}
max-size: 500M
- name: Set up CMake
# We enable a compilation cache with `sccache`. This conflicts with the
# default way of creating debug symbols; we want to use the `Embedded`
# format, which works with caching. However, the corresponding flag is
# only used properly if CMP0141 is set to the `NEW` behavior.
# Furthermore, protobuf overwrites that policiy, but has a special
# mechanism to handle the debug format.
run: |
./scripts/find_vs.ps1
cmake --version
cmake -B build -G Ninja `
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW `
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
-Dprotobuf_ALLOW_CCACHE=ON `
-DCMAKE_BUILD_TYPE=Debug `
-DBUILD_TZ_LIB=ON
- name: Build
run: |
./scripts/find_vs.ps1
cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure --timeout 30