-
Notifications
You must be signed in to change notification settings - Fork 27
188 lines (158 loc) · 8.27 KB
/
build_linux_cpp.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
name: Linux C++
on:
workflow_call:
jobs:
cpp:
strategy:
fail-fast: false
matrix:
include:
- { os: "ubuntu-20.04", platform: "64", gcc-version: "7", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-20.04", platform: "64", gcc-version: "7", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-20.04", platform: "32", gcc-version: "7", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-20.04", platform: "32", gcc-version: "7", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-20.04", platform: "64", clang-version: "11", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-20.04", platform: "64", clang-version: "11", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-20.04", platform: "32", clang-version: "11", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-20.04", platform: "32", clang-version: "11", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "64", gcc-version: "11", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "64", gcc-version: "11", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "32", gcc-version: "11", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "32", gcc-version: "11", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "64", clang-version: "14", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "64", clang-version: "14", cxx-standard: "11", build-type: "Debug" }
- { os: "ubuntu-22.04", platform: "32", clang-version: "14", cxx-standard: "11", build-type: "Release" }
- { os: "ubuntu-22.04", platform: "32", clang-version: "14", cxx-standard: "11", 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" }
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-22.04" ]] ; then
echo "CLANG_FORMAT_BIN=clang-format-14" >> ${GITHUB_ENV}
fi
if [[ "${{matrix.build-type}}" == "Debug" ]] ; then
if [[ "${{matrix.clang-version}}" == "14" ]] ; then
echo "CLANG_TIDY_BIN=clang-tidy-${{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.clang-version}}" != "" ]] ; then
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.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=1"
"-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: Set up Java 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "8"
- 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: Download Zserio release artifact
uses: actions/download-artifact@v4
with:
name: zserio-bin-java8
- name: Build Zserio C++ runtime
run: |
scripts/build.sh cpp_rt-${PACKAGE}
- name: Pack Zserio C++ runtime release
run: |
scripts/release.sh -p runtime_libs
- name: Run Zserio tests
run: |
scripts/test.sh cpp-${PACKAGE}
- name: Run Zserio tests with extra arguments
run: |
export ZSERIO_EXTRA_ARGS="-withTypeInfoCode -withReflectionCode -withCodeComments -setCppAllocator polymorphic -withParsingInfoCode"
scripts/test.sh -p -i arguments/without_writer_code cpp-${PACKAGE}
export ZSERIO_EXTRA_ARGS="${ZSERIO_EXTRA_ARGS} -withValidationCode -withRangeCheckCode"
scripts/test.sh -p -x arguments/without_writer_code cpp-${PACKAGE}
- name: Run Zserio integration tests for repeated generation
run: |
scripts/test_gen.sh cpp-${PACKAGE}
- name: Run Zserio API compatibility checks
env:
CLANG_FORMAT_BIN: ""
CLANG_TIDY_BIN: ""
GCOVR_BIN: ""
LLVM_PROFDATA_BIN: ""
LLVM_COV_BIN: ""
SANITIZERS_ENABLED: 0
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
scripts/test_compat_api.sh cpp-${PACKAGE}
- name: Run Zserio performance tests
run: |
scripts/test_perf.sh cpp-${PACKAGE} \
--source-dir test/data/others/gif/zs --source gif.zs \
--blob-name gif.GifFile --blob-file test/data/others/gif/data/1pix.gif \
--num-iterations 1000 --test-config READ_WRITE
- name: Run Zserio benchmarks
run: |
scripts/benchmark.sh cpp-${PACKAGE} --num-iterations 1
- name: Upload Zserio C++ 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 == '14' && matrix.cxx-standard == '11' &&
matrix.build-type == 'Debug' }}
with:
name: "zserio-runtime-cpp"
path: release-*/*runtime-libs*
- name: Upload Zserio C++ 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_libs/cpp/**/runtime/*.a