-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathbuild.yml
More file actions
135 lines (111 loc) · 5.77 KB
/
build.yml
File metadata and controls
135 lines (111 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
parameters:
Artifacts: []
TestPipeline: false
ServiceDirectory: not-specified
IncludeRelease: true
steps:
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml
parameters:
PackageName: "@azure/template"
ServiceDirectory: "template"
TestPipeline: ${{ parameters.TestPipeline }}
- pwsh: |
$folder = "${{parameters.ServiceDirectory}}"
if ($folder -eq "*" -or $folder -eq "auto") { $folder = "" }
echo "##vso[task.setvariable variable=folder]$folder"
displayName: "Set folder variable for readme links"
# we are not passing service directory, so we only ever set dev build to true
- template: /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml
- script: |
npm install ./eng/tools/versioning
node eng/tools/versioning/set-dev.js --build-id "$(Build.BuildNumber)" --repo-root "$(Build.SourcesDirectory)"
node common/scripts/install-run-rush.js update
condition: and(succeeded(),eq(variables['SetDevVersion'],'true'))
displayName: "Update package versions for dev build"
- template: /eng/common/pipelines/templates/steps/save-package-properties.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
- script: |
node common/scripts/install-run-rush.js install
condition: and(succeeded(),ne(variables['SetDevVersion'],'true'))
displayName: "Install dependencies"
- template: /eng/pipelines/templates/steps/set-artifact-packages.yml
parameters:
PackageInfo: $(Build.ArtifactStagingDirectory)/PackageInfo
Artifacts: ${{ parameters.Artifacts }}
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) }}:
- task: AzureCLI@2
inputs:
azureSubscription: 'Azure SDK Artifacts'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az account show
expiry=`date -u -d "45 minutes" '+%Y-%m-%dT%H:%MZ'`
sasToken=$(az storage container generate-sas --account-name azuresdkartifacts --name azure-sdk-for-js-rush-cache --permissions dlrw --auth-mode login --as-user --expiry $expiry --https-only -o tsv)
echo "##vso[task.setvariable variable=rushBuildCacheCred;issecret=true;]$sasToken"
- pwsh: |
node eng/tools/rush-runner.js build $(ChangedServices) -packages "$(ArtifactPackageNames)" --verbose -p max
displayName: "Build libraries"
env:
${{ if and(eq(variables['System.TeamProject'], 'internal'), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) }}:
RUSH_BUILD_CACHE_CREDENTIAL: $(rushBuildCacheCred)
RUSH_BUILD_CACHE_WRITE_ALLOWED: 1
- script: |
node eng/tools/rush-runner.js build:samples "$(ChangedServices)" -packages "$(ArtifactPackageNames)" --verbose
displayName: "Build samples for PR"
- pwsh: |
eng/tools/check-api-warning.ps1
displayName: "Check api extractor output changes"
- script: |
node eng/tools/rush-runner.js pack "$(ChangedServices)" -packages "$(ArtifactPackageNames)" --verbose
displayName: "Pack libraries"
# Unlink node_modules folders to significantly improve performance of subsequent tasks
# which need to walk the directory tree (and are hardcoded to follow symlinks).
- script: |
node eng/tools/rush-runner.js unlink
displayName: "Unlink dependencies"
- template: ../steps/generate-doc.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
- pwsh: |
$artifacts = Get-ChildItem -Recurse -Force "$(Build.ArtifactStagingDirectory)/PackageInfo/*.json" `
| ForEach-Object { $_.Name.Replace(".json", "") }
foreach ($artifact in $artifacts)
{
$artifactDetails = Get-Content -Raw $(Build.ArtifactStagingDirectory)/PackageInfo/$artifact.json | ConvertFrom-Json
Write-Host "Copying $artifact artifacts to $(Build.ArtifactStagingDirectory)/$artifact"
New-Item -Type Directory -Force -Name $artifact -Path $(Build.ArtifactStagingDirectory) > $null
Copy-Item sdk/$($artifactDetails.Service)/**/$artifact-[0-9]*.[0-9]*.[0-9]*.tgz $(Build.ArtifactStagingDirectory)/$artifact
Copy-Item sdk/$($artifactDetails.Service)/**/browser/$artifact-[0-9]*.[0-9]*.[0-9]*.zip $(Build.ArtifactStagingDirectory)/$artifact
if ($${{ parameters.IncludeRelease }} -eq $true -and $artifactDetails.ArtifactDetails.skipPublishDocMs -ne $true)
{
New-Item -Type Directory -Force -Name documentation -Path $(Build.ArtifactStagingDirectory)/$artifact > $null
Copy-Item $(Build.SourcesDirectory)/docGen/$artifact.zip $(Build.ArtifactStagingDirectory)/$artifact/documentation
}
}
displayName: 'Copy Packages'
- pwsh: |
eng/scripts/stage-api-review-file.ps1 -PackageInfoPath $(Build.ArtifactStagingDirectory)/PackageInfo -StagingDirectory $(Build.ArtifactStagingDirectory)
displayName: 'Copy API extracted files'
- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/scripts/Generate-APIView-CodeFile.ps1
arguments: >
-ArtifactPath $(Build.ArtifactStagingDirectory)
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Create APIView code file
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
ArtifactPath: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'packages'
- template: /eng/common/pipelines/templates/steps/create-apireview.yml
parameters:
Artifacts: ${{ parameters.Artifacts }}
- template: /eng/common/pipelines/templates/steps/detect-api-changes.yml
parameters:
Artifacts: ${{ parameters.Artifacts }}
- template: /eng/common/pipelines/templates/steps/validate-all-packages.yml
parameters:
Artifacts: ${{ parameters.Artifacts }}