Skip to content
36 changes: 25 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ variables:
value: $(Build.Arcade.ArtifactsPath)TestResults/$(_BuildConfig)/
- name: Build.Arcade.VSIXOutputPath
value: $(Build.Arcade.ArtifactsPath)VSIX
- name: _WindowsBuildScript
value: $(Build.SourcesDirectory)/build.cmd -ci -NativeToolsOnMachine

# Enable extraction of published outputs for analysis
- name: GDN_EXTRACT_TOOLS
Expand Down Expand Up @@ -125,14 +127,19 @@ variables:
value: true

# Enable source index only for main branch builds
- ${{ if and(ne(variables['runAsPublic'], 'true'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- name: enableSourceIndex
value: true
- ${{ else }}:
- name: enableSourceIndex
value: false
- name: sourceIndexBuildCommand
value: $(Build.SourcesDirectory)/build.cmd -ci -NativeToolsOnMachine
- name: sourceIndexCondition
value: |
and(
succeeded(),
or(
eq(variables['forceEnableSourceIndex'], 'true'),
and(
ne(variables['runAsPublic'], 'true'),
notin(variables['Build.Reason'], 'PullRequest'),
eq(variables['Build.SourceBranch'], 'refs/heads/main')
)
)
)
Comment thread
jjonescz marked this conversation as resolved.

resources:
repositories:
Expand Down Expand Up @@ -175,9 +182,16 @@ extends:
manifests: true
enableMicrobuild: true
enableTelemetry: true
enableSourceIndex: ${{ variables['enableSourceIndex'] }}
enableSourceIndex: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that it will enable source index updating even for PRs now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the condition just moved (because I needed it to depend on a runtime variable forceEnableSourceIndex for testing, and ${{ }} can only use compile time variables).

sourceIndexParams:
sourceIndexBuildCommand: ${{ variables['sourceIndexBuildCommand'] }}
condition: ${{ variables['sourceIndexCondition'] }}
sourceIndexBuildCommand: ''
Comment thread
jjonescz marked this conversation as resolved.
preSteps:
- template: /eng/pipelines/templates/RestoreAndBuild.yml
parameters:
buildScript: $(_WindowsBuildScript)
buildConfig: Debug
repoLogPath: $(Build.SourcesDirectory)/artifacts/log/Debug
runAsPublic: ${{ variables['runAsPublic'] }}
# Publish test logs
enablePublishTestResults: true
Expand All @@ -201,7 +215,7 @@ extends:
os: windows

variables:
- _buildScript: $(Build.SourcesDirectory)/build.cmd -ci -NativeToolsOnMachine
- _buildScript: $(_WindowsBuildScript)

templateContext:
outputs:
Expand Down
35 changes: 6 additions & 29 deletions eng/pipelines/templates/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,12 @@ parameters:
default: false

steps:
- task: NodeTool@0
displayName: Add NodeJS/npm
inputs:
versionSpec: "20.x"
checkLatest: true

- script: ${{ parameters.buildScript }}
-restore
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/restore.binlog
displayName: Restore

- pwsh: |
$(Build.SourcesDirectory)/scripts/Slngen.ps1 -All -NoLaunch
displayName: Create solution

- script: ${{ parameters.buildScript }}
-restore
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/restore2.binlog
displayName: Restore solution

- script: ${{ parameters.buildScript }}
-build
-configuration ${{ parameters.buildConfig }}
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/build.binlog
$(_OfficialBuildIdArgs)
displayName: Build
- template: /eng/pipelines/templates/RestoreAndBuild.yml
parameters:
buildScript: ${{ parameters.buildScript }}
buildConfig: ${{ parameters.buildConfig }}
repoLogPath: ${{ parameters.repoLogPath }}
warnAsError: ${{ parameters.warnAsError }}

- ${{ if ne(parameters.skipTests, 'true') }}:
- script: $(Build.SourcesDirectory)/.dotnet/dotnet dotnet-coverage collect
Expand Down
41 changes: 41 additions & 0 deletions eng/pipelines/templates/RestoreAndBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
parameters:
- name: buildScript
type: string
- name: buildConfig
type: string
- name: repoLogPath
type: string
- name: warnAsError
type: number
default: 1

steps:
- task: NodeTool@0
displayName: Add NodeJS/npm
inputs:
versionSpec: "20.x"
checkLatest: true

- script: ${{ parameters.buildScript }}
-restore
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/restore.binlog
displayName: Restore

- pwsh: |
$(Build.SourcesDirectory)/scripts/Slngen.ps1 -All -NoLaunch
displayName: Create solution

- script: ${{ parameters.buildScript }}
-restore
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/restore2.binlog
displayName: Restore solution

- script: ${{ parameters.buildScript }}
-build
-configuration ${{ parameters.buildConfig }}
-warnAsError ${{ parameters.warnAsError }}
/bl:${{ parameters.repoLogPath }}/build.binlog
$(_OfficialBuildIdArgs)
Comment thread
jjonescz marked this conversation as resolved.
displayName: Build
Loading