Skip to content

Commit e2505e3

Browse files
committed
Integrate some static code analysis
1 parent c61c84b commit e2505e3

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,71 @@ jobs:
55
build:
66
runs-on: ubuntu-latest
77
container:
8+
# could use a container with sq tools already installed
89
image: infinitecoding/platformio-for-ci:latest
910
steps:
1011
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
1112
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1215

1316
- name: Prepare output directories
1417
run: mkdir bin
1518

19+
- name: Install SonarQube dependencies
20+
run: |
21+
mkdir -p sonarqube
22+
cd sonarqube
23+
wget --no-verbose https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
24+
unzip -qq build-wrapper-linux-x86.zip
25+
wget --no-verbose https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.5.0.2216-linux.zip
26+
unzip -qq sonar-scanner-cli-4.5.0.2216-linux.zip
27+
cd ..
28+
mkdir sonarqube-out
29+
1630
- name: Build firmware
17-
run: platformio ci --build-dir="./bin" --keep-build-dir --project-conf=platformio.ini ./OpenBikeSensorFirmware/
31+
run: |
32+
./sonarqube/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sonarqube-out \
33+
platformio ci --build-dir="./bin" --keep-build-dir --project-conf=platformio.ini ./OpenBikeSensorFirmware/
34+
35+
- name: Cache SonarCloud packages
36+
uses: actions/cache@v1
37+
with:
38+
path: ~/.sonar/cache
39+
key: ${{ runner.os }}-sonar
40+
restore-keys: ${{ runner.os }}-sonar
41+
42+
- name: SonarQube
43+
env:
44+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
./sonarqube/sonar-scanner-4.5.0.2216-linux/bin/sonar-scanner \
48+
-Dsonar.host.url=https://sonarcloud.io \
49+
-Dsonar.organization=friends-of-openbikesensor \
50+
-Dsonar.projectKey=Friends-of-OpenBikeSensor_OpenBikeSensorFirmware \
51+
-Dsonar.sources=. \
52+
-Dsonar.sourceEncoding=UTF-8 \
53+
-Dsonar.cfamily.cache.enabled=false \
54+
-Dsonar.cfamily.threads=1 \
55+
-Dsonar.cfamily.build-wrapper-output=sonarqube-out
56+
57+
58+
# super-lint:
59+
# # Name the Job
60+
# name: Lint code base
61+
# # Set the type of machine to run on
62+
# runs-on: ubuntu-latest
63+
64+
# steps:
65+
# # Checks out a copy of your repository on the ubuntu-latest machine
66+
# - name: Checkout code
67+
# uses: actions/checkout@v2
68+
69+
# Runs the Super-Linter action
70+
# - name: Run Super-Linter
71+
# uses: github/super-linter@v3
72+
# env:
73+
# DEFAULT_BRANCH: master
74+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
# FILTER_REGEX_EXCLUDE: .*/\.idea/.*

0 commit comments

Comments
 (0)