-
Notifications
You must be signed in to change notification settings - Fork 3
168 lines (144 loc) · 7.44 KB
/
build_linux_cpp.yml
File metadata and controls
168 lines (144 loc) · 7.44 KB
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
name: Linux C++17
on:
workflow_call:
jobs:
cpp:
strategy:
fail-fast: false
matrix:
include:
- { os: "ubuntu-22.04", platform: "64", gcc-version: "11", cxx-standard: "17", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "64", gcc-version: "11", cxx-standard: "17", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "32", gcc-version: "11", cxx-standard: "17", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "32", gcc-version: "11", cxx-standard: "17", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "64", clang-version: "14", cxx-standard: "17", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "64", clang-version: "14", cxx-standard: "17", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "32", clang-version: "14", cxx-standard: "17", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "32", clang-version: "14", cxx-standard: "17", build-type: "Debug" }
- { os: "ubuntu-24.04", platform: "64", clang-version: "18", cxx-standard: "17", build-type: "Release" }
- { os: "ubuntu-24.04", platform: "64", clang-version: "18", cxx-standard: "17", build-type: "Debug" }
- { os: "ubuntu-24.04", platform: "32", clang-version: "18", cxx-standard: "17", build-type: "Release" }
- { os: "ubuntu-24.04", platform: "32", clang-version: "18", cxx-standard: "17", build-type: "Debug" }
runs-on: ${{matrix.os}}
name: "\
${{matrix.os}}-${{matrix.platform}}-\
${{ matrix.gcc-version && format('gcc{0}', matrix.gcc-version)
|| format('clang{0}', matrix.clang-version) }}-\
c++${{matrix.cxx-standard}}-${{matrix.build-type}}"
steps:
- name: "Set up environment"
run: |
echo "CMAKE_BUILD_OPTIONS=-j$(nproc)" >> ${GITHUB_ENV}
if [[ "${{matrix.gcc-version}}" != "" ]] ; then
echo "GCC_VERSION_SUFFIX=-${{matrix.gcc-version}}" >> ${GITHUB_ENV}
echo "PACKAGE=linux${{matrix.platform}}-gcc" >> ${GITHUB_ENV}
elif [[ "${{matrix.clang-version}}" != "" ]] ; then
echo "CLANG_VERSION_SUFFIX=-${{matrix.clang-version}}" >> ${GITHUB_ENV}
echo "PACKAGE=linux${{matrix.platform}}-clang" >> ${GITHUB_ENV}
fi
if [[ "${{matrix.os}}" == "ubuntu-24.04" ]] ; then
echo "CLANG_FORMAT_BIN=clang-format-18" >> ${GITHUB_ENV}
fi
if [[ "${{matrix.build-type}}" == "Debug" ]] ; then
if [[ "${{matrix.clang-version}}" == "18" ]] ; then
echo "CLANG_TIDY_BIN=clang-tidy-${{matrix.clang-version}}" >> ${GITHUB_ENV}
echo "LLVM_PROFDATA_BIN=llvm-profdata-${{matrix.clang-version}}" >> ${GITHUB_ENV}
echo "LLVM_COV_BIN=llvm-cov-${{matrix.clang-version}}" >> ${GITHUB_ENV}
fi
if [[ "${{matrix.gcc-version}}" != "" && `gcc --version` == *" ${{matrix.gcc-version}}."* ]] ; then
# gcovr works only for default gcc version
echo "GCOVR_BIN=gcovr" >> ${GITHUB_ENV}
fi
if [[ ! ( "${{matrix.platform}}" == "32" && "${{matrix.clang-version}}" != "" ) ]] ; then
# sanitizers do not work with clang 32-bit when cross-compiling
# https://github.com/ndsev/zserio/issues/473
echo "SANITIZERS_ENABLED=1" >> ${GITHUB_ENV}
fi
fi
CMAKE_EXTRA_ARGS=("-DZSERIO_ENABLE_WERROR=ON"
"-DZSERIO_USE_BUNDLE=ON"
"-DCMAKE_BUILD_TYPE=${{matrix.build-type}}"
"-DCMAKE_CXX_STANDARD=${{matrix.cxx-standard}}")
echo "CMAKE_EXTRA_ARGS=${CMAKE_EXTRA_ARGS[@]}" >> ${GITHUB_ENV}
- name: Apt update # with workaround for 'Unable to connect to ppa.launchpad.net' failure
run: sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="300"
- name: Install dependencies
run: sudo apt-get install cmake doxygen graphviz g++-multilib gcovr
- name: Install gcc ${{matrix.gcc-version}} compiler
if: ${{ matrix.gcc-version != '' }}
run: |
sudo apt-get install gcc-${{matrix.gcc-version}}
sudo apt-get install g++-${{matrix.gcc-version}} g++-${{matrix.gcc-version}}-multilib
- name: Install clang ${{matrix.clang-version}} compiler
if: ${{ matrix.clang-version != '' }}
run: |
sudo apt-get install clang-${{matrix.clang-version}}
sudo apt-get install llvm-${{matrix.clang-version}}
# https://github.com/actions/runner-images/issues/9491 (remove once fixed)
- name: Reduce ASLR entropy as a temporary workaround
if: ${{ env.SANITIZERS_ENABLED == 1 }}
run: |
sudo sysctl -w vm.mmap_rnd_bits=28
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build Zserio C++17 runtime
run: |
scripts/build.sh cpp_rt-${PACKAGE}
- name: Upload Zserio C++17 runtime artifacts
uses: actions/upload-artifact@v4
# we need to collect this artifact from a build which has both clang coverage and clang-tidy reports
if: ${{ matrix.platform == '64' && matrix.clang-version == '18' && matrix.cxx-standard == '17' &&
matrix.build-type == 'Debug' }}
with:
name: "zserio-runtime-cpp"
path: distr/runtime_lib
- name: Upload Zserio C++17 build artifacts
uses: actions/upload-artifact@v4
with:
name: "\
zserio-build-${{matrix.os}}-${{matrix.platform}}-\
${{ matrix.gcc-version && format('gcc{0}', matrix.gcc-version)
|| format('clang{0}', matrix.clang-version) }}-\
cxx${{matrix.cxx-standard}}-${{matrix.build-type}}"
path: build/runtime_lib/**/runtime/*.a
- name: Download Zserio bundle artifact
uses: actions/download-artifact@v4
with:
name: zserio-java8
path: distr
- name: Run Zserio integration tests
run: |
scripts/test.sh cpp-${PACKAGE}
- name: Run Zserio integration tests with extra arguments
run: |
export ZSERIO_EXTRA_ARGS="-setCppAllocator pmr"
scripts/test.sh -p cpp-${PACKAGE}
export ZSERIO_EXTRA_ARGS="-setCppAllocator ppmr"
scripts/test.sh -p cpp-${PACKAGE}
- name: Run Zserio custom integration test
run: |
scripts/test_zs.sh cpp-${PACKAGE} -d test/data/others/gif/zs -s gif.zs
- name: Run Zserio performance test
run: |
scripts/test_perf.sh cpp-${PACKAGE} -d test/data/others/gif/zs -s gif.zs -b gif.GifFile \
-f test/data/others/gif/data/1pix.gif -c READ
scripts/test_perf.sh cpp-${PACKAGE} -d test/data/others/gif/zs -s gif.zs -b gif.GifFile \
-f test/data/others/gif/data/1pix.gif -c WRITE
scripts/test_perf.sh cpp-${PACKAGE} -d test/data/others/gif/zs -s gif.zs -b gif.GifFile \
-f test/data/others/gif/data/1pix.gif -c READ_WRITE
- name: Download Zserio bundle artifact
uses: actions/download-artifact@v4
with:
name: zserio-java8
path: tmp_shared/distr
- name: Build Zserio shared lib & disabled sqlite test
run: |
export CMAKE_EXTRA_ARGS="-DZSERIO_CPP17_RUNTIME_BUILD_SHARED_LIBS=ON -DZSERIO_CPP17_RUNTIME_SQLITE_ENABLE=OFF ${CMAKE_EXTRA_ARGS}"
scripts/build.sh cpp_rt-${PACKAGE} -o tmp_shared
scripts/test.sh -p cpp-${PACKAGE} -o tmp_shared -i others/gif
- name: Build Zserio without RTTI
run: |
export CMAKE_EXTRA_ARGS="-DRTTI_ENABLED=OFF"
scripts/build.sh cpp_rt-${PACKAGE} -o tmp_no_rtti