|
5 | 5 | build: |
6 | 6 | runs-on: ubuntu-latest |
7 | 7 | container: |
| 8 | + # could use a container with sq tools already installed |
8 | 9 | image: infinitecoding/platformio-for-ci:latest |
9 | 10 | steps: |
10 | 11 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
11 | 12 | - uses: actions/checkout@v2 |
| 13 | + with: |
| 14 | + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
12 | 15 |
|
13 | 16 | - name: Prepare output directories |
14 | 17 | run: mkdir bin |
15 | 18 |
|
| 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 | +
|
16 | 30 | - 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