1 // Jest Snapshot v1, https://goo.gl/fbAQLP
3 exports[`should follow and complete all steps: .NET: .github/workflows/build.yml 1`] = `
11 types: [opened, synchronize, reopened]
16 runs-on: windows-latest
18 - uses: actions/checkout@v2
20 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
22 uses: actions/setup-java@v1
25 - name: Cache SonarQube packages
26 uses: actions/cache@v1
29 key: \${{ runner.os }}-sonar
30 restore-keys: \${{ runner.os }}-sonar
31 - name: Cache SonarQube scanner
32 id: cache-sonar-scanner
33 uses: actions/cache@v1
35 path: .\\.sonar\\scanner
36 key: \${{ runner.os }}-sonar-scanner
37 restore-keys: \${{ runner.os }}-sonar-scanner
38 - name: Install SonarQube scanner
39 if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
42 New-Item -Path .\\.sonar\\scanner -ItemType Directory
43 dotnet tool update dotnet-sonarscanner --tool-path .\\.sonar\\scanner
44 - name: Build and analyze
46 GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
49 .\\.sonar\\scanner\\dotnet-sonarscanner begin /k:"my-project" /d:sonar.token="\${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="\${{ secrets.SONAR_HOST_URL }}"
51 .\\.sonar\\scanner\\dotnet-sonarscanner end /d:sonar.token="\${{ secrets.SONAR_TOKEN }}""
54 exports[`should follow and complete all steps: CFamily Linux: .github/workflows/build.yml 1`] = `
62 types: [opened, synchronize, reopened]
67 runs-on: <image ready for your build toolchain>
69 - uses: actions/checkout@v2
71 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
72 - name: Download and install the build wrapper, build the project
75 curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-linux-x86.zip
76 unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
77 $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
79 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
81 - name: Download and install the SonarScanner
83 SONAR_SCANNER_VERSION: 4.6.2.2472
85 curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${{ env.SONAR_SCANNER_VERSION }}-linux.zip
86 unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
87 echo "$HOME/.sonar/sonar-scanner-\${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
89 - name: SonarQube analysis
91 sonar-scanner --define sonar.cfamily.build-wrapper-output=bw-output
93 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
94 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}"
97 exports[`should follow and complete all steps: CFamily MacOS: .github/workflows/build.yml 1`] = `
105 types: [opened, synchronize, reopened]
110 runs-on: <image ready for your build toolchain>
112 - uses: actions/checkout@v2
114 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
115 - name: Download and install the build wrapper
118 curl -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-macosx-x86.zip
119 unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/
121 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
123 - name: Download and install the SonarScanner
125 curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip
126 unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
128 - name: Build and analyse the project
130 # Potential improvement : add these paths to the PATH env var.
131 $HOME/.sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir bw-output <your clean build command>
132 $HOME/.sonar/sonar-scanner-4.6.2.2472-macosx/bin/sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output
134 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
135 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}"
138 exports[`should follow and complete all steps: CFamily Windows: .github/workflows/build.yml 1`] = `
146 types: [opened, synchronize, reopened]
151 runs-on: <image ready for your build toolchain>
153 - uses: actions/checkout@v2
155 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
156 - name: Download and install the build wrapper
159 $path = "$HOME/.sonar/build-wrapper-win-x86.zip"
161 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
162 (New-Object System.Net.WebClient).DownloadFile("\${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-win-x86.zip", $path)
163 Add-Type -AssemblyName System.IO.Compression.FileSystem
164 [System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
166 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
168 - name: Download and install the SonarScanner
171 $path = "$HOME/.sonar/sonar-scanner-cli-4.6.2.2472-windows.zip"
172 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
173 (New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-windows.zip", $path)
174 Add-Type -AssemblyName System.IO.Compression.FileSystem
175 [System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
177 - name: Build and analyse the project
180 $env:Path += ";$HOME/.sonar/build-wrapper-win-x86;$HOME/.sonar/sonar-scanner-4.6.2.2472-windows/bin"
181 build-wrapper-win-x86-64 --out-dir bw-output <your clean build command>
182 sonar-scanner.bat "-Dsonar.cfamily.build-wrapper-output=bw-output"
184 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
185 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}"
188 exports[`should follow and complete all steps: CFamily: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
190 exports[`should follow and complete all steps: Gradle: .github/workflows/build.yml 1`] = `
198 types: [opened, synchronize, reopened]
203 runs-on: ubuntu-latest
205 - uses: actions/checkout@v2
207 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
208 - name: Set up JDK 11
209 uses: actions/setup-java@v1
212 - name: Cache SonarQube packages
213 uses: actions/cache@v1
216 key: \${{ runner.os }}-sonar
217 restore-keys: \${{ runner.os }}-sonar
218 - name: Cache Gradle packages
219 uses: actions/cache@v1
221 path: ~/.gradle/caches
222 key: \${{ runner.os }}-gradle-\${{ hashFiles('**/*.gradle') }}
223 restore-keys: \${{ runner.os }}-gradle
224 - name: Build and analyze
226 GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
227 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
228 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
229 run: ./gradlew build sonar --info"
232 exports[`should follow and complete all steps: Groovy: build.gradle 1`] = `
234 id "org.sonarqube" version "4.2.1.3168"
239 property "sonar.projectKey", "my-project"
240 property "sonar.projectName", "MyProject"
245 exports[`should follow and complete all steps: Kotlin: build.gradle.kts 1`] = `
247 id("org.sonarqube") version "4.2.1.3168"
252 property("sonar.projectKey", "my-project")
253 property("sonar.projectName", "MyProject")
258 exports[`should follow and complete all steps: Maven: .github/workflows/build.yml 1`] = `
266 types: [opened, synchronize, reopened]
271 runs-on: ubuntu-latest
273 - uses: actions/checkout@v2
275 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
276 - name: Set up JDK 11
277 uses: actions/setup-java@v1
280 - name: Cache SonarQube packages
281 uses: actions/cache@v1
284 key: \${{ runner.os }}-sonar
285 restore-keys: \${{ runner.os }}-sonar
286 - name: Cache Maven packages
287 uses: actions/cache@v1
290 key: \${{ runner.os }}-m2-\${{ hashFiles('**/pom.xml') }}
291 restore-keys: \${{ runner.os }}-m2
292 - name: Build and analyze
294 GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
295 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
296 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
297 run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'"
300 exports[`should follow and complete all steps: Other: .github/workflows/build.yml 1`] = `
308 types: [opened, synchronize, reopened]
313 runs-on: ubuntu-latest
315 - uses: actions/checkout@v2
317 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
318 - uses: sonarsource/sonarqube-scan-action@master
320 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
321 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
322 # If you wish to fail your job when the Quality Gate is red, uncomment the
323 # following lines. This would typically be used to fail a deployment.
324 # We do not recommend to use this in a pull request. Prefer using pull request
325 # decoration instead.
326 # - uses: sonarsource/sonarqube-quality-gate-action@master
329 # SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}"
332 exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
334 exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
336 exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
338 exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;