Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions eng/common/pipelines/templates/archetype-typespec-emitter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,19 @@ extends:
pool: ${{ parameters.Pool }}
jobs:
- job: Build
variables:
emitterNpmrcPath: $(Agent.TempDirectory)/${{ parameters.EmitterPackagePath }}/.npmrc
steps:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
Paths: ${{ parameters.SparseCheckoutPaths }}

- ${{ parameters.InitializationSteps }}

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(emitterNpmrcPath)

# Initialize-WorkingDirectory.ps1 is responsible for setting the emitterVersion output variable.
- task: PowerShell@2
displayName: 'Run initialize script'
Expand All @@ -126,6 +132,8 @@ extends:
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
-UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
env:
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)

- task: PowerShell@2
displayName: 'Run build script'
Expand All @@ -137,6 +145,8 @@ extends:
-TargetNpmJsFeed:$${{ parameters.PublishPublic }}
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
-GeneratorVersion: $(initialize.emitterVersion)
env:
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)

- pwsh: |
$sourceBranch = '$(Build.SourceBranch)'
Expand Down Expand Up @@ -288,6 +298,7 @@ extends:
pullRequestTargetBranch: 'main'
buildArtifactsPath: $(Pipeline.Workspace)/build_artifacts
branchName: $[stageDependencies.Build.Build.outputs['set_branch_name.branchName']]
tspClientNpmrcPath: $(Agent.TempDirectory)/tsp-client/.npmrc
pool: ${{ parameters.Pool }}
jobs:
- job: Initialize
Expand All @@ -302,10 +313,16 @@ extends:
- download: current
displayName: Download pipeline artifacts

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(tspClientNpmrcPath)

- pwsh: |
npm ci
displayName: Install tsp-client
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
env:
NPM_CONFIG_USERCONFIG: $(tspClientNpmrcPath)
- pwsh: |
# Resolve EmitterPackageJsonOutputPath to absolute path if it's relative
Expand All @@ -331,6 +348,8 @@ extends:
}
displayName: Generate emitter-package.json and emitter-package-lock files
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
env:
NPM_CONFIG_USERCONFIG: $(tspClientNpmrcPath)
- ${{ parameters.InitializationSteps }}

Expand Down Expand Up @@ -372,6 +391,7 @@ extends:
variables:
matrixArtifactsPath: $(Pipeline.Workspace)/matrix_artifacts
AzureSdkRepoName: $[format('azure-sdk/{0}', split(variables['Build.Repository.Name'], '/')[1])]
emitterNpmrcPath: $(Agent.TempDirectory)/${{ parameters.EmitterPackagePath }}/.npmrc
steps:
- checkout: self
- pwsh: |
Expand All @@ -390,6 +410,10 @@ extends:

- ${{ parameters.InitializationSteps }}

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(emitterNpmrcPath)

- task: PowerShell@2
displayName: Call regeneration script
inputs:
Expand All @@ -399,6 +423,8 @@ extends:
-PackageDirectoriesFile "$(matrixArtifactsPath)/$(DirectoryList)"
workingDirectory: $(Build.SourcesDirectory)
continueOnError: true
env:
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)

- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
parameters:
Expand Down Expand Up @@ -529,6 +555,7 @@ extends:
matrix: ${{ parameters.TestMatrix }}
variables:
buildArtifactsPath: $(Pipeline.Workspace)/build_artifacts
emitterNpmrcPath: $(Agent.TempDirectory)/${{ parameters.EmitterPackagePath }}/.npmrc
steps:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
Expand All @@ -540,6 +567,10 @@ extends:

- ${{ parameters.InitializationSteps }}

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(emitterNpmrcPath)

- task: PowerShell@2
displayName: 'Run initialize script'
inputs:
Expand All @@ -548,6 +579,8 @@ extends:
arguments: >
-BuildArtifactsPath '$(buildArtifactsPath)/lock-files'
-EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
env:
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)

- task: PowerShell@2
displayName: 'Run test script'
Expand All @@ -558,6 +591,8 @@ extends:
$(TestArguments)
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
-EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
env:
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)

- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
parameters:
Expand Down
Loading