Skip to content

Commit

Permalink
workflow: Use sonarcloud-github-c-cpp action
Browse files Browse the repository at this point in the history
Saves a lot of manual steps in the workflow

Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no>
  • Loading branch information
Balaji Srinivasan committed Aug 14, 2023
1 parent 1f53beb commit 4b6f89e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 40 deletions.
23 changes: 3 additions & 20 deletions .github/workflows/sonarcloud-native-posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
run: |
apt install -y lcov curl
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v1.3.2

# The docker image comes pre-initialized with west dependencies. We want to do west update ourselves to to be sure that we get the latest changes in all repos.
# The docker image is built nightly. So it may contain slightly out of date repos.
# Hence we remove the .west folder and do a re-init
Expand All @@ -45,26 +48,6 @@ jobs:
cd ncs
west update --narrow -o=--depth=1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
# Download the quarantine file base branch. This is needed to build and run the tests.
- name: Download quarentine file from nrf (PR only)
if: github.event_name == 'pull_request_target'
Expand Down
23 changes: 3 additions & 20 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
run: |
apt install -y lcov curl
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v1.3.2

# The docker image comes pre-initialized with west dependencies. We want to do west update ourselves to to be sure that we get the latest changes in all repos.
# The docker image is built nightly. So it may contain slightly out of date repos.
# Hence we remove the .west folder and do a re-init
Expand All @@ -37,26 +40,6 @@ jobs:
cd ncs
west update --narrow -o=--depth=1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Run native_posix tests
shell: bash
run: |
Expand Down

0 comments on commit 4b6f89e

Please sign in to comment.