|
17 | 17 | jobs: |
18 | 18 | build: |
19 | 19 | name: Build and analyze |
20 | | - runs-on: ubuntu-latest |
| 20 | + runs-on: self-hosted |
21 | 21 | container: ghcr.io/zephyrproject-rtos/ci:v0.27.4 |
22 | 22 | env: |
23 | 23 | BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed |
@@ -47,55 +47,69 @@ jobs: |
47 | 47 |
|
48 | 48 | - name: Install dependencies |
49 | 49 | run: | |
50 | | - pip install -r nrf/scripts/requirements-build.txt |
51 | | - apt-get update |
52 | | - apt install -y curl ruby-full |
| 50 | + # The Matter IDL is part of requirements-build.txt, but it's not available |
| 51 | + # in pypi so we need to install it from the source code |
| 52 | + MATTER_IDL_PATH=modules/lib/matter/scripts/py_matter_idl |
| 53 | + if [ -d $MATTER_IDL_PATH ]; then |
| 54 | + pip install -e $MATTER_IDL_PATH |
| 55 | + fi |
| 56 | + pip install -r nrf/scripts/requirements-fixed.txt |
| 57 | + apt-get update |
| 58 | + apt install -y curl ruby-full |
53 | 59 |
|
54 | | - - name: Install sonar-scanner and build-wrapper |
55 | | - uses: SonarSource/sonarcloud-github-c-cpp@v3 |
| 60 | + - name: Install Build Wrapper |
| 61 | + uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6.0.0 |
56 | 62 |
|
57 | 63 | - name: Build and test |
58 | 64 | working-directory: thingy91x-oob |
59 | 65 | run: | |
60 | | - build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} west twister -T . -C --coverage-platform=native_sim -v --inline-logs --integration |
| 66 | + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} \ |
| 67 | + west twister -T tests/ \ |
| 68 | + --enable-coverage \ |
| 69 | + --coverage-platform=native_sim \ |
| 70 | + -v \ |
| 71 | + --inline-logs \ |
| 72 | + --integration |
61 | 73 |
|
62 | 74 | - name: Extract coverage into sonarqube xml format |
63 | 75 | working-directory: thingy91x-oob |
64 | 76 | run: | |
65 | 77 | gcovr twister-out -v --merge-mode-functions=separate --exclude='twister-out|drivers' --sonarqube coverage.xml |
66 | 78 |
|
67 | | - - name: Run sonar-scanner on main |
68 | | - working-directory: thingy91x-oob |
| 79 | + - name: SonarQube Scan on main |
69 | 80 | if: github.event_name != 'pull_request' |
| 81 | + uses: SonarSource/sonarqube-scan-action@v6.0.0 |
70 | 82 | env: |
71 | 83 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
72 | 84 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
73 | | - run: | |
74 | | - sonar-scanner \ |
75 | | - --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ |
76 | | - --define project.settings=sonar-project.properties \ |
77 | | - --define sonar.coverageReportPaths=coverage.xml \ |
78 | | - --define sonar.inclusions=**/*.c,**/*.h \ |
| 85 | + with: |
| 86 | + args: | |
| 87 | + --define sonar.cfamily.build-wrapper-output=thingy91x-oob/${{ env.BUILD_WRAPPER_OUT_DIR }} |
| 88 | + --define sonar.projectKey=hello-nrfcloud_firmware |
| 89 | + --define sonar.organization=hello-nrfcloud-com-firmware |
| 90 | + --define sonar.host.url=https://sonarcloud.io |
| 91 | + --define sonar.coverageReportPaths=coverage.xml |
| 92 | + --define sonar.inclusions=**/*.c,**/*.h |
79 | 93 | --define sonar.exclusions=tests/,drivers/sensor/*_dummy/ |
| 94 | + projectBaseDir: thingy91x-oob |
80 | 95 |
|
81 | | - - name: Run sonar-scanner on PR |
82 | | - working-directory: thingy91x-oob |
| 96 | + - name: SonarQube Scan on PR |
83 | 97 | if: github.event_name == 'pull_request' |
| 98 | + uses: SonarSource/sonarqube-scan-action@v6.0.0 |
84 | 99 | env: |
85 | 100 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
86 | 101 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
87 | | - PR_NUMBER: ${{ github.event.pull_request.number }} |
88 | | - PR_BRANCH: ${{ github.event.pull_request.head.ref }} |
89 | | - BASE_REF: ${{ github.event.pull_request.base.ref }} |
90 | | - HEAD_SHA: ${{ github.event.pull_request.head.sha }} |
91 | | - run: | |
92 | | - sonar-scanner \ |
93 | | - --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ |
94 | | - --define project.settings=sonar-project.properties \ |
95 | | - --define sonar.coverageReportPaths=coverage.xml \ |
96 | | - --define sonar.inclusions=**/*.c,**/*.h \ |
97 | | - --define sonar.exclusions=tests/,drivers/sensor/*_dummy/ \ |
98 | | - --define sonar.scm.revision=${{ env.HEAD_SHA }} \ |
99 | | - --define sonar.pullrequest.key=${{ env.PR_NUMBER }} \ |
100 | | - --define sonar.pullrequest.branch=${{ env.PR_BRANCH }} \ |
101 | | - --define sonar.pullrequest.base=${{ env.BASE_REF }} |
| 102 | + with: |
| 103 | + args: | |
| 104 | + --define sonar.cfamily.build-wrapper-output=thingy91x-oob/${{ env.BUILD_WRAPPER_OUT_DIR }} |
| 105 | + --define sonar.projectKey=hello-nrfcloud_firmware |
| 106 | + --define sonar.organization=hello-nrfcloud-com-firmware |
| 107 | + --define sonar.host.url=https://sonarcloud.io |
| 108 | + --define sonar.coverageReportPaths=coverage.xml |
| 109 | + --define sonar.inclusions=**/*.c,**/*.h |
| 110 | + --define sonar.exclusions=tests/,drivers/sensor/*_dummy/ |
| 111 | + --define sonar.scm.revision=${{ github.event.pull_request.head.sha }} |
| 112 | + --define sonar.pullrequest.key=${{ github.event.pull_request.number }} |
| 113 | + --define sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} |
| 114 | + --define sonar.pullrequest.base=${{ github.event.pull_request.base.ref }} |
| 115 | + projectBaseDir: thingy91x-oob |
0 commit comments