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
19 - uses: actions/checkout@v2
21 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
23 uses: actions/setup-java@v1
26 - name: Cache SonarQube packages
27 uses: actions/cache@v1
30 key: \${{ runner.os }}-sonar
31 restore-keys: \${{ runner.os }}-sonar
32 - name: Cache SonarQube scanner
33 id: cache-sonar-scanner
34 uses: actions/cache@v1
36 path: .\\.sonar\\scanner
37 key: \${{ runner.os }}-sonar-scanner
38 restore-keys: \${{ runner.os }}-sonar-scanner
39 - name: Install SonarQube scanner
40 if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
43 New-Item -Path .\\.sonar\\scanner -ItemType Directory
44 dotnet tool update dotnet-sonarscanner --tool-path .\\.sonar\\scanner
45 - name: Build and analyze
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>
70 - uses: actions/checkout@v2
72 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
73 - name: Download and install the build wrapper, build the project
76 curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-linux-x86.zip
77 unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
78 $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
80 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
82 - name: Download and install the SonarScanner
84 SONAR_SCANNER_VERSION: 5.0.1.3006
86 curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${{ env.SONAR_SCANNER_VERSION }}-linux.zip
87 unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
88 echo "$HOME/.sonar/sonar-scanner-\${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
90 - name: SonarQube analysis
92 sonar-scanner --define sonar.cfamily.build-wrapper-output=bw-output
94 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
95 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}"
98 exports[`should follow and complete all steps: CFamily MacOS: .github/workflows/build.yml 1`] = `
106 types: [opened, synchronize, reopened]
111 runs-on: <image ready for your build toolchain>
112 permissions: read-all
114 - uses: actions/checkout@v2
116 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
117 - name: Download and install the build wrapper
120 curl -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-macosx-x86.zip
121 unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/
123 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
125 - name: Download and install the SonarScanner
127 curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-macosx.zip
128 unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
130 - name: Build and analyse the project
132 # Potential improvement : add these paths to the PATH env var.
133 $HOME/.sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir bw-output <your clean build command>
134 $HOME/.sonar/sonar-scanner-5.0.1.3006-macosx/bin/sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output
136 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
137 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}"
140 exports[`should follow and complete all steps: CFamily Windows: .github/workflows/build.yml 1`] = `
148 types: [opened, synchronize, reopened]
153 runs-on: <image ready for your build toolchain>
154 permissions: read-all
156 - uses: actions/checkout@v2
158 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
159 - name: Download and install the build wrapper
162 $path = "$HOME/.sonar/build-wrapper-win-x86.zip"
164 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
165 (New-Object System.Net.WebClient).DownloadFile("\${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-win-x86.zip", $path)
166 Add-Type -AssemblyName System.IO.Compression.FileSystem
167 [System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
169 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
171 - name: Download and install the SonarScanner
174 $path = "$HOME/.sonar/sonar-scanner-cli-5.0.1.3006-windows.zip"
175 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
176 (New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-windows.zip", $path)
177 Add-Type -AssemblyName System.IO.Compression.FileSystem
178 [System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
180 - name: Build and analyse the project
183 $env:Path += ";$HOME/.sonar/build-wrapper-win-x86;$HOME/.sonar/sonar-scanner-5.0.1.3006-windows/bin"
184 build-wrapper-win-x86-64 --out-dir bw-output <your clean build command>
185 sonar-scanner.bat "-Dsonar.cfamily.build-wrapper-output=bw-output"
187 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
188 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}"
191 exports[`should follow and complete all steps: CFamily: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
193 exports[`should follow and complete all steps: Gradle: .github/workflows/build.yml 1`] = `
201 types: [opened, synchronize, reopened]
206 runs-on: ubuntu-latest
207 permissions: read-all
209 - uses: actions/checkout@v2
211 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
212 - name: Set up JDK 17
213 uses: actions/setup-java@v1
216 - name: Cache SonarQube packages
217 uses: actions/cache@v1
220 key: \${{ runner.os }}-sonar
221 restore-keys: \${{ runner.os }}-sonar
222 - name: Cache Gradle packages
223 uses: actions/cache@v1
225 path: ~/.gradle/caches
226 key: \${{ runner.os }}-gradle-\${{ hashFiles('**/*.gradle') }}
227 restore-keys: \${{ runner.os }}-gradle
228 - name: Build and analyze
230 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
231 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
232 run: ./gradlew build sonar --info"
235 exports[`should follow and complete all steps: Groovy: build.gradle 1`] = `
237 id "org.sonarqube" version "4.3.1.3277"
242 property "sonar.projectKey", "my-project"
243 property "sonar.projectName", "MyProject"
248 exports[`should follow and complete all steps: Kotlin: build.gradle.kts 1`] = `
250 id("org.sonarqube") version "4.3.1.3277"
255 property("sonar.projectKey", "my-project")
256 property("sonar.projectName", "MyProject")
261 exports[`should follow and complete all steps: Maven: .github/workflows/build.yml 1`] = `
269 types: [opened, synchronize, reopened]
274 runs-on: ubuntu-latest
275 permissions: read-all
277 - uses: actions/checkout@v2
279 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
280 - name: Set up JDK 17
281 uses: actions/setup-java@v1
284 - name: Cache SonarQube packages
285 uses: actions/cache@v1
288 key: \${{ runner.os }}-sonar
289 restore-keys: \${{ runner.os }}-sonar
290 - name: Cache Maven packages
291 uses: actions/cache@v1
294 key: \${{ runner.os }}-m2-\${{ hashFiles('**/pom.xml') }}
295 restore-keys: \${{ runner.os }}-m2
296 - name: Build and analyze
298 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
299 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
300 run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'"
303 exports[`should follow and complete all steps: Other: .github/workflows/build.yml 1`] = `
311 types: [opened, synchronize, reopened]
316 runs-on: ubuntu-latest
317 permissions: read-all
319 - uses: actions/checkout@v2
321 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
322 - uses: sonarsource/sonarqube-scan-action@master
324 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
325 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
326 # If you wish to fail your job when the Quality Gate is red, uncomment the
327 # following lines. This would typically be used to fail a deployment.
328 # We do not recommend to use this in a pull request. Prefer using pull request
329 # decoration instead.
330 # - uses: sonarsource/sonarqube-quality-gate-action@master
333 # SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}"
336 exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
338 exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
340 exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
342 exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;