Skip to content

Commit 1f311ef

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 a00bac5 commit 1f311ef

File tree

2 files changed

+62
-515
lines changed

2 files changed

+62
-515
lines changed

.github/workflows/analysis_workflow.yml

Lines changed: 18 additions & 6 deletions
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
permissions:
1620
contents: read
@@ -33,6 +37,7 @@ jobs:
3337
env:
3438
CXX: g++
3539
CC: gcc
40+
BUILD_WRAPPER_OUT_DIR: bw-output
3641
steps:
3742
# TODO: Remove this workaround following resolution of:
3843
# https://github.com/AcademySoftwareFoundation/aswf-docker/issues/43
@@ -41,7 +46,11 @@ jobs:
4146
- name: Checkout
4247
uses: actions/checkout@v3
4348
with:
44-
fetch-depth: 50
49+
# Disabling shallow clone is recommended for improving the
50+
# relevancy of reporting
51+
fetch-depth: 0
52+
- name: Install sonar-scanner and build-wrapper
53+
uses: sonarsource/sonarcloud-github-c-cpp@v1
4554
- name: Create build directories
4655
run: |
4756
mkdir _install
@@ -66,7 +75,8 @@ jobs:
6675
- name: Build OpenEXR with build-wrapper
6776
shell: bash
6877
run: |
69-
build-wrapper-linux-x86-64 --out-dir bw_output \
78+
build-wrapper-linux-x86-64 \
79+
--out-dir "${{ env.BUILD_WRAPPER_OUT_DIR }}" \
7080
cmake --build . \
7181
--target install \
7282
--config Release
@@ -86,7 +96,9 @@ jobs:
8696
env:
8797
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8898
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
89-
run: sonar-scanner -X -Dsonar.login=$SONAR_TOKEN
99+
run: sonar-scanner -X -Dsonar.login=$SONAR_TOKEN \
100+
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
101+
90102

91103
# ------------------------------------------------------------------------------
92104
# Valgrind memcheck test

0 commit comments

Comments
 (0)