From e42227a8a10f49b50ace2458a9d275636f96857f Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:11:45 +0100 Subject: [PATCH 1/7] Add sonarcloud workflow configuration --- .github/workflows/build.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b5f6668 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From ca8d16390a5eb9def1f96146f11f4ea3c42cc9c9 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:13:06 +0100 Subject: [PATCH 2/7] Add sonarcloud properties file --- sonar-project.properties | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..987268f --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=ladislas_mbed-cmake-template +sonar.organization=ladislas + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=mbed-cmake-template +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 From 75d56542e13194fad106fb6534a9c96cd371c5ab Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:20:03 +0100 Subject: [PATCH 3/7] Fill in the details --- sonar-project.properties | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 987268f..a4dadfa 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,11 +2,12 @@ sonar.projectKey=ladislas_mbed-cmake-template sonar.organization=ladislas # This is the name and version displayed in the SonarCloud UI. -#sonar.projectName=mbed-cmake-template -#sonar.projectVersion=1.0 +sonar.projectName=mbed-cmake-template +sonar.projectVersion=1.0 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -#sonar.sources=. +sonar.sources=src,spikes,lib +sonar.tests=test # Encoding of the source code. Default is default system encoding -#sonar.sourceEncoding=UTF-8 +sonar.sourceEncoding=UTF-8 From baea0e1c2f16ecb45ff3ab072a9a4ab48fdb11e6 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:36:39 +0100 Subject: [PATCH 4/7] Add build wrapper --- .github/workflows/build.yml | 5 +++++ sonar-project.properties | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5f6668..a391b9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,11 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Build wrapper + run: | + curl -s --create-dirs -o ./wrapper.zip https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip + unzip -q -o wrapper.zip + build-wrapper-macosx-x86 --out-dir bw-output make config all - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: diff --git a/sonar-project.properties b/sonar-project.properties index a4dadfa..f3d7a5f 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,7 +6,8 @@ sonar.projectName=mbed-cmake-template sonar.projectVersion=1.0 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -sonar.sources=src,spikes,lib +sonar.cfamily.build-wrapper-output=bw-output +sonar.sources=src,spikes,libs sonar.tests=test # Encoding of the source code. Default is default system encoding From cc45e4246fde208cb32443427c815b00ad0ba843 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:38:02 +0100 Subject: [PATCH 5/7] Fix bw --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a391b9a..cf1e243 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,8 @@ jobs: run: | curl -s --create-dirs -o ./wrapper.zip https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip unzip -q -o wrapper.zip - build-wrapper-macosx-x86 --out-dir bw-output make config all + ls -al + ./build-wrapper-macosx-x86 --out-dir bw-output make config all - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From c61fdfcd4a06d85acaf1084b374a3248de12321c Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:40:56 +0100 Subject: [PATCH 6/7] fix path --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf1e243..06dce78 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,8 @@ jobs: run: | curl -s --create-dirs -o ./wrapper.zip https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip unzip -q -o wrapper.zip - ls -al - ./build-wrapper-macosx-x86 --out-dir bw-output make config all + mv build-wrapper-macosx-x86 wrapper + ./wrapper/build-wrapper-macosx-x86 --out-dir bw-output make config all - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From 27aef1fb343f102cb669c312a7b1f60f9fda9316 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Fri, 19 Mar 2021 16:42:17 +0100 Subject: [PATCH 7/7] move to macos --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06dce78..6627fd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: jobs: sonarcloud: name: SonarCloud - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 with: