Improve release building - add checking for uncommitted changes (#67) #102
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
# Run SonarScanner | |
name: SonarCloud | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
sonar-scan: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Setup java 17 to be default (sonar-scanner requirement as of 5.x) | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Install sonar-scanner and build-wrapper | |
uses: sonarsource/sonarcloud-github-c-cpp@v2 | |
- name: Download Nordic SDK | |
run: | | |
if [ ! -d "nRF5_SDK_15.3.0_59ac345/modules" ]; then | |
wget -q https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip | |
unzip -q nRF5_SDK_15.3.0_59ac345.zip | |
fi | |
# Runs a single command using the runners shell | |
- name: Compile project | |
run: build-wrapper-linux-x86-64 --out-dir bw-output make sonar | |
- name: Set up Ruby 2.7 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
# Runs a single command using the runners shell | |
- name: Install Ceedling and GCovr | |
run: | | |
gem install ceedling | |
sudo pip install gcovr | |
# Runs a set of commands using the runners shell | |
- name: Run Sonar scanner | |
run: | | |
make test_all_gcov | |
export SONAR_SCANNER_OPTS="-server" | |
sonar-scanner \ | |
-Dsonar.organization=ruuvi \ | |
-Dsonar.projectKey=ruuvi_ruuvi.gateway_nrf.c \ | |
-Dsonar.sources=./src \ | |
-Dsonar.cfamily.build-wrapper-output=bw-output \ | |
-Dsonar.cfamily.gcov.reportsPath=. \ | |
-Dsonar.host.url=https://sonarcloud.io | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |