/
build-test.yml
217 lines (215 loc) · 9.3 KB
/
build-test.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
#
# Copyright(c) 2021 to 2022 ZettaScale Technology and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
#
# Template with basic build and test instructions to be included by pipelines.
#
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
name: install_python
# Set defaults from steps to share them among pipelines
- bash: |
[[ -n "${ARCH}" ]] || \
echo "###vso[task.setvariable variable=arch;]x86_64"
[[ -n "${BUILD_TYPE}" ]] || \
echo "###vso[task.setvariable variable=build_type;]Debug"
name: setup
- bash: |
echo "###vso[task.setvariable variable=pip_cache;]${HOME}/.cache/pip"
echo "###vso[task.setvariable variable=PATH;]$(python3 -m site --user-base)/bin:${PATH}"
echo "###vso[task.setvariable variable=build_tool_options;]-j 4"
sudo apt install -y clang clang-tools clang-tidy
condition: eq(variables['Agent.OS'], 'Linux')
name: setup_linux
- bash: |
set -e -x
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
echo "###vso[task.setvariable variable=pip_cache;]${HOME}/Library/Caches/pip"
echo "###vso[task.setvariable variable=PATH;]$(python3 -m site --user-base)/bin:${PATH}"
echo "###vso[task.setvariable variable=build_tool_options;]-j 4"
condition: eq(variables['Agent.OS'], 'Darwin')
name: setup_macos
# Use PowerShell rather than Bash to ensure Windows-style paths
- pwsh: |
$python_bin = python -m site --user-base
Write-Host "###vso[task.setvariable variable=pip_cache;]${env:LOCALAPPDATA}\\pip\\Cache"
Write-Host "###vso[task.setvariable variable=PATH;]$python_bin\\bin;${env:PATH}"
# Visual Studio is most likely used on Windows agents
if (${env:GENERATOR} -match "2019" -and -not ${env:PLATFORM}) {
# Make sure platform matches arch if not specified
if (${env:ARCH} -match "arm*") {
Write-Host "###vso[task.setvariable variable=platform;]ARM"
} elseif (${env:ARCH} -eq "x86") {
Write-Host "###vso[task.setvariable variable=platform;]Win32"
} else {
Write-Host "###vso[task.setvariable variable=platform;]x64"
}
}
if (${env:GENERATOR} -match "Visual Studio") {
Write-Host "###vso[task.setvariable variable=build_tool_options;]-nologo -verbosity:minimal -maxcpucount:4 -p:CL_MPCount=4"
} else {
Write-Host "###vso[task.setvariable variable=build_tool_options;]-j 4"
}
#choco install -y openssl
condition: eq(variables['Agent.OS'], 'Windows_NT')
name: setup_windows
- task: Cache@2
inputs:
key: pip | 2 | $(Agent.OS)
path: $(pip_cache)
name: cache_pip
- bash: |
set -e -x
python -m pip install pip wheel setuptools --user --upgrade
python -m pip install pre-commit --user --upgrade
pre-commit run --all-files
name: run_pre_commit
- bash: |
python -m pip install gcovr==5.0 --user --upgrade
name: install_gcovr
- bash: |
set -e -x
sudo apt install libacl1-dev libncurses5-dev pkg-config
git clone --depth 1 \
--branch "${ICEORYX_BRANCH:-release_2.0}" \
"${ICEORYX_REPOSITORY:-https://github.com/eclipse-iceoryx/iceoryx.git}" \
iceoryx
mkdir iceoryx/build
cd iceoryx/build
[[ "${AGENT_OS}" == 'Darwin' ]] && BUILD_TOOL_OPTIONS="-j 4"
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_BUILD_SHARED_LIBS=${SHAREDLIBS:-on} \
-DCMAKE_INSTALL_PREFIX=install \
${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" ../iceoryx_meta
cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
condition: eq(variables['iceoryx'], 'on')
name: install_iceoryx
- bash: |
set -e -x
mkdir build-sharedlibs
cd build-sharedlibs
cmake -DCMAKE_INSTALL_PREFIX=install \
-DWERROR=on \
${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" ..
${SCAN_BUILD} cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
cmake --build . --config ${BUILD_TYPE} --target package -- ${BUILD_TOOL_OPTIONS}
condition: eq(variables['sharedlibs'], 'off')
name: nonstatic_build_script
- bash: |
set -e -x
mkdir build
cd build
prefix_path="${BUILD_SOURCESDIRECTORY}/iceoryx/build/install"
if [[ "${AGENT_OS}" == 'Darwin' ]] ; then
prefix_path="${prefix_path}:`brew --prefix openssl`"
# Azure sometimes adds a spurious ' to BUILD_TOOL_OPTIONS
BUILD_TOOL_OPTIONS="-j 4"
fi
crosscompiling=
if [[ "${SHAREDLIBS:-on}" == "off" ]] ; then
prefix_path="${BUILD_SOURCESDIRECTORY}/build-sharedlibs/install:${prefix_path}"
crosscompiling="-DCMAKE_CROSSCOMPILING=1 -DCMAKE_SYSTEM_NAME=${AGENT_OS}"
fi
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH="${prefix_path//:/;}" \
-DBUILD_SHARED_LIBS=${SHAREDLIBS:-on} \
${crosscompiling} \
-DANALYZER=${ANALYZER:-off} \
-DSANITIZER=${SANITIZER:-none} \
-DENABLE_SSL=${SSL:-on} \
-DENABLE_SECURITY=${SECURITY:-on} \
-DENABLE_LIFESPAN=${LIFESPAN:-on} \
-DENABLE_DEADLINE_MISSED=${DEADLINE_MISSED:-on} \
-DSKIP_DEADLINE_UPDATE={DEADLINE_UPDATE_SKIP:-off} \
-DENABLE_TYPELIB=${TYPELIB:-on} \
-DENABLE_TYPE_DISCOVERY=${TYPE_DISCOVERY:-on} \
-DENABLE_TOPIC_DISCOVERY=${TOPIC_DISCOVERY:-on} \
-DENABLE_COVERAGE=${COVERAGE:-off} \
-DENABLE_ICEORYX=${ICEORYX:-off} \
-DBUILD_TESTING=${TESTING:-on} \
-DBUILD_IDLC_XTESTS=${IDLC_XTESTS:-on} \
-DBUILD_EXAMPLES=on \
-DWERROR=on \
${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" ..
${SCAN_BUILD} cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS}
cmake --build . --config ${BUILD_TYPE} --target package -- ${BUILD_TOOL_OPTIONS}
name: script
- bash: |
set -e -x
cd build
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 \
ctest -j 4 --output-on-failure -T test -E '^CUnit_ddsrt_random_default_random$' -C ${BUILD_TYPE}
condition: ne(variables['testing'], 'off')
name: test
displayName: Test
- bash: |
set -e -x
cd build
${SHELL} ../src/tools/ddsperf/sanity.bash
condition: and(and(ne(variables['build_type'], 'Release'), ne(variables['testing'], 'off')), ne(variables['coverage'], 'on'))
name: sanity_ddsperf
displayName: Sanity check ddsperf
- bash: |
set -e -x
cd build
[[ "${AGENT_OS}" == 'Darwin' ]] && BUILD_TOOL_OPTIONS="-j 4"
[[ "${SANITIZER:-none}" == 'none' ]] || \
export CFLAGS="-fsanitize=${SANITIZER}" LDFLAGS="-fsanitize=${SANITIZER}"
INSTALLPREFIX="$(pwd)/install"
mkdir helloworld
cd helloworld
cmake -DCMAKE_PREFIX_PATH="${INSTALLPREFIX}" \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" "${INSTALLPREFIX}/share/CycloneDDS/examples/helloworld"
cmake --build . --config ${BUILD_TYPE} -- ${BUILD_TOOL_OPTIONS}
${SHELL} ../../scripts/sanity_helloworld.bash
condition: ne(variables['sharedlibs'], 'off')
name: sanity_hello_world
displayName: Sanity check Hello World
- bash: |
set -e -x
cd build
x=symbol_export_test
d=bin
[ -d bin/${BUILD_TYPE} ] && d=bin/${BUILD_TYPE}
test -e $d/symbol_export_test
[[ "${BUILD_TYPE}" == 'Release' ]] || [[ "${AGENT_OS}" == 'Windows_NT' ]] || \
${SHELL} ../scripts/check_symbol_export.bash $d/symbol_export_test
condition: eq(variables['testing'], 'off')
name: sanity_symbol_export
displayName: Sanity check export symbols
- bash: |
set -e -x
cd build
[[ "${AGENT_OS}" == 'Darwin' ]] && BUILD_TOOL_OPTIONS="-j 4"
cmake --build . --config ${BUILD_TYPE} --target gcov -- ${BUILD_TOOL_OPTIONS}
gcovr --exclude '.*/tests/.*' --root "${BUILD_SOURCESDIRECTORY}" --json "$(System.DefaultWorkingDirectory)/coverage-$(Agent.JobName).json"
name: generate_code_coverage
displayName: Generate coverage artifact
condition: and(succeededOrFailed(), eq(variables['coverage'], 'on'))
- publish: $(System.DefaultWorkingDirectory)/coverage-$(Agent.JobName).json
artifact: coverage-$(Agent.JobName)
displayName: Publish coverage artifact
condition: and(succeededOrFailed(), eq(variables['coverage'], 'on'))
- task: PublishTestResults@2
inputs:
testRunTitle: $(Agent.JobName)
testRunner: CTest
testResultsFiles: '**/Test.xml'
searchFolder: $(System.DefaultWorkingDirectory)/build/Testing
platform: $(arch)
configuration: $(build_type)
name: publish_test_results
displayName: Publish test results
condition: and(succeededOrFailed(), or(ne(variables['testing'], 'off'), ne(variables['idlc_xtests'], 'off')))