-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from makers-for-life/enable-sonarcloud
Enable sonarcloud
- Loading branch information
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
language: generic | ||
before_install: | ||
- wget http://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz | ||
- tar xf arduino-cli_latest_Linux_64bit.tar.gz | ||
- mkdir -p $HOME/bin | ||
- mv arduino-cli $HOME/bin/arduino-cli | ||
- export PATH=$PATH:$HOME/bin | ||
- arduino-cli core update-index | ||
- arduino-cli config init --additional-urls https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json | ||
- arduino-cli config dump | ||
- arduino-cli core update-index | ||
- arduino-cli core install STM32:stm32 | ||
- arduino-cli lib install LiquidCrystal | ||
- arduino-cli lib install "Analog Buttons" | ||
- arduino-cli lib install OneButton | ||
- sed -i '/recipe.output.tmp_file={build.project_name}.hex/d' "$HOME/.arduino15/packages/STM32/hardware/stm32/1.8.0/platform.txt" | ||
- sed -i '/recipe.output.save_file={build.project_name}.{build.variant}.hex/d' "$HOME/.arduino15/packages/STM32/hardware/stm32/1.8.0/platform.txt" | ||
install: | ||
- mkdir -p $HOME/Arduino/libraries | ||
- ln -s $PWD $HOME/Arduino/libraries/. | ||
|
||
addons: | ||
sonarcloud: | ||
organization: "makers-for-life" | ||
|
||
sudo: false | ||
cache: | ||
directories: | ||
- "$HOME/.sonar/cache/respirator-integration-test-HW1-dev" | ||
- "$HOME/.sonar/cache/respirator-integration-test-HW2-dev" | ||
- "$HOME/.sonar/cache/respirator-production-HW1-dev" | ||
- "$HOME/.sonar/cache/respirator-production-HW2-dev" | ||
- "$HOME/.sonar/cache/respirator-qualification-HW1-dev" | ||
- "$HOME/.sonar/cache/respirator-qualification-HW2-dev" | ||
script: | ||
- | | ||
if [[ $TRAVIS_PULL_REQUEST_SLUG == "" || $TRAVIS_PULL_REQUEST_SLUG == "makers-for-life/makair" ]]; then | ||
bash sonarcloud/build-and-analyse-all.sh | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# To add a new software, add the software slug name and the corresponding mode in following arrays | ||
softwareNames=("integration-test" "production" "qualification") | ||
softwareModes=("MODE_INTEGRATION_TEST" "MODE_PROD" "MODE_QUALIFICATION") | ||
|
||
# To add a new hardware version, add the hardware slug name and the corresponding version in the following arrays | ||
hardwareVersionNames=("HW1" "HW2") | ||
hardwareVersions=("1" "2") | ||
|
||
for softwareIndex in "${!softwareNames[@]}" | ||
do | ||
for hardwareIndex in "${!hardwareVersionNames[@]}" | ||
do | ||
export SOFTWARE_FULLNAME="respirator-${softwareNames[$softwareIndex]}-${hardwareVersionNames[$hardwareIndex]}-dev" | ||
export MODE=${softwareModes[$softwareIndex]} | ||
export HARDWARE_VERSION=${hardwareVersions[$hardwareIndex]} | ||
|
||
path="build/${SOFTWARE_FULLNAME}/bo" | ||
|
||
mkdir -p path | ||
|
||
arduino-cli cache clean | ||
build-wrapper-linux-x86-64 --out-dir "$path" bash sonarcloud/build.sh > /dev/null | ||
sonar-scanner -Dsonar.cfamily.cache.path="$HOME/.sonar/cache/${SOFTWARE_FULLNAME}" \ | ||
-Dsonar.projectKey="${SOFTWARE_FULLNAME}" \ | ||
-Dsonar.projectVersion=dev \ | ||
-Dsonar.sources=. \ | ||
-Dsonar.cfamily.build-wrapper-output="$path" \ | ||
-Dsonar.cfamily.cache.enabled=true \ | ||
-Dsonar.cfamily.threads=8 \ | ||
-Dsonar.scm.exclusions.disabled=true | ||
|
||
done | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
sed -Ei "s/#define HARDWARE_VERSION [0-9]+/#define HARDWARE_VERSION ${HARDWARE_VERSION}/" src/software/firmware/includes/config.h | ||
sed -Ei "s/#define MODE .+/#define MODE ${MODE}/" src/software/firmware/includes/config.h | ||
arduino-cli compile --build-path "$PWD/build/$SOFTWARE_FULLNAME" --fqbn STM32:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose src/software/firmware/srcs/respirator.cpp --output "src/software/firmware/output/$SOFTWARE_FULLNAME" |
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