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.login="\${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="\${{ secrets.SONAR_HOST_URL }}"
51 .\\.sonar\\scanner\\dotnet-sonarscanner end /d:sonar.login="\${{ 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: Gradle: build.gradle 1`] = `
234 id "org.sonarqube" version "3.5.0.2730"
239 property "sonar.projectKey", "my-project"
240 property "sonar.projectName", "MyProject"
245 exports[`should follow and complete all steps: Maven: .github/workflows/build.yml 1`] = `
253 types: [opened, synchronize, reopened]
258 runs-on: ubuntu-latest
260 - uses: actions/checkout@v2
262 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
263 - name: Set up JDK 11
264 uses: actions/setup-java@v1
267 - name: Cache SonarQube packages
268 uses: actions/cache@v1
271 key: \${{ runner.os }}-sonar
272 restore-keys: \${{ runner.os }}-sonar
273 - name: Cache Maven packages
274 uses: actions/cache@v1
277 key: \${{ runner.os }}-m2-\${{ hashFiles('**/pom.xml') }}
278 restore-keys: \${{ runner.os }}-m2
279 - name: Build and analyze
281 GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
282 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
283 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
284 run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'"
287 exports[`should follow and complete all steps: Other: .github/workflows/build.yml 1`] = `
295 types: [opened, synchronize, reopened]
300 runs-on: ubuntu-latest
302 - uses: actions/checkout@v2
304 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
305 - uses: sonarsource/sonarqube-scan-action@master
307 SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
308 SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
309 # If you wish to fail your job when the Quality Gate is red, uncomment the
310 # following lines. This would typically be used to fail a deployment.
311 # We do not recommend to use this in a pull request. Prefer using pull request
312 # decoration instead.
313 # - uses: sonarsource/sonarqube-quality-gate-action@master
316 # SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}"
319 exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
321 exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
323 exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
325 exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;