Skip to content

Commit bb1976f

Browse files
committed
WIP: (main)
Signed-off-by: Philippe Coval <[email protected]>
1 parent 31cb0ba commit bb1976f

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
contents: read
1515
env:
1616
project-name: z-wave-protocol-controller # Align to docker (lowercase)
17+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
18+
BUILD_WRAPPER_OUT_DIR: out/sonar/build_wrapper
1719
runs-on: ubuntu-22.04
1820
steps:
1921
# yamllint disable-line rule:line-length
@@ -25,10 +27,14 @@ jobs:
2527
run: >-
2628
echo "describe=$(git describe --tags --always || echo 0)"
2729
| tee $GITHUB_OUTPUT
30+
- name: Install Build Wrapper
31+
# yamllint disable-line rule:line-length
32+
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4 # TODO pin it
2833
- name: Build Docker image from sources
2934
run: >-
3035
df -h
31-
&&
36+
&&\
37+
mkdir -p "${{ env.BUILD_WRAPPER_OUT_DIR }}"
3238
docker build
3339
--tag "${{ env.project-name }}:latest"
3440
--build-arg
@@ -38,7 +44,13 @@ jobs:
3844
.
3945
&&
4046
df -h
41-
47+
# yamllint disable-line rule:line-length
48+
- uses: SonarSource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1
49+
env:
50+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
51+
with:
52+
# yamllint disable-line rule:line-length
53+
args: -Dsonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
4254
- name: Upload container image
4355
# yamllint disable-line rule:line-length
4456
uses: ishworkh/container-image-artifact-upload@5d71a2417f0576fa11fe770fb04ece58c4587714 # v2.0.0

helper.mk

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ rust_url?=https://sh.rustup.rs
6262
RUST_VERSION?=1.71.0
6363
export PATH := ${HOME}/.cargo/bin:${PATH}
6464

65+
ifndef BUILD_WRAPPER_OUT_DIR
66+
cmake?=cmake
67+
else
68+
hostype_dash?=$(shell echo ${HOSTYPE} | sed -e 's|_|-|g')
69+
build_wrapper?=build-wrapper-linux-${hostype_dash} --out-dir "${BUILD_WRAPPER_OUT_DIR}"
70+
cmake?=${build_wrapper} cmake
71+
endif
6572

6673
# Allow overloading from env if needed
6774
ifdef VERBOSE
@@ -166,7 +173,7 @@ setup/cmake:
166173
--prefix=/usr/local \
167174
--skip-license
168175
rm -v "${cmake_filename}"
169-
cmake --version
176+
${cmake} --version
170177

171178
setup-cmake: setup/cmake
172179

@@ -225,12 +232,12 @@ reconfigure: configure/clean configure
225232
@date -u
226233

227234
${build_dir}/CMakeCache.txt: CMakeLists.txt
228-
cmake ${cmake_options}
235+
${cmake} ${cmake_options}
229236

230237
all: ${build_dir}/CMakeCache.txt
231-
# cmake --build ${<D} \
238+
# ${cmake} --build ${<D} \
232239
# || cat ${build_dir}/CMakeFiles/CMakeOutput.log
233-
cmake --build ${<D}
240+
${cmake} --build ${<D}
234241
.PHONY: all
235242

236243
${build_dir}/%: all
@@ -281,11 +288,11 @@ zwa/test: ./scripts/tests/z-wave-stack-binaries-test.sh ${zwa_dir}
281288
time $< # Add debug=1 to begining of this line to trace
282289

283290
dist/cmake: ${build_dir}
284-
cmake --build $< --target package
285-
cmake --build $< --target package_archive
291+
${cmake} --build $< --target package
292+
${cmake} --build $< --target package_archive
286293

287294
dist/deb: ${build_dir}
288-
cmake --build $< --target package
295+
${cmake} --build $< --target package
289296
install -d $</$@
290297
cp -av ${<}/*.deb $</$@
291298

@@ -296,7 +303,7 @@ distclean:
296303

297304
prepare: git/prepare
298305
git --version
299-
cmake --version
306+
${cmake} --version
300307

301308
all/default: configure prepare all test dist
302309
@date -u
@@ -370,7 +377,7 @@ docs: ./scripts/build/build_documentation.py doc ${PLANTUML_JAR_PATH} configure
370377
touch $@/.nojekyll
371378

372379
zpc/docs/api: docs
373-
cmake --build build --target zpc_doxygen
380+
${cmake} --build build --target zpc_doxygen
374381
install -d docs/doxygen_zpc
375382
cp -rfa build/zpc_doxygen_zpc/html/* docs/doxygen_zpc/
376383

0 commit comments

Comments
 (0)