From 32acc380ea96b205c24181cac190261e27600b48 Mon Sep 17 00:00:00 2001 From: chandu Date: Wed, 11 Dec 2024 14:38:00 +0530 Subject: [PATCH] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..e8748ada3 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,52 @@ +trigger: +- main # Adjust to your branch name + +pool: + vmImage: 'ubuntu-latest' + +variables: + - group: springpetclinic + +steps: +- task: JavaToolInstaller@0 + inputs: + versionSpec: '17' # Specify the desired JDK version + jdkArchitectureOption: 'x64' # Choose architecture (x64 or x86) + jdkSourceOption: 'PreInstalled' # Use PreInstalled if available + displayName: 'Install Java 17' + +- task: Maven@4 + inputs: + mavenPomFile: 'pom.xml' + options: '-B' + goals: 'clean package' + displayName: 'Maven Compile' + +- task: SonarCloudPrepare@3 + inputs: + SonarCloud: 'SONAR_CLOUD_1' # Replace with your SonarCloud service connection name + organization: '$(SONAR_ORGANIZATION)' # Replace with your SonarCloud organization name + scannerMode: 'CLI' + configMode: 'manual' + cliProjectKey: '$(SONAR_PROJECT_KEY)' # Replace with your SonarCloud project key + cliProjectName: '$(SONAR_PROJECT)' # Replace with your SonarCloud project name + cliProjectVersion: '1.0' + extraProperties: | + sonar.java.binaries=target/classes + sonar.sources=src/main/java + sonar.tests=src/test/java + sonar.junit.reportPaths=target/surefire-reports + sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml + displayName: 'Prepare analysis on SonarCloud' + +- task: Maven@4 + inputs: + mavenPomFile: 'pom.xml' + goals: 'verify sonar:sonar' + options: '-Dsonar.login=$(SONAR_TOKEN)' + displayName: 'Run SonarCloud Analysis' + +- task: SonarCloudPublish@3 + inputs: + pollingTimeoutSec: '300' + displayName: 'Publish Quality Gate Result'