diff --git a/tools/devops/automation/templates/build/download-artifacts.yml b/tools/devops/automation/templates/build/download-artifacts.yml index 35fb2c8999..b53cc861c0 100644 --- a/tools/devops/automation/templates/build/download-artifacts.yml +++ b/tools/devops/automation/templates/build/download-artifacts.yml @@ -19,7 +19,7 @@ steps: testPrefix: sim runTests: ${{ parameters.runTests }} -- ${{ if and(eq(parameters.enableAPIDiff, true), eq(variables['APIDIFF_BUILT'], 'True')) }}: +- ${{ if eq(parameters.enableAPIDiff, true) }}: # Download the Html Report that was added by the tests job. - task: DownloadPipelineArtifact@2 displayName: 'Download API diff (from stable)' @@ -34,10 +34,9 @@ steps: archiveFilePatterns: '$(System.DefaultWorkingDirectory)/Reports/apidiff-stable/apidiff-stable.zip' destinationFolder: '$(System.DefaultWorkingDirectory)/apidiff-stable' -- ${{ if and(eq(parameters.enableAPIDiff, true), eq(variables['API_GENERATOR_BUILT'], 'True')) }}: +- ${{ if eq(parameters.enableAPIDiff, true) }}: - task: DownloadPipelineArtifact@2 displayName: 'Download API & Generator comparison' - condition: and(succeeded(), contains(variables.API_GENERATOR_DIFF_BUILT, 'True')) inputs: patterns: 'apicomparison/apicomparison.zip' allowFailedBuilds: true @@ -45,7 +44,6 @@ steps: - task: ExtractFiles@1 displayName: 'Extract API & Generator comparison' - condition: and(succeeded(), contains(variables.API_GENERATOR_DIFF_BUILT, 'True')) inputs: archiveFilePatterns: '$(System.DefaultWorkingDirectory)/Reports/apicomparison/apicomparison.zip' destinationFolder: '$(System.DefaultWorkingDirectory)/apicomparison' diff --git a/tools/devops/automation/templates/build/stage.yml b/tools/devops/automation/templates/build/stage.yml index 85a05a44b3..ff05fc7643 100644 --- a/tools/devops/automation/templates/build/stage.yml +++ b/tools/devops/automation/templates/build/stage.yml @@ -192,26 +192,28 @@ jobs: enableDotnet: ${{ parameters.enableDotnet }} sbomFilter: '*.nupkg;*.pkg;*.msi' -- job: upload_vsdrops - displayName: 'Upload API diff to VSDrops' - timeoutInMinutes: 1000 - dependsOn: # can start as soon as the tests are done and the api diff - - build - - api_diff - condition: succeededOrFailed() +- ${{ if eq(parameters.enableAPIDiff, true) }}: + - job: upload_vsdrops + displayName: 'Upload API diff to VSDrops' + timeoutInMinutes: 1000 + dependsOn: # can start as soon as the tests are done and the api diff + - build + - api_diff + condition: succeededOrFailed() - variables: - API_GENERATOR_DIFF_BUILT: $[ dependencies.api_diff.outputs['apiGeneratorDiff.API_GENERATOR_BUILT'] ] + variables: + API_GENERATOR_DIFF_BUILT: $[ dependencies.api_diff.outputs['apiGeneratorDiff.API_GENERATOR_BUILT'] ] - pool: - vmImage: 'windows-latest' - workspace: - clean: all - steps: - - template: upload-vsdrops.yml - parameters: - testPrefix: sim - runTests: ${{ parameters.runTests }} + pool: + vmImage: 'windows-latest' + workspace: + clean: all + steps: + - template: upload-vsdrops.yml + parameters: + testPrefix: sim + runTests: ${{ parameters.runTests }} + enableAPIDiff: ${{ parameters.enableAPIDiff }} - job: publish_html @@ -220,9 +222,10 @@ jobs: dependsOn: # has to wait for the tests to be done AND the data to be uploaded - configure - build - - api_diff - upload_azure_blob - upload_vsdrops + - ${{ if eq(parameters.enableAPIDiff, true) }}: + - api_diff condition: succeededOrFailed() variables: # Define the variable FOO from the previous job @@ -230,11 +233,12 @@ jobs: BUILD_PACKAGE: $[ dependencies.configure.outputs['labels.build-package'] ] TESTS_BOT: $[ dependencies.build.outputs['runTests.TESTS_BOT'] ] TESTS_JOBSTATUS: $[ dependencies.build.outputs['runTests.TESTS_JOBSTATUS'] ] - APIDIFF_MESSAGE: $[ dependencies.api_diff.outputs['apidiff.APIDIFF_MESSAGE'] ] - APIDIFF_BUILT: $[ dependencies.api_diff.outputs['apidiff.APIDIFF_BUILT'] ] - API_GENERATOR_DIFF_BUILT: $[ dependencies.api_diff.outputs['apiGeneratorDiff.API_GENERATOR_BUILT'] ] - API_GENERATOR_DIFF_STATUS_MESSAGE: $[ dependencies.api_diff.outputs['apiGeneratorDiff.API_GENERATOR_DIFF_STATUS_MESSAGE'] ] PR_ID: $[ dependencies.configure.outputs['labels.pr-number'] ] + ${{ if eq(parameters.enableAPIDiff, true) }}: + APIDIFF_MESSAGE: $[ dependencies.api_diff.outputs['apidiff.APIDIFF_MESSAGE'] ] + APIDIFF_BUILT: $[ dependencies.api_diff.outputs['apidiff.APIDIFF_BUILT'] ] + API_GENERATOR_DIFF_BUILT: $[ dependencies.api_diff.outputs['apiGeneratorDiff.API_GENERATOR_BUILT'] ] + API_GENERATOR_DIFF_STATUS_MESSAGE: $[ dependencies.api_diff.outputs['apiGeneratorDiff.API_GENERATOR_DIFF_STATUS_MESSAGE'] ] pool: vmImage: 'windows-latest' workspace: diff --git a/tools/devops/automation/templates/build/upload-vsdrops.yml b/tools/devops/automation/templates/build/upload-vsdrops.yml index 53cea12024..07b9e27a42 100644 --- a/tools/devops/automation/templates/build/upload-vsdrops.yml +++ b/tools/devops/automation/templates/build/upload-vsdrops.yml @@ -10,12 +10,21 @@ parameters: type: boolean default: true +- name: enableAPIDiff + type: boolean + default: true + steps: - checkout: self persistCredentials: true path: s/xamarin-macios +- template: download-artifacts.yml + parameters: + runTests: false # we do not run tests on builds + enableAPIDiff: ${{ parameters.enableAPIDiff }} + # Upload the API diff to vsdrops to be able to locate it - task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0 displayName: 'Publish API diff to Artifact Services Drop'