Skip to content

Commit f5ccc13

Browse files
committed
Update SonarCloud job to use github action to install sonar-scanner and
build-wrapper. Signed-off-by: Christina Tempelaar-Lietz <[email protected]>
1 parent d2460f0 commit f5ccc13

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/analysis_workflow.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
name: Analysis
88

99
on:
10-
schedule:
10+
# schedule:
1111
# Weekly Sunday build
12-
- cron: "0 0 * * 0"
13-
workflow_dispatch:
12+
# - cron: "0 0 * * 0"
13+
# workflow_dispatch:
14+
#
15+
pull-request:
16+
branches:
17+
- main
1418

1519
jobs:
1620

@@ -30,6 +34,7 @@ jobs:
3034
env:
3135
CXX: g++
3236
CC: gcc
37+
BUILD_WRAPPER_OUT_DIR: bw-output
3338
steps:
3439
# TODO: Remove this workaround following resolution of:
3540
# https://github.com/AcademySoftwareFoundation/aswf-docker/issues/43
@@ -38,7 +43,11 @@ jobs:
3843
- name: Checkout
3944
uses: actions/checkout@v3
4045
with:
41-
fetch-depth: 50
46+
# Disabling shallow clone is recommended for improving the
47+
# relevancy of reporting
48+
fetch-depth: 0
49+
- name: Install sonar-scanner and build-wrapper
50+
uses: sonarsource/sonarcloud-github-c-cpp@v1
4251
- name: Create build directories
4352
run: |
4453
mkdir _install
@@ -63,7 +72,8 @@ jobs:
6372
- name: Build OpenEXR with build-wrapper
6473
shell: bash
6574
run: |
66-
build-wrapper-linux-x86-64 --out-dir bw_output \
75+
build-wrapper-linux-x86-64 \
76+
--out-dir "${{ env.BUILD_WRAPPER_OUT_DIR }}" \
6777
cmake --build . \
6878
--target install \
6979
--config Release
@@ -83,7 +93,9 @@ jobs:
8393
env:
8494
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8595
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
86-
run: sonar-scanner -X -Dsonar.login=$SONAR_TOKEN
96+
run: sonar-scanner -X -Dsonar.login=$SONAR_TOKEN \
97+
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
98+
8799

88100
# ------------------------------------------------------------------------------
89101
# Valgrind memcheck test

0 commit comments

Comments
 (0)