Skip to content

Commit fd63a4d

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 fd63a4d

File tree

1 file changed

+16
-139
lines changed

1 file changed

+16
-139
lines changed

.github/workflows/analysis_workflow.yml

+16-139
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+
BW_OUTPUT: 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,7 @@ 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 --out-dir ${{ env.BW_OUTPUT }} \
7079
cmake --build . \
7180
--target install \
7281
--config Release
@@ -86,139 +95,7 @@ jobs:
8695
env:
8796
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8897
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
89-
run: sonar-scanner -X -Dsonar.login=$SONAR_TOKEN
90-
91-
# ------------------------------------------------------------------------------
92-
# Valgrind memcheck test
93-
# ------------------------------------------------------------------------------
94-
linux_valgrind:
95-
name: 'Valgrind Linux CentOS 7 VFX CY2022 <GCC 9.3.1>'
96-
if: github.repository == 'AcademySoftwareFoundation/openexr'
97-
# GH-hosted VM. The build runs in CentOS 7 'container' defined below.
98-
runs-on: ubuntu-latest
99-
container:
100-
# DockerHub: https://hub.docker.com/u/aswf
101-
# Source: https://github.com/AcademySoftwareFoundation/aswf-docker
102-
image: aswf/ci-openexr:2022
103-
env:
104-
CXX: g++
105-
CC: gcc
106-
steps:
107-
# TODO: Remove this workaround following resolution of:
108-
# https://github.com/AcademySoftwareFoundation/aswf-docker/issues/43
109-
- name: Setup container
110-
run: sudo rm -rf /usr/local/lib64/cmake/glew
111-
- name: Checkout
112-
uses: actions/checkout@v3
113-
with:
114-
fetch-depth: 50
115-
- name: Create build directories
116-
run: |
117-
mkdir _install
118-
mkdir _build
119-
shell: bash
120-
- name: Install Dependencies
121-
run: |
122-
share/ci/scripts/linux/install_valgrind.sh
123-
shell: bash
124-
- name: Configure
125-
run: |
126-
cmake .. \
127-
-DCMAKE_INSTALL_PREFIX=../_install \
128-
-DCMAKE_BUILD_TYPE=Release \
129-
-DCMAKE_CXX_STANDARD=14 \
130-
-DCMAKE_VERBOSE_MAKEFILE:BOOL='OFF' \
131-
-DBUILD_SHARED_LIBS='OFF' \
132-
-DOPENEXR_BUILD_TOOLS='ON' \
133-
-DOPENEXR_RUN_FUZZ_TESTS='OFF' \
134-
-DOPENEXR_ENABLE_THREADING='ON'
135-
working-directory: _build
136-
- name: Build
137-
run: |
138-
cmake --build . \
139-
--target install \
140-
--config Release
141-
working-directory: _build
142-
- name: Valgrind memcheck tests
143-
run: |
144-
ctest -C Release \
145-
--timeout 50000 \
146-
--force-new-ctest-process \
147-
--test-action memcheck \
148-
--output-on-failure \
149-
-VV
150-
working-directory: _build
151-
- name: Valgrind memcheck test results
152-
run: |
153-
share/ci/scripts/linux/log_valgrind.sh _build
154-
shell: bash
155-
156-
# ------------------------------------------------------------------------------
157-
# Fuzz test
158-
# ------------------------------------------------------------------------------
159-
linux_fuzz:
160-
name: 'Fuzz Test ${{ matrix.build-descrip }} Linux CentOS 7 VFX CY2022 <GCC 9.3.1>'
161-
if: github.repository == 'AcademySoftwareFoundation/openexr'
162-
# GH-hosted VM. The build runs in CentOS 7 'container' defined below.
163-
runs-on: ubuntu-latest
164-
container:
165-
# DockerHub: https://hub.docker.com/u/aswf
166-
# Source: https://github.com/AcademySoftwareFoundation/aswf-docker
167-
image: aswf/ci-openexr:2022
168-
strategy:
169-
matrix:
170-
build: [1, 2]
171-
include:
172-
# Fuzz test
173-
- build: 1
174-
build-descrip:
175-
cflags:
176-
cxxflags:
177-
# Fuzz with sanitizer
178-
- build: 2
179-
build-descrip: With Sanitizer
180-
cflags: -DCFLAGS='-fsanitize=address'
181-
cxxflags: -DCXXFLAGS='-fsanitize=address'
182-
env:
183-
CXX: g++
184-
CC: gcc
185-
steps:
186-
# TODO: Remove this workaround following resolution of:
187-
# https://github.com/AcademySoftwareFoundation/aswf-docker/issues/43
188-
- name: Setup container
189-
run: sudo rm -rf /usr/local/lib64/cmake/glew
190-
- name: Checkout
191-
uses: actions/checkout@v3
192-
with:
193-
fetch-depth: 50
194-
- name: Create build directories
195-
run: |
196-
mkdir _install
197-
mkdir _build
198-
shell: bash
199-
- name: Configure
200-
run: |
201-
cmake .. \
202-
-DCMAKE_INSTALL_PREFIX=../_install \
203-
-DCMAKE_BUILD_TYPE=Release \
204-
-DCMAKE_CXX_STANDARD=14 \
205-
-DCMAKE_VERBOSE_MAKEFILE:BOOL='OFF' \
206-
-DBUILD_SHARED_LIBS='OFF' \
207-
-DOPENEXR_BUILD_TOOLS='ON' \
208-
-DOPENEXR_RUN_FUZZ_TESTS='ON' \
209-
-DOPENEXR_ENABLE_THREADING='ON' \
210-
${{ matrix.cxxflags }} \
211-
${{ matrix.cflags }}
212-
working-directory: _build
213-
- name: Build
214-
run: |
215-
cmake --build . \
216-
--target install \
217-
--config Release
218-
working-directory: _build
219-
- name: Fuzz test
220-
run: |
221-
bin/OpenEXRFuzzTest
222-
working-directory: _build
98+
run: sonar-scanner -X -Dsonar.login=$SONAR_TOKEN \
99+
-Dsonar.cfamily.build-wrapper-output="${{ env.BW_OUTPUT }}"
223100

224101

0 commit comments

Comments
 (0)