-
Notifications
You must be signed in to change notification settings - Fork 36
286 lines (227 loc) · 12.9 KB
/
build.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
name: Build
on:
push:
paths:
- '**.cpp'
- '**.hpp'
- '**.cmake'
- '**.cmake.in'
- '**/CMakeLists.txt'
- '.github/workflows/build.yml'
- 'deps/**'
- 'sonar-project.properties'
- 'vcpkg.json'
- 'CMakePresets.json'
env:
VCPKG_VERSION: '834977918592e4f5d5ec5fe48ba338c608faf9f9'
CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=Release -DVCPKG_MANIFEST_INSTALL=off -DASIO_GRPC_ENABLE_PKGCONFIG_FALLBACK=off -DCMAKE_COMPILE_WARNING_AS_ERROR=on -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=on -DTHREADS_PREFER_PTHREAD_FLAG=on -DCMAKE_UNITY_BUILD=on'
CTEST_ARGS: '-T test --output-on-failure --timeout 180 --no-tests=error --parallel 25'
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: 'Windows/2022/MSVC',
os: windows-2022,
triplet: 'x64-windows-release',
build-type: 'Release',
cmake-extra-args: '-DVCPKG_TARGET_TRIPLET=x64-windows-release -DCMAKE_COMPILE_WARNING_AS_ERROR=off',
parallel: 1,
}
- {
name: 'MacOSX/13/AppleClang',
os: macos-13,
triplet: 'x64-osx-release',
build-type: 'Debug',
cmake-extra-args: '-DCMAKE_BUILD_TYPE=Debug -DVCPKG_TARGET_TRIPLET=x64-osx-release -DASIO_GRPC_HAS_STD_PMR=off -DCMAKE_UNITY_BUILD=off',
parallel: 4,
}
steps:
- uses: actions/checkout@v4
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
vcpkgGitCommitId: '${{ env.VCPKG_VERSION }}'
vcpkgJsonGlob: 'vcpkg.json'
- name: Run vcpkg
run: ${{ env.VCPKG_ROOT }}/vcpkg install --recurse --clean-after-build --triplet ${{ matrix.config.triplet }} --host-triplet ${{ matrix.config.triplet }} --x-install-root=${{ runner.workspace }}/vcpkg_installed --overlay-ports=${{ github.workspace }}/deps --overlay-triplets=${{ github.workspace }}/.github/vcpkg
- name: Configure CMake
run: cmake --preset default -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed ${{ env.CMAKE_ARGS }} ${{ matrix.config.cmake-extra-args }}
- name: Build
run: cmake --build --preset default --config ${{ matrix.config.build-type }} --parallel ${{ matrix.config.parallel }}
- name: Test
run: ctest --preset default --parallel 25 -C ${{ matrix.config.build-type }}
gcc-8-build:
name: 'Ubuntu/20.04/GCC'
runs-on: ubuntu-20.04
env:
TRIPLET: 'x64-linux-release'
steps:
- name: Install GCC 8
run: sudo apt-get install g++-8
- name: Make gcc-8 default compiler
run: |
sudo update-alternatives --install /usr/bin/cc cc $(which gcc-8) 50 &&\
sudo update-alternatives --set cc $(which gcc-8) &&\
sudo update-alternatives --install /usr/bin/c++ c++ $(which g++-8) 50 &&\
sudo update-alternatives --set c++ $(which g++-8) &&\
sudo update-alternatives --install /usr/bin/cpp cpp $(which g++-8) 50 &&\
sudo update-alternatives --set cpp $(which g++-8)
- uses: actions/checkout@v4
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
vcpkgGitCommitId: '${{ env.VCPKG_VERSION }}'
vcpkgJsonGlob: 'vcpkg.json'
- name: Run vcpkg
run: ${{ env.VCPKG_ROOT }}/vcpkg install --recurse --clean-after-build --triplet ${{ env.TRIPLET }} --host-triplet ${{ env.TRIPLET }} --x-install-root=${{ runner.workspace }}/vcpkg_installed --overlay-ports=${{ github.workspace }}/deps --overlay-triplets=${{ github.workspace }}/.github/vcpkg
- name: GCC 8 Configure CMake
run: cmake --preset default -B ${{ github.workspace }}/build-8 -DCMAKE_CXX_COMPILER=$(which g++-8) -DASIO_GRPC_ENABLE_CMAKE_INSTALL_TEST=off -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed -DVCPKG_TARGET_TRIPLET=${{ env.TRIPLET }} -DASIO_GRPC_ENABLE_IO_URING_EXAMPLES=off -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold ${{ env.CMAKE_ARGS }}
- name: GCC 8 Build
run: cmake --build ${{ github.workspace }}/build-8 --config Release --parallel $(nproc)
- name: GCC 8 Test
run: ctest ${{ env.CTEST_ARGS }} --test-dir ${{ github.workspace }}/build-8 -C Release
gcc-11-build:
name: 'Ubuntu/22.04/GCC'
runs-on: ubuntu-22.04
env:
TRIPLET: 'x64-linux-release'
CMAKE_EXTRA_ARGS: '-DVCPKG_TARGET_TRIPLET=x64-linux-release -DASIO_GRPC_ENABLE_STDEXEC_TESTS=on -DASIO_GRPC_ENABLE_IO_URING_EXAMPLES=off -DASIO_GRPC_CMAKE_INSTALL_TEST_CTEST_COMMAND=/usr/bin/ctest -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold -DCMAKE_DISABLE_PRECOMPILE_HEADERS=on'
steps:
- name: Install gcovr and (old) cmake
run: sudo apt-get install gcovr cmake
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of sonarsource reporting
fetch-depth: 0
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
vcpkgGitCommitId: '${{ env.VCPKG_VERSION }}'
vcpkgJsonGlob: 'vcpkg.json'
- name: Run vcpkg
run: ${{ env.VCPKG_ROOT }}/vcpkg install --recurse --clean-after-build --triplet ${{ env.TRIPLET }} --host-triplet ${{ env.TRIPLET }} --x-install-root=${{ runner.workspace }}/vcpkg_installed --overlay-ports=${{ github.workspace }}/deps --overlay-triplets=${{ github.workspace }}/.github/vcpkg
- name: GCC 11 Configure CMake
run: cmake --preset default -B ${{ github.workspace }}/build-11 -DCMAKE_CXX_COMPILER=$(which g++-11) -DASIO_GRPC_ENABLE_CMAKE_INSTALL_TEST=off -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DASIO_GRPC_TEST_COVERAGE=on -DASIO_GRPC_GCOV_PROGRAM=$(which gcov-11) -DASIO_GRPC_COVERAGE_OUTPUT_FILE=${{ github.workspace }}/build-11/sonarqube-coverage.xml -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed ${{ env.CMAKE_EXTRA_ARGS }} ${{ env.CMAKE_ARGS }} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_UNITY_BUILD=off
- name: GCC 11 Build
run: cmake --build ${{ github.workspace }}/build-11 --config Debug --parallel $(nproc)
- name: GCC 11 Test
run: ctest ${{ env.CTEST_ARGS }} --test-dir ${{ github.workspace }}/build-11 -C Debug
- name: GCC 11 Coverage
run: cmake --build ${{ github.workspace }}/build-11 --config Debug --target asio-grpc-test-coverage
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Download sonar-scanner
uses: warchant/setup-sonar-scanner@v8
with:
version: 5.0.1.3006
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sonar-scanner \
"-Dsonar.cfamily.compile-commands=${{ github.workspace }}/build-11/compile_commands.json" \
"-Dsonar.token=${{ secrets.SONAR_TOKEN }}" \
"-Dsonar.coverageReportPaths=${{ github.workspace }}/build-11/sonarqube-coverage.xml"
multi-clang-build:
name: 'Ubuntu/20.04/Clang'
runs-on: ubuntu-20.04
env:
TRIPLET: 'x64-linux-clang-release'
CMAKE_EXTRA_ARGS: '-DVCPKG_TARGET_TRIPLET=x64-linux-clang-release -DCMAKE_DISABLE_PRECOMPILE_HEADERS=on -DASIO_GRPC_ENABLE_IO_URING_EXAMPLES=off -DASIO_GRPC_ENABLE_CMAKE_INSTALL_TEST=off "-DCMAKE_CXX_FLAGS=-stdlib=libc++ -stdlib++-isystem /usr/lib/llvm-10/include/c++/v1/ -Wno-unused-command-line-argument" -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld'
steps:
- name: Install dot for doxygen
run: sudo apt-get install graphviz
- name: Make clang-10 default compiler
run: |
sudo update-alternatives --install /usr/bin/cc cc $(which clang-10) 50 &&\
sudo update-alternatives --set cc $(which clang-10) &&\
sudo update-alternatives --install /usr/bin/c++ c++ $(which clang++-10) 50 &&\
sudo update-alternatives --set c++ $(which clang++-10) &&\
sudo update-alternatives --install /usr/bin/cpp cpp $(which clang++-10) 50 &&\
sudo update-alternatives --set cpp $(which clang++-10)
- uses: actions/checkout@v4
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
vcpkgGitCommitId: '${{ env.VCPKG_VERSION }}'
vcpkgJsonGlob: 'vcpkg.json'
- name: Run vcpkg
run: ${{ env.VCPKG_ROOT }}/vcpkg install --recurse --clean-after-build --triplet ${{ env.TRIPLET }} --host-triplet ${{ env.TRIPLET }} --x-install-root=${{ runner.workspace }}/vcpkg_installed --overlay-ports=${{ github.workspace }}/deps --overlay-triplets=${{ github.workspace }}/.github/vcpkg
- name: Clang 10 Configure CMake
run: cmake --preset default -B ${{ github.workspace }}/build-10 -DCMAKE_CXX_COMPILER=$(which clang++-10) -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed ${{ env.CMAKE_EXTRA_ARGS }} ${{ env.CMAKE_ARGS }}
- name: Clang 10 Build
run: cmake --build ${{ github.workspace }}/build-10 --config Release --parallel $(nproc)
- name: Clang 10 Test
run: ctest ${{ env.CTEST_ARGS }} --test-dir ${{ github.workspace }}/build-10 -C Release
- name: Download doxygen
working-directory: ${{ runner.workspace }}
run: |
cmake -E make_directory doxygen &&\
cd doxygen &&\
wget --quiet https://download.sourceforge.net/project/doxygen/rel-1.12.0/doxygen-1.12.0.linux.bin.tar.gz &&\
tar xf doxygen-1.12.0.linux.bin.tar.gz --strip-components=1
- name: Clang 12 Configure CMake for examples
run: cmake --preset default -B ${{ github.workspace }}/build-12 -DCMAKE_CXX_COMPILER=$(which clang++-12) -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed ${{ env.CMAKE_EXTRA_ARGS }} ${{ env.CMAKE_ARGS }} -DASIO_GRPC_BUILD_TESTS=off -DASIO_GRPC_BUILD_EXAMPLES=on
- name: Clang 12 Build examples
run: cmake --build ${{ github.workspace }}/build-12 --config Release --parallel $(nproc)
- name: Clang 12 Configure CMake
run: cmake --preset default -B ${{ github.workspace }}/build-12 -DCMAKE_CXX_COMPILER=$(which clang++-12) -DDOXYGEN_EXECUTABLE=${{ runner.workspace }}/doxygen/bin/doxygen -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed ${{ env.CMAKE_EXTRA_ARGS }} ${{ env.CMAKE_ARGS }}
- name: Clang 12 Build
run: cmake --build ${{ github.workspace }}/build-12 --config Release --parallel $(nproc) --target asio-grpc-check-header-syntax all
- name: Clang 12 Test
run: ctest ${{ env.CTEST_ARGS }} --test-dir ${{ github.workspace }}/build-12 -C Release
- name: Run doxygen
run: |
cmake -E make_directory ${{ github.workspace }}/docs &&\
cmake -E touch ${{ github.workspace }}/docs/.nojekyll &&\
cmake --build ${{ github.workspace }}/build-12 --config Release --target asio-grpc-doxygen
- name: Push doxygen changes
if: ${{ github.ref_name == 'master' }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -f docs/.nojekyll || echo "nothing to add"
git add -f docs/* || echo "nothing to add"
remote="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git commit -m "Re-generate Github Pages" && \
git push --force "${remote}" $(git log -n 1 --pretty=format:"%H"):gh-pages || echo "nothing to push"
shell: bash
default-gcc-build:
name: 'Ubuntu/20.04/Default'
runs-on: ubuntu-20.04
env:
TRIPLET: 'x64-linux-release'
CMAKE_EXTRA_ARGS: '-DVCPKG_TARGET_TRIPLET=x64-linux-release -DASIO_GRPC_ENABLE_IO_URING_EXAMPLES=off -DASIO_GRPC_ENABLE_CMAKE_INSTALL_TEST=off -DASIO_GRPC_ENABLE_PKGCONFIG_FALLBACK=on -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=gold'
steps:
- name: Install protobuf, gRPC and doctest
run: sudo apt-get install libgrpc++-dev protobuf-compiler-grpc libprotobuf-dev doctest-dev libgtest-dev libgmock-dev
- uses: actions/checkout@v4
- name: Install vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
vcpkgGitCommitId: '${{ env.VCPKG_VERSION }}'
vcpkgJsonGlob: 'vcpkg.json'
- name: Run vcpkg
run: |
${{ env.VCPKG_ROOT }}/vcpkg install --recurse --clean-after-build --triplet ${{ env.TRIPLET }} --host-triplet ${{ env.TRIPLET }} \
--x-install-root=${{ runner.workspace }}/vcpkg_installed --overlay-ports=${{ github.workspace }}/deps --overlay-triplets=${{ github.workspace }}/.github/vcpkg \
libunifex boost-coroutine boost-asio boost-interprocess boost-thread boost-process asio[coroutine]
working-directory: ${{ env.VCPKG_ROOT }}
- name: Configure CMake
run: cmake --preset default -DCMAKE_CXX_COMPILER=$(which g++-10) -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}/vcpkg_installed ${{ env.CMAKE_ARGS }} ${{ env.CMAKE_EXTRA_ARGS }}
- name: Build
run: cmake --build --preset default --config Release --parallel $(nproc) --target asio-grpc-check-header-syntax all
- name: Test
run: ctest --preset default -C Release