diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index 912424330..76beadda8 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -14,11 +14,11 @@ trigger: include: - src/* exclude: + - .gradle/wrapper - .gitignore - CONTRIBUTING.md - LICENSE - THIRD PARTY NOTICES - - build.gradle - gradle.properties - gradlew - gradlew.bat @@ -29,85 +29,12 @@ trigger: pr: none pool: - vmImage: 'windows-latest' + vmImage: windows-latest steps: -- checkout: self - clean: true - fetchDepth: 1 - -- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 - displayName: 'Run CredScan' - inputs: - debugMode: false - -- task: DownloadSecureFile@1 - inputs: - secureFile: 'local.properties' - -- task: DownloadSecureFile@1 - inputs: - secureFile: 'secring.gpg' - -- task: DownloadSecureFile@1 - inputs: - secureFile: 'secring.gpg.lock' - -- task: CopyFiles@2 - inputs: - SourceFolder: '$(Agent.TempDirectory)' - Contents: '**' - TargetFolder: '$(System.DefaultWorkingDirectory)' - -- task: Gradle@2 - inputs: - gradleWrapperFile: 'gradlew' - tasks: 'build' - publishJUnitResults: true - testResultsFiles: '**/TEST-*.xml' - javaHomeOption: 'JDKVersion' - sonarQubeRunAnalysis: false - -- task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: 'JaCoCo' - summaryFileLocation: $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml - pathToSources: $(System.DefaultWorkingDirectory)/src/main/java - failIfCoverageEmpty: true - -- task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - -- task: CopyFiles@2 - inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)' - Contents: | - **/libs/* - build/generated-pom.xml - build/generated-pom.xml.asc - build.gradle - gradlew - gradlew.bat - settings.gradle - gradle.properties - **/gradle/** - Scripts/** - TargetFolder: '$(Build.ArtifactStagingDirectory)/' - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'drop' - publishLocation: 'Container' - -- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0 - displayName: 'Graph Client Tooling pipeline fail notification' - inputs: - addressType: serviceEndpoint - serviceEndpointName: 'microsoftgraph pipeline status' - title: '$(Build.DefinitionName) failure notification' - text: 'This pipeline has failed. View the build details for further information. This is a blocking failure.' - condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) - enabled: true +- template: templates/checkout-and-credscan.yml +- template: templates/install-java.yml +- template: templates/secure-files.yml +- template: templates/build-and-coverage.yml +- template: templates/publish-artefacts.yml +- template: templates/alert-failure.yml diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 10a10ed3e..4a486e925 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -6,12 +6,12 @@ pr: branches: include: - - master - - main - dev + - main + - master + - feature/v2 paths: exclude: - - .azure-pipelines - .gradle/wrapper - .gitignore - CONTRIBUTING.md @@ -26,45 +26,11 @@ pr: trigger: none # disable triggers based on commits. -variables: - PACKAGE_NAME: 'microsoft-graph-core' - PROPERTIES_PATH: '.\gradle.properties' - -pool: +pool: vmImage: windows-latest steps: -- checkout: self - clean: true - fetchDepth: 1 - -- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 - displayName: 'Run CredScan' - inputs: - debugMode: false - -- task: Gradle@2 - inputs: - gradleWrapperFile: 'gradlew' - tasks: 'build' - publishJUnitResults: true - testResultsFiles: '**/TEST-*.xml' - javaHomeOption: 'JDKVersion' - sonarQubeRunAnalysis: false - -- task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: 'JaCoCo' - summaryFileLocation: $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml - pathToSources: $(System.DefaultWorkingDirectory)/src/main/java - failIfCoverageEmpty: true - -- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0 - displayName: 'Graph Client Tooling pipeline fail notification' - inputs: - addressType: serviceEndpoint - serviceEndpointName: 'microsoftgraph pipeline status' - title: '$(Build.DefinitionName) failure notification' - text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' - condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) - enabled: true +- template: templates/checkout-and-credscan.yml +- template: templates/install-java.yml +- template: templates/build-and-coverage.yml +- template: templates/alert-failure.yml diff --git a/.azure-pipelines/templates/alert-failure.yml b/.azure-pipelines/templates/alert-failure.yml new file mode 100644 index 000000000..51f2043d0 --- /dev/null +++ b/.azure-pipelines/templates/alert-failure.yml @@ -0,0 +1,10 @@ +steps: +- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0 + displayName: 'Graph Client Tooling pipeline fail notification' + inputs: + addressType: serviceEndpoint + serviceEndpointName: 'microsoftgraph pipeline status' + title: '$(Build.DefinitionName) failure notification' + text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' + condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) + enabled: true \ No newline at end of file diff --git a/.azure-pipelines/templates/build-and-coverage.yml b/.azure-pipelines/templates/build-and-coverage.yml new file mode 100644 index 000000000..9a56fac54 --- /dev/null +++ b/.azure-pipelines/templates/build-and-coverage.yml @@ -0,0 +1,16 @@ +steps: +- task: Gradle@2 + inputs: + gradleWrapperFile: 'gradlew' + tasks: 'build' + publishJUnitResults: true + testResultsFiles: '**/TEST-*.xml' + javaHomeOption: 'JDKVersion' + sonarQubeRunAnalysis: false + +- task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: 'JaCoCo' + summaryFileLocation: $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml + pathToSources: $(System.DefaultWorkingDirectory)/src/main/java + failIfCoverageEmpty: true \ No newline at end of file diff --git a/.azure-pipelines/templates/checkout-and-credscan.yml b/.azure-pipelines/templates/checkout-and-credscan.yml new file mode 100644 index 000000000..cc5c7c2f5 --- /dev/null +++ b/.azure-pipelines/templates/checkout-and-credscan.yml @@ -0,0 +1,9 @@ +steps: +- checkout: self + clean: true + fetchDepth: 1 + +- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 + displayName: 'Run CredScan' + inputs: + debugMode: false \ No newline at end of file diff --git a/.azure-pipelines/templates/install-java.yml b/.azure-pipelines/templates/install-java.yml new file mode 100644 index 000000000..d739611a5 --- /dev/null +++ b/.azure-pipelines/templates/install-java.yml @@ -0,0 +1,11 @@ +steps: +- pwsh: 'Invoke-WebRequest -Uri https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7/OpenJDK15U-jdk_x64_windows_hotspot_15.0.2_7.zip -OutFile OpenJDK.zip' + displayName: 'Download JDK' + +- task: JavaToolInstaller@0 + inputs: + versionSpec: '15' + jdkArchitectureOption: 'x64' + jdkSourceOption: 'LocalDirectory' + jdkFile: 'OpenJDK.zip' + jdkDestinationDirectory: 'binaries' \ No newline at end of file diff --git a/.azure-pipelines/templates/publish-artefacts.yml b/.azure-pipelines/templates/publish-artefacts.yml new file mode 100644 index 000000000..5715208b2 --- /dev/null +++ b/.azure-pipelines/templates/publish-artefacts.yml @@ -0,0 +1,21 @@ +steps: +- task: CopyFiles@2 + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: | + **/libs/* + build/generated-pom.xml + build/generated-pom.xml.asc + build.gradle + gradlew + gradlew.bat + settings.gradle + gradle.properties + **/gradle/** + Scripts/** + TargetFolder: '$(Build.ArtifactStagingDirectory)/' + +- task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: drop' + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' \ No newline at end of file diff --git a/.azure-pipelines/templates/secure-files.yml b/.azure-pipelines/templates/secure-files.yml new file mode 100644 index 000000000..0cdeb85b9 --- /dev/null +++ b/.azure-pipelines/templates/secure-files.yml @@ -0,0 +1,18 @@ +steps: +- task: DownloadSecureFile@1 + inputs: + secureFile: 'local.properties' + +- task: DownloadSecureFile@1 + inputs: + secureFile: 'secring.gpg' + +- task: DownloadSecureFile@1 + inputs: + secureFile: 'secring.gpg.lock' + +- task: CopyFiles@2 + inputs: + SourceFolder: '$(Agent.TempDirectory)' + Contents: '**' + TargetFolder: '$(System.DefaultWorkingDirectory)' \ No newline at end of file