Skip to content

Commit 9dc84b1

Browse files
committed
ci: adds TS annotations augmentations
Signed-off-by: Vincent Biret <[email protected]>
1 parent c4aae9f commit 9dc84b1

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ variables:
159159
cleanOpenAPIFileBetaOutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/openapi/beta/'
160160
cleanMetadataFileV1OutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/clean_v10_metadata/'
161161
cleanMetadataFileBetaOutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/clean_beta_metadata/'
162+
metadataTypeSpecAnnotationsSource: '$(Build.SourcesDirectory)/msgraph-metadata/additions/'
162163
cleanMetadataFolderBeta: 'clean_beta_metadata'
163164
cleanMetadataFolderV1: 'clean_v10_metadata'
164165
cleanOpenAPIFolderBeta: 'clean_beta_openapi'
@@ -218,6 +219,7 @@ stages:
218219
cleanMetadataFile: $(cleanMetadataFileV1)
219220
cleanMetadataFolder: $(cleanMetadataFolderV1)
220221
cleanMetadataFileWithAnnotations: $(cleanMetadataFileWithAnnotationsV1)
222+
metadataTypeSpecAnnotationsSource: $(metadataTypeSpecAnnotationsSource)
221223

222224
# Same description as stage_v1_metadata
223225
- stage: stage_beta_metadata
@@ -236,6 +238,7 @@ stages:
236238
cleanMetadataFile: $(cleanMetadataFileBeta)
237239
cleanMetadataFolder: $(cleanMetadataFolderBeta)
238240
cleanMetadataFileWithAnnotations: $(cleanMetadataFileWithAnnotationsBeta)
241+
metadataTypeSpecAnnotationsSource: $(metadataTypeSpecAnnotationsSource)
239242

240243
- stage: stage_v1_openapi
241244
dependsOn: stage_v1_metadata

.azure-pipelines/generation-templates/capture-metadata.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ parameters:
2222
- name: 'cleanMetadataFileWithAnnotations'
2323
type: string
2424
default: $(cleanMetadataFileWithAnnotationsV1)
25+
- name: 'metadataTypeSpecAnnotationsSource'
26+
type: string
27+
default: $(metadataTypeSpecAnnotationsSource)
28+
- name: 'metadataTypeSpecAnnotationsOutputDir'
29+
type: string
30+
default: 'tsp-output'
31+
- name: metadataAnnotationsCopyScriptPath
32+
type: string
33+
default: '$(metadataTypeSpecAnnotationsSource)/../scripts/copy-annotations-to-csdl.ps1'
34+
35+
variables:
36+
sanitizedEndpoint: $[replace(parameters['endpoint'], '/', ''))]
2537

2638
steps:
2739

@@ -57,6 +69,23 @@ steps:
5769
parameters:
5870
version: '8.x'
5971

72+
# required for TypeSpec
73+
- task: UseNode@1
74+
inputs:
75+
versionSpec: '22.x'
76+
checkLatest: true
77+
78+
- pwsh: 'npm install -g @typespec/compiler typescript'
79+
displayName: 'install TypeSpec and TypeScript globally'
80+
81+
- pwsh: 'npm ci'
82+
displayName: 'install TypeSpec dependencies'
83+
workingDirectory: '$(metadataTypeSpecAnnotationsSource)'
84+
85+
- pwsh: 'tsc compile .'
86+
displayName: 'compile TypeSpec annotations'
87+
workingDirectory: '$(metadataTypeSpecAnnotationsSource)'
88+
6089
## Only run if the previous step was successful
6190
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
6291
env:
@@ -70,6 +99,8 @@ steps:
7099
endpointVersion: ${{ parameters.endpoint }}
71100
displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata'
72101

102+
- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"'
103+
73104
## Only run if the previous step was successful
74105
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
75106
env:
@@ -85,6 +116,8 @@ steps:
85116
OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations'
86117
displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations'
87118

119+
- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"'
120+
88121
## Only run if the previous step was successful
89122
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
90123
env:
@@ -101,6 +134,9 @@ steps:
101134
OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors'
102135
displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information'
103136

137+
- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"'
138+
139+
104140
# publish metadata as an artifact
105141
- task: CopyFiles@2
106142
inputs:

0 commit comments

Comments
 (0)