123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- // Jest Snapshot v1, https://goo.gl/fbAQLP
-
- exports[`should follow and complete all steps: .NET: bitbucket-pipelines.yml 1`] = `
- "image: mcr.microsoft.com/dotnet/sdk:7.0
-
- definitions:
- steps:
- - step: &build-step
- name: SonarQube analysis
- caches:
- - dotnetcore
- - sonar
- script:
- - apt-get update
- - apt-get install --yes --no-install-recommends openjdk-17-jre
- - dotnet tool install --global dotnet-sonarscanner
- - export PATH="$PATH:/root/.dotnet/tools"
- - dotnet sonarscanner begin /k:"my-project" /d:"sonar.token=\${SONAR_TOKEN}" /d:"sonar.host.url=\${SONAR_HOST_URL}"
- - dotnet build
- - dotnet sonarscanner end /d:"sonar.token=\${SONAR_TOKEN}"
- caches:
- sonar: ~/.sonar
-
- pipelines:
- branches:
- '{main}':
- - step: *build-step
-
- pull-requests:
- '**':
- - step: *build-step"
- `;
-
- exports[`should follow and complete all steps: CFamily: bitbucket-pipelines.yml 1`] = `
- "image: <image ready for your build toolchain>
-
- definitions:
- steps:
- - step: &build-step
- name: Build the project, and run the SonarQube analysis
- script:
- - export SONAR_SCANNER_VERSION=5.0.1.3006
- - mkdir $HOME/.sonar
- - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip
- - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-\${SONAR_SCANNER_VERSION}-linux.zip
- - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- - export PATH="$PATH:$HOME/.sonar/sonar-scanner-\${SONAR_SCANNER_VERSION}-linux/bin"
- - <any step required before running your build, like ./configure>
- - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
- - sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output
- caches:
- sonar: ~/.sonar
-
- clone:
- depth: full
-
- pipelines:
- branches:
- '{main}':
- - step: *build-step
-
- pull-requests:
- '**':
- - step: *build-step"
- `;
-
- exports[`should follow and complete all steps: CFamily: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
-
- exports[`should follow and complete all steps: Gradle: bitbucket-pipelines.yml 1`] = `
- "image: eclipse-temurin:17
-
- definitions:
- steps:
- - step: &build-step
- name: SonarQube analysis
- caches:
- - gradle
- - sonar
- script:
- - bash ./gradlew sonar
- caches:
- sonar: ~/.sonar
-
- clone:
- depth: full
-
- pipelines:
- branches:
- '{main}':
- - step: *build-step
-
- pull-requests:
- '**':
- - step: *build-step"
- `;
-
- exports[`should follow and complete all steps: Groovy: build.gradle 1`] = `
- "plugins {
- id "org.sonarqube" version "5.0.0.4638"
- }
-
- sonar {
- properties {
- property "sonar.projectKey", "my-project"
- property "sonar.projectName", "MyProject"
- }
- }"
- `;
-
- exports[`should follow and complete all steps: Kotlin: build.gradle.kts 1`] = `
- "plugins {
- id("org.sonarqube") version "5.0.0.4638"
- }
-
- sonar {
- properties {
- property("sonar.projectKey", "my-project")
- property("sonar.projectName", "MyProject")
- }
- }"
- `;
-
- exports[`should follow and complete all steps: Maven: bitbucket-pipelines.yml 1`] = `
- "image: maven:3-eclipse-temurin-17
-
- definitions:
- steps:
- - step: &build-step
- name: SonarQube analysis
- caches:
- - maven
- - sonar
- script:
- - mvn verify sonar:sonar -Dsonar.projectKey=my-project -Dsonar.projectName='MyProject'
- caches:
- sonar: ~/.sonar
-
- clone:
- depth: full
-
- pipelines:
- branches:
- '{main}':
- - step: *build-step
-
- pull-requests:
- '**':
- - step: *build-step"
- `;
-
- exports[`should follow and complete all steps: Other: .github/workflows/build.yml 1`] = `
- "image: maven:3.3.9
-
- definitions:
- steps:
- - step: &build-step
- name: SonarQube analysis
- script:
- - pipe: sonarsource/sonarqube-scan:2.0.1
- variables:
- SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable.
- SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here.
- caches:
- sonar: ~/.sonar
-
- clone:
- depth: full
-
- pipelines:
- branches:
- '{main}':
- - step: *build-step
-
- pull-requests:
- '**':
- - step: *build-step
- "
- `;
-
- exports[`should follow and complete all steps: Other: sonar-project.properties 1`] = `"sonar.projectKey=my-project"`;
-
- exports[`should follow and complete all steps: sonar token key 1`] = `"SONAR_TOKEN"`;
-
- exports[`should follow and complete all steps: sonarqube host url key 1`] = `"SONAR_HOST_URL"`;
-
- exports[`should follow and complete all steps: sonarqube host url value 1`] = `"http://localhost:9000"`;
|