|
| 1 | +parameters: |
| 2 | + - name: ServiceDirectory |
| 3 | + type: string |
| 4 | + default: auto |
| 5 | + - name: Toolchain |
| 6 | + type: string |
| 7 | + default: stable |
| 8 | + - name: ArtifactSuffix |
| 9 | + type: string |
| 10 | + default: "linux" |
| 11 | + - name: PublishArtifacts |
| 12 | + type: boolean |
| 13 | + default: false |
| 14 | + - name: UnitTests |
| 15 | + type: boolean |
| 16 | + default: false |
| 17 | + - name: FunctionalTests |
| 18 | + type: boolean |
| 19 | + default: false |
| 20 | + - name: TestTimeoutInMinutes |
| 21 | + type: number |
| 22 | + default: 60 |
| 23 | + |
| 24 | +steps: |
| 25 | + - template: /eng/pipelines/templates/steps/use-rust.yml@self |
| 26 | + parameters: |
| 27 | + Toolchain: ${{ parameters.Toolchain }} |
| 28 | + |
| 29 | + - template: /eng/common/pipelines/templates/steps/set-default-branch.yml@self |
| 30 | + |
| 31 | + - script: | |
| 32 | + echo "##vso[build.addbuildtag]Scheduled" |
| 33 | + displayName: "Tag scheduled builds" |
| 34 | + condition: and(eq(variables['Build.SourceBranchName'], variables['DefaultBranch']), eq(variables['Build.Reason'],'Schedule')) |
| 35 | +
|
| 36 | + # now we need to call Save-Package-Properties so that we can filter on it |
| 37 | + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: |
| 38 | + - pwsh: | |
| 39 | + mkdir -p $(Build.ArtifactStagingDirectory)/diff |
| 40 | + displayName: Create PR Diff Folder |
| 41 | +
|
| 42 | + - pwsh: | |
| 43 | + $location = Join-Path "$(Build.ArtifactStagingDirectory)" "diff" |
| 44 | +
|
| 45 | + Write-Host "./eng/common/scripts/Generate-PR-Diff.ps1 -TargetPath `"$(Build.SourcesDirectory)`" -ArtifactPath `"$location`"" |
| 46 | + ./eng/common/scripts/Generate-PR-Diff.ps1 -TargetPath "$(Build.SourcesDirectory)" -ArtifactPath "$location" |
| 47 | + displayName: Generate PR Diff |
| 48 | +
|
| 49 | + - pwsh: | |
| 50 | + Write-Host "Freshly generated the PR diff:" |
| 51 | + Get-ChildItem -R -Force $(Build.ArtifactStagingDirectory)/diff | % { $_.FullName } |
| 52 | + cat $(Build.ArtifactStagingDirectory)/diff/diff.json |
| 53 | + displayName: Dump PR Diff |
| 54 | +
|
| 55 | + - task: Powershell@2 |
| 56 | + displayName: Save package properties filtered for PR |
| 57 | + inputs: |
| 58 | + filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1 |
| 59 | + arguments: > |
| 60 | + -PrDiff $(Build.ArtifactStagingDirectory)/diff/diff.json |
| 61 | + -OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo |
| 62 | + pwsh: true |
| 63 | + |
| 64 | + - ${{ else }}: |
| 65 | + - task: Powershell@2 |
| 66 | + displayName: Save package properties with dev version |
| 67 | + condition: and(succeeded(), eq(variables['SetDevVersion'],'true')) |
| 68 | + inputs: |
| 69 | + filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1 |
| 70 | + arguments: > |
| 71 | + -ServiceDirectory ${{parameters.ServiceDirectory}} |
| 72 | + -OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo |
| 73 | + -AddDevVersion |
| 74 | + pwsh: true |
| 75 | + - task: Powershell@2 |
| 76 | + displayName: Save package properties for service |
| 77 | + condition: and(succeeded(), ne(variables['SetDevVersion'],'true')) |
| 78 | + inputs: |
| 79 | + filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1 |
| 80 | + arguments: > |
| 81 | + -ServiceDirectory ${{parameters.ServiceDirectory}} |
| 82 | + -OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo |
| 83 | + pwsh: true |
| 84 | + |
| 85 | + - task: Powershell@2 |
| 86 | + displayName: "Test Packages" |
| 87 | + condition: and(succeeded(), ne(variables['NoPackagesChanged'],'true')) |
| 88 | + timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} |
| 89 | + env: |
| 90 | + CIBW_BUILD_VERBOSITY: 3 |
| 91 | + inputs: |
| 92 | + pwsh: true |
| 93 | + filePath: $(Build.SourcesDirectory)/eng/scripts/Test-Packages.ps1 |
| 94 | + arguments: > |
| 95 | + -PackageInfoPath '(Build.ArtifactStagingDirectory)/PackageInfo' |
| 96 | + -Toolchain '$(Toolchain)' |
| 97 | + -UnitTests $${{ parameters.UnitTests }} |
| 98 | + -FunctionalTests $${{ parameters.FunctionalTests }} |
| 99 | +
|
| 100 | + - ${{ if parameters.PublishArtifacts}}: |
| 101 | + - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml |
| 102 | + parameters: |
| 103 | + ArtifactPath: "$(Build.ArtifactStagingDirectory)" |
| 104 | + ArtifactName: "packages_${{ parameters.ArtifactSuffix }}" |
| 105 | + CustomCondition: and(succeeded(), ne(variables['NoPackagesChanged'],'true')) |
0 commit comments