diff --git a/build/azure-pr-pipeline.yaml b/build/azure-pr-pipeline.yaml new file mode 100644 index 000000000..fc8ff47c7 --- /dev/null +++ b/build/azure-pr-pipeline.yaml @@ -0,0 +1,138 @@ +name: $(Date:yyyyMMdd)$(Rev:.r) + +trigger: none + +pr: + autoCancel: true + branches: + include: + - dev + - avdunn/nimbus-removal + forks: + enabled: false + +schedules: + - cron: "0 23 * * *" + displayName: Daily dev build + branches: + include: + - dev + always: false + +variables: + skip.unit.tests: false + skip.integration.tests: false + system.debug: false + +pool: + vmImage: windows-2025 + +steps: + - checkout: self + clean: false + fetchDepth: 0 + fetchTags: false + + - task: DownloadSecureFile@1 + name: LabAuth + displayName: Download LabAuth certificate + inputs: + secureFile: 6cfea379-ebe1-4e95-b2b8-1b509a4e70c4 + retryCount: "8" + + - task: PowerShell@2 + displayName: Save certificate in store + inputs: + targetType: inline + script: | + $ErrorActionPreference = "Stop" + + Import-PfxCertificate ` + -FilePath "$(LabAuth.secureFilePath)" ` + -CertStoreLocation "Cert:\CurrentUser\My" ` + -Exportable + + - task: PowerShell@2 + displayName: Install Chrome and ChromeDriver + inputs: + targetType: inline + script: | + $ErrorActionPreference = "Stop" + + $installer = Join-Path $env:Agent_TempDirectory "chrome-installer.exe" + Invoke-WebRequest ` + -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" ` + -OutFile $installer + + Start-Process ` + -FilePath $installer ` + -ArgumentList "/silent", "/install" ` + -Wait + + $chromePath = "${env:ProgramFiles}\Google\Chrome\Application\chrome.exe" + $chromeVersion = (Get-Item $chromePath).VersionInfo.ProductVersion + $chromeBuild = ($chromeVersion.Split(".")[0..2] -join ".") + + Write-Host "Installed Chrome version: $chromeVersion" + + $driverVersion = Invoke-RestMethod ` + "https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_$chromeBuild" + + Write-Host "Using ChromeDriver version: $driverVersion" + + $zip = Join-Path $env:Agent_TempDirectory "chromedriver.zip" + $extract = Join-Path $env:Agent_TempDirectory "chromedriver" + + Invoke-WebRequest ` + -Uri "https://storage.googleapis.com/chrome-for-testing-public/$driverVersion/win64/chromedriver-win64.zip" ` + -OutFile $zip + + Expand-Archive -Path $zip -DestinationPath $extract -Force + Copy-Item ` + "$extract\chromedriver-win64\chromedriver.exe" ` + "C:\Windows\chromedriver.exe" ` + -Force + + - task: Maven@4 + displayName: Run unit tests + inputs: + mavenPomFile: pom.xml + goals: verify + options: >- + -fae + -Drevapi.failBuildOnProblemsFound=false + -Dskip.unit.tests=$(skip.unit.tests) + -Dskip.integration.tests=true + -Dadfs.disabled=true + publishJUnitResults: true + testResultsFiles: "**/surefire-reports/TEST-*.xml" + javaHomeOption: JDKVersion + jdkVersionOption: "1.8" + jdkArchitectureOption: x64 + + - task: Maven@4 + displayName: Run integration tests + inputs: + mavenPomFile: pom.xml + goals: verify + options: >- + -fae + -Drevapi.failBuildOnProblemsFound=false + -Dskip.unit.tests=true + -Dskip.integration.tests=$(skip.integration.tests) + -Dadfs.disabled=true + publishJUnitResults: true + testResultsFiles: "**/failsafe-reports/TEST-*.xml" + javaHomeOption: JDKVersion + jdkVersionOption: "1.8" + jdkArchitectureOption: x64 + + - task: PublishCodeCoverageResults@2 + displayName: Publish JaCoCo coverage + condition: succeededOrFailed() + inputs: + summaryFileLocation: >- + $(System.DefaultWorkingDirectory)\msal4j-sdk\target\site\jacoco\jacoco.xml + pathToSources: >- + $(System.DefaultWorkingDirectory)\msal4j-sdk\src\main\java + failIfCoverageEmpty: false