fix syntax #860
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
sonarcloud: | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push') || ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name != github.repository)) | |
env: | |
CC: gcc-9 | |
CXX: g++-9 | |
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Install sonar-scanner and build-wrapper | |
uses: sonarsource/sonarcloud-github-c-cpp@v3 | |
- name: Run build-wrapper | |
run: | | |
# here goes your compilation wrapped with build-wrapper; See https://docs.sonarcloud.io/advanced-setup/languages/c-c-objective-c/#analysis-steps-using-build-wrapper for more information | |
rm -rf build | |
mkdir build | |
cmake . -B build | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --target aws-iot-device-client | |
- name: Build and Run Tests | |
run: | | |
cmake --build build/ --target test-aws-iot-device-client | |
./build/test/test-aws-iot-device-client | |
- name: Run coverage | |
run: | | |
mkdir coverage-dir | |
cd coverage-dir | |
find ../build/test/CMakeFiles/test-aws-iot-device-client.dir/__/source -name '*.o' | xargs gcov --preserve-paths | |
cd .. | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" --define sonar.cfamily.gcov.reportsPath="coverage-dir" | |
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options |