-
Notifications
You must be signed in to change notification settings - Fork 330
131 lines (102 loc) · 7.3 KB
/
cmake-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: CMake CI
on: [push, pull_request]
jobs:
build:
name: CMake on ${{ matrix.os }} with ${{ matrix.dependencies }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-20.04, windows-2019]
dependencies: [submodule, vcpkg]
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
submodules: ${{ matrix.dependencies == 'submodule' }}
- name: Mount vcpkg cache
if: matrix.dependencies == 'vcpkg'
uses: actions/cache@v3
with:
path: "~/.cache/vcpkg/archives"
key: vcpkg-${{ matrix.os }}
- name: Default to x64-windows vcpkg triplet
if: matrix.dependencies == 'vcpkg' && runner.os == 'Windows'
run: echo "VCPKG_DEFAULT_TRIPLET=x64-windows" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Install vcpkg dependencies
if: matrix.dependencies == 'vcpkg'
run: vcpkg install benchmark civetweb curl[core] gtest zlib
- name: Generate German locale on Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get remove -y --purge man-db # avoid time-consuming trigger
sudo apt-get update
sudo apt-get install -y locales
sudo locale-gen de_DE.UTF-8 # used by SerializerTest
- name: Install ninja on Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get install -y ninja-build
- name: Install ninja on macOS
if: runner.os == 'macOS'
run: brew install ninja
- name: "Configure for Unix with internal dependencies"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake -DUSE_THIRDPARTY_LIBRARIES=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }} -B ${{ github.workspace }}/_build -DBUILD_SHARED_LIBS=ON
- name: "Configure for Windows with internal dependencies"
if: matrix.dependencies == 'submodule' && runner.os == 'Windows'
run: cmake -DUSE_THIRDPARTY_LIBRARIES=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -S ${{ github.workspace }} -B ${{ github.workspace }}/_build -DBUILD_SHARED_LIBS=ON
- name: "Configure for Unix with vcpkg dependencies"
if: matrix.dependencies == 'vcpkg' && runner.os != 'Windows'
run: cmake -DUSE_THIRDPARTY_LIBRARIES=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_DEBUG_POSTFIX=_d -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }} -B ${{ github.workspace }}/_build
- name: "Configure for Windows with vcpkg dependencies"
if: matrix.dependencies == 'vcpkg' && runner.os == 'Windows'
run: cmake -DUSE_THIRDPARTY_LIBRARIES=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install "-DCMAKE_TOOLCHAIN_FILE=${Env:VCPKG_INSTALLATION_ROOT}\scripts\buildsystems\vcpkg.cmake" -DCMAKE_DEBUG_POSTFIX=_d -S ${{ github.workspace }} -B ${{ github.workspace }}/_build
- name: "Build Debug"
run: cmake --build ${{ github.workspace }}/_build --config Debug
- name: "Build Release"
run: cmake --build ${{ github.workspace }}/_build --config Release
- name: "Test Debug"
run: ctest -C Debug -V -LE Benchmark
working-directory: "${{ github.workspace }}/_build"
- name: "Test Release"
run: ctest -C Release -V -LE Benchmark
working-directory: "${{ github.workspace }}/_build"
- name: "Run Benchmark"
run: ctest -C Release -V -L Benchmark
working-directory: "${{ github.workspace }}/_build"
- name: "Install Debug"
run: cmake --install ${{ github.workspace }}/_build --config Debug
- name: "Install Release"
run: cmake --install ${{ github.workspace }}/_build --config Release
- name: "Configure CMake import for Unix with internal dependencies"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
- name: "Configure CMake import for Windows with internal dependencies"
if: matrix.dependencies == 'submodule' && runner.os == 'Windows'
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
- name: "Configure CMake import for Unix with vcpkg dependencies"
if: matrix.dependencies == 'vcpkg' && runner.os != 'Windows'
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
- name: "Configure CMake import for Windows with vcpkg dependencies"
if: matrix.dependencies == 'vcpkg' && runner.os == 'Windows'
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp "-DCMAKE_TOOLCHAIN_FILE=${Env:VCPKG_INSTALLATION_ROOT}\scripts\buildsystems\vcpkg.cmake" -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
- name: "Build CMake import Debug"
run: cmake --build ${{ github.workspace }}/_import_cmake --config Debug
- name: "Build CMake import Release"
run: cmake --build ${{ github.workspace }}/_import_cmake --config Release
- name: "Configure for Unix Shared Libs with internal dependencies"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake -DUSE_THIRDPARTY_LIBRARIES=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install_shared -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -GNinja -S ${{ github.workspace }} -B ${{ github.workspace }}/_build_shared
- name: "Build for Unix Shared Libs"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake --build ${{ github.workspace }}/_build_shared
- name: "Install for Unix Shared Libs"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake --install ${{ github.workspace }}/_build_shared
- name: "Configure pkg-config import for Unix"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake -DCMAKE_PREFIX_PATH=${{ github.workspace }}/_install_shared -GNinja -S ${{ github.workspace }}/cmake/project-import-pkgconfig -B ${{ github.workspace }}/_import_pkgconfig
- name: "Build pkg-config import for Unix"
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
run: cmake --build ${{ github.workspace }}/_import_pkgconfig