@@ -137,85 +137,3 @@ jobs:
137137 sudo apt-get install -y gcc-arm-none-eabi
138138 - run : arm-none-eabi-gcc libcanard/*.c -isystem lib/cavl2 -c -std=c99 ${{ env.flags }}
139139 - run : arm-none-eabi-gcc libcanard/*.c -isystem lib/cavl2 -c -std=c11 ${{ env.flags }}
140-
141- sonarcloud :
142- if : >
143- github.event_name == 'pull_request' ||
144- contains(github.ref, '/master') ||
145- contains(github.ref, '/release') ||
146- contains(github.event.head_commit.message, '#sonar')
147- runs-on : ubuntu-latest
148- env :
149- SONAR_SCANNER_VERSION : 5.0.1.3006
150- SONAR_SERVER_URL : " https://sonarcloud.io"
151- BUILD_WRAPPER_OUT_DIR : build_wrapper_output_directory
152- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
154- steps :
155- - uses : actions/checkout@v4
156- with :
157- submodules : true
158- fetch-depth : 0
159-
160- - name : Install Dependencies
161- run : |
162- sudo apt-get update -y && sudo apt-get upgrade -y
163- sudo apt-get install -y gcc-multilib g++-multilib
164-
165- - name : Set up JDK
166- uses : actions/setup-java@v4
167- with :
168- java-version : 17
169- distribution : zulu
170-
171- - name : Cache SonarCloud packages
172- uses : actions/cache@v4
173- with :
174- path : ~/.sonar/cache
175- key : ${{ runner.os }}-sonar
176- restore-keys : ${{ runner.os }}-sonar
177-
178- - name : Download and set up sonar-scanner
179- env :
180- SONAR_SCANNER_DOWNLOAD_URL : https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
181- run : |
182- mkdir -p $HOME/.sonar
183- curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
184- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
185- echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
186-
187- - name : Download and set up build-wrapper
188- env :
189- BUILD_WRAPPER_DOWNLOAD_URL : ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
190- run : |
191- curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
192- unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
193- echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
194-
195- - name : Run build-wrapper
196- run : |
197- cmake . -DCMAKE_BUILD_TYPE=Debug -DNO_STATIC_ANALYSIS=1 -DCMAKE_C_FLAGS='-DNDEBUG=1'
198- build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make all
199- make test
200- gcov --preserve-paths --long-file-names $(find CMakeFiles/test_private_cov.dir -name '*.gcno')
201- gcov --preserve-paths --long-file-names $(find CMakeFiles/test_public_cov.dir -name '*.gcno')
202-
203- - name : Run sonar-scanner
204- # Don't run sonar-scanner on builds originating from forks due to secrets not being available
205- run : >
206- [ -z "$SONAR_TOKEN" ] || sonar-scanner
207- --define sonar.organization=opencyphal
208- --define sonar.projectName=libcanard
209- --define sonar.projectKey=libcanard
210- --define sonar.sources=libcanard
211- --define sonar.cfamily.gcov.reportsPath=.
212- --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
213- --define sonar.host.url="${{ env.SONAR_SERVER_URL }}"
214-
215- - uses : actions/upload-artifact@v4
216- if : always()
217- with :
218- name : ${{github.job}}-#${{strategy.job-index}}-${{job.status}}-${{join(matrix.*, ',')}}
219- path : ${{github.workspace}}/**/*
220- retention-days : 7
221- include-hidden-files : true
0 commit comments