mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2025-01-14 09:17:55 +08:00
9bdd24f975
This job builds abseil-cpp and protobuf from source using Cmake and tries to build protobuf-c against those dependencies using Cmake. The "latest" build dependencies are being targeted, currently Ubuntu 22.04, abseil-cpp from the lts_2024_01_16 branch, protobuf from the 27.x branch. Update as newer versions become available. This uses Cmake's Ninja generator which should be equivalent to the legacy makefiles that it generates. The Cmake Ninja generator is useful primarily because it automatically compiles using the maximum amount of concurrency and it actually shows you the command that failed by default.
250 lines
8.8 KiB
YAML
250 lines
8.8 KiB
YAML
name: Test Build
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- next
|
|
pull_request:
|
|
schedule:
|
|
- cron: '0 0 * * 0' # Every Sunday at 00:00
|
|
jobs:
|
|
distcheck:
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest, ubuntu-20.04]
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install Linux dependencies
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev
|
|
- name: Install Mac dependencies
|
|
if: startsWith(matrix.os, 'macos')
|
|
run: brew install protobuf automake
|
|
- name: Run distcheck
|
|
run: |
|
|
./autogen.sh
|
|
./configure
|
|
make -j${nproc} distcheck VERBOSE=1
|
|
|
|
distcheck-multiarch:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: armv7
|
|
- arch: aarch64
|
|
- arch: s390x
|
|
- arch: ppc64le
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: uraimo/run-on-arch-action@v2.0.9
|
|
name: Install dependencies and run distcheck
|
|
id: runcmd
|
|
with:
|
|
arch: ${{ matrix.arch }}
|
|
githubToken: ${{ github.token }}
|
|
distro: ubuntu20.04
|
|
install: |
|
|
apt-get update -q -y
|
|
apt-get install -q -y build-essential autoconf automake libtool pkg-config
|
|
apt-get install -q -y protobuf-compiler libprotobuf-dev libprotoc-dev
|
|
|
|
run: |
|
|
./autogen.sh
|
|
./configure
|
|
make -j3 distcheck VERBOSE=1
|
|
|
|
valgrind:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev valgrind
|
|
- name: Run distcheck with valgrind
|
|
run: |
|
|
./autogen.sh
|
|
./configure --enable-valgrind-tests CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined"
|
|
make -j${nproc} distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-valgrind-tests CFLAGS=\"-fsanitize=undefined -fno-sanitize-recover=undefined\"" VERBOSE=1
|
|
|
|
coverage:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev lcov
|
|
- name: Run coverage build
|
|
run: |
|
|
./autogen.sh
|
|
./configure --enable-code-coverage
|
|
make -j${nproc}
|
|
mkdir coverage
|
|
lcov --no-external --capture --initial --directory . --output-file ./coverage/lcov.info --include '*protobuf-c.c'
|
|
make check
|
|
lcov --no-external --capture --directory . --output-file ./coverage/lcov.info --include '*protobuf-c.c'
|
|
- uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
cmake:
|
|
strategy:
|
|
matrix:
|
|
build_type: [Debug, Release]
|
|
os: [macos-latest, ubuntu-20.04]
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install Linux dependencies
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y protobuf-compiler libprotobuf-dev libprotoc-dev
|
|
- name: Install Mac dependencies
|
|
if: startsWith(matrix.os, 'macos')
|
|
run: brew install protobuf abseil
|
|
- name: Run cmake tests
|
|
run: |
|
|
mkdir build-cmake/bin
|
|
cd build-cmake/bin
|
|
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=protobuf-c-bin ../
|
|
make -j3
|
|
make test
|
|
make install
|
|
|
|
cmake-linux-latest:
|
|
runs-on: ubuntu-22.04
|
|
|
|
env:
|
|
LDFLAGS: "-Wl,-rpath=/opt/protobuf-c/lib -Wl,--disable-new-dtags"
|
|
|
|
steps:
|
|
- name: Checkout protobuf-c
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Checkout abseil/abseil-cpp
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: abseil/abseil-cpp
|
|
ref: "lts_2024_01_16"
|
|
path: abseil-cpp
|
|
|
|
- name: Checkout protocolbuffers/protobuf
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: protocolbuffers/protobuf
|
|
ref: "27.x"
|
|
path: protobuf
|
|
|
|
- name: Install ninja
|
|
run: |
|
|
sudo pip install ninja
|
|
|
|
- name: Build abseil-cpp
|
|
working-directory: "./abseil-cpp"
|
|
run: |
|
|
cmake -B build -G Ninja \
|
|
--install-prefix /opt/protobuf-c \
|
|
-DCMAKE_CXX_STANDARD=17 \
|
|
-DABSL_PROPAGATE_CXX_STD=ON \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
;
|
|
ninja -C build
|
|
sudo ninja -C build install
|
|
|
|
- name: Build protobuf
|
|
working-directory: "./protobuf"
|
|
run: |
|
|
cmake -B build -G Ninja \
|
|
--install-prefix /opt/protobuf-c \
|
|
-DCMAKE_CXX_STANDARD=17 \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-Dprotobuf_ABSL_PROVIDER=package \
|
|
-Dprotobuf_BUILD_TESTS=OFF \
|
|
;
|
|
ninja -C build
|
|
sudo ninja -C build install
|
|
|
|
- name: Build protobuf-c
|
|
run: |
|
|
cd build-cmake
|
|
cmake -B build -G Ninja \
|
|
--install-prefix /opt/protobuf-c \
|
|
-DCMAKE_CXX_STANDARD=17 \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DBUILD_TESTS=ON \
|
|
;
|
|
ninja -C build
|
|
ninja -C build test
|
|
sudo ninja -C build install
|
|
|
|
cmake-msvc:
|
|
strategy:
|
|
matrix:
|
|
build-type: [Debug, Release]
|
|
shared-lib: [ON, OFF]
|
|
fail-fast: false
|
|
name: "MSVC CMake (${{ matrix.build-type }}, DLL: ${{ matrix.shared-lib }})"
|
|
runs-on: windows-latest
|
|
env:
|
|
PROTOBUF_VERSION: 24.3
|
|
ABSEIL_VERSION: "20230802.0"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
with:
|
|
arch: amd64
|
|
- uses: actions/cache@v2
|
|
id: protobuf-cache
|
|
with:
|
|
path: ~/protobuf-bin
|
|
key: ${{ env.PROTOBUF_VERSION }}-${{ matrix.shared-lib }}-${{ matrix.build-type}}
|
|
- uses: actions/cache@v2
|
|
id: abseil-cache
|
|
with:
|
|
path: ~/abseil-bin
|
|
key: ${{ env.ABSEIL_VERSION }}-${{ matrix.shared-lib }}-${{ matrix.build-type}}
|
|
- name: Build and install abseil
|
|
if: steps.abseil-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd ~
|
|
git clone --depth=1 https://github.com/abseil/abseil-cpp.git -b ${{ env.ABSEIL_VERSION }} abseil
|
|
cd ~/abseil && mkdir build && cd build
|
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=~/abseil-bin -DBUILD_SHARED_LIBS=${{ matrix.shared-lib }} -DABSL_PROPAGATE_CXX_STD=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded${{ matrix.build-type == 'Debug' && 'Debug' || '' }}${{ matrix.shared-lib == 'ON' && 'DLL' || '' }} -DCMAKE_CXX_STANDARD=17 ..
|
|
nmake
|
|
nmake install
|
|
- name: Build and install utf8 compression algorithm
|
|
if: matrix.shared-lib == 'OFF'
|
|
run: |
|
|
cd ~
|
|
git clone --depth=1 https://github.com/protocolbuffers/utf8_range.git utf8_range
|
|
cd ~/utf8_range && mkdir build && cd build
|
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=~/utf8_range-bin -DCMAKE_CXX_STANDARD=17 -Dutf8_range_ENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -Dabsl_ROOT=~/abseil-bin -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY='MultiThreaded${{ matrix.build-type == 'Debug' && 'Debug' || '' }}' ..
|
|
nmake
|
|
nmake install
|
|
- name: Build and install protobuf
|
|
if: steps.protobuf-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd ~
|
|
git clone --depth=1 https://github.com/protocolbuffers/protobuf.git -b v${{ env.PROTOBUF_VERSION }} protobuf
|
|
cd ~/protobuf && mkdir build && cd build
|
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=~/protobuf-bin -Dprotobuf_BUILD_SHARED_LIBS=${{ matrix.shared-lib }} -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_EXAMPLES=OFF -Dprotobuf_ABSL_PROVIDER=package -Dabsl_ROOT=~/abseil-bin -DABSL_PROPAGATE_CXX_STD=ON ..
|
|
nmake
|
|
nmake install
|
|
- name: Run cmake tests
|
|
run: |
|
|
mkdir build-cmake/bin
|
|
cd build-cmake/bin
|
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=~/protobuf-c-bin -DBUILD_SHARED_LIBS=${{ matrix.shared-lib }} -DProtobuf_ROOT="~/protobuf-bin" -Dabsl_ROOT="~/abseil-bin" -Dutf8_range_ROOT="~/utf8_range-bin" ..
|
|
nmake
|
|
nmake test
|
|
nmake install
|