|
| 1 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +# Licensed under the MIT License. |
| 3 | + |
| 4 | +# Push trigger on `main` exists primarily to populate the Azure Pipelines |
| 5 | +# target-dir and CARGO_HOME cache scopes for the default branch. PR-triggered |
| 6 | +# runs are branch-scoped on writes and cannot populate `main`'s scope; they |
| 7 | +# can only *read* from it as a fallback. Without a `main` trigger, the |
| 8 | +# 1ES `cacheOptions.enableTargetCache: true` configuration in |
| 9 | +# `Rust.Build.Job.yml` runs every PR with a cold target dir — the |
| 10 | +# auto-generated wildcard restore key (visible in the `🎯 Cache target |
| 11 | +# directory` task log as `…|Rust=<ver>|**`) finds no prior entry in |
| 12 | +# main's scope, so each PR build does a fully cold cargo compile |
| 13 | +# (~14 min on x64 WXC). |
| 14 | +# |
| 15 | +# After this trigger is enabled, the first push to `main` populates the |
| 16 | +# cache; every subsequent PR's restore step finds it via that wildcard |
| 17 | +# fallback and the cargo build step drops to a few minutes. |
| 18 | +# |
| 19 | +# Docs-only commits to `main` don't need to rebuild the whole workspace, |
| 20 | +# so the path exclusion list here matches the one added to the `pr:` |
| 21 | +# trigger in PR #396 (kept in sync intentionally — if that PR lands and |
| 22 | +# the lists drift, reconcile them). |
| 23 | +trigger: |
| 24 | + branches: |
| 25 | + include: |
| 26 | + - main |
| 27 | + paths: |
| 28 | + exclude: |
| 29 | + - 'docs/**' |
| 30 | + - 'tests/examples/**' |
| 31 | + - '.github/ISSUE_TEMPLATE/**' |
| 32 | + - '.github/PULL_REQUEST_TEMPLATE.md' |
| 33 | + - '.github/copilot-instructions.md' |
| 34 | + - '.github/instructions/**' |
| 35 | + - '**/*.md' |
| 36 | + - '.editorconfig' |
| 37 | + |
| 38 | +name: $(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) |
| 39 | + |
| 40 | +pr: |
| 41 | + branches: |
| 42 | + include: |
| 43 | + - main |
| 44 | + - feature/* |
| 45 | + - user/* |
| 46 | + # Skip the full build pipeline when a PR only touches documentation / |
| 47 | + # non-shipping content. Any change outside this exclusion list still |
| 48 | + # triggers the pipeline as before. Keep this list conservative — exclude |
| 49 | + # only paths that cannot possibly affect built artifacts or test behavior. |
| 50 | + paths: |
| 51 | + exclude: |
| 52 | + - 'docs/**' |
| 53 | + - 'tests/examples/**' |
| 54 | + - '.github/ISSUE_TEMPLATE/**' |
| 55 | + - '.github/PULL_REQUEST_TEMPLATE.md' |
| 56 | + - '.github/copilot-instructions.md' |
| 57 | + - '.github/instructions/**' |
| 58 | + - '**/*.md' |
| 59 | + - '.editorconfig' |
| 60 | + |
| 61 | +resources: |
| 62 | + repositories: |
| 63 | + - repository: 1ESPipelineTemplates |
| 64 | + type: git |
| 65 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 66 | + ref: refs/tags/release |
| 67 | + |
| 68 | +parameters: |
| 69 | + - name: officialBuild |
| 70 | + displayName: Build Official or Unofficial |
| 71 | + type: string |
| 72 | + default: Unofficial |
| 73 | + values: |
| 74 | + - Official |
| 75 | + - Unofficial |
| 76 | + |
| 77 | + - name: debug |
| 78 | + displayName: Enable debug output for SDK tests |
| 79 | + type: boolean |
| 80 | + default: false |
| 81 | + |
| 82 | + # Reused by Rust/Mac/NpmSdk templates. Values come from MXC-ESRP-Signing |
| 83 | + # on Official runs; sign steps are gated, so missing values on Unofficial |
| 84 | + # runs are harmless. |
| 85 | + - name: ESRPInfo |
| 86 | + type: object |
| 87 | + default: |
| 88 | + serviceName: $(serviceName) |
| 89 | + tenantId: $(tenantId) |
| 90 | + azureKeyVaultName: $(azureKeyVaultName) |
| 91 | + authCertName: $(authCertName) |
| 92 | + signCertName: $(signCertName) |
| 93 | + clientId: $(clientId) |
| 94 | + |
| 95 | +variables: |
| 96 | + # Prevents failure when no Rust tests are found; pipeline runs will still fail if present |
| 97 | + # tests do not pass. |
| 98 | + - name: NEXTEST_NO_TESTS |
| 99 | + value: pass |
| 100 | + - ${{ if eq(parameters.officialBuild, 'Official') }}: |
| 101 | + - group: MXC-ESRP-Signing |
| 102 | + |
| 103 | +extends: |
| 104 | + template: v1/1ES.${{parameters.officialBuild}}.PipelineTemplate.yml@1ESPipelineTemplates |
| 105 | + parameters: |
| 106 | + pool: |
| 107 | + name: Azure-Pipelines-1ESPT-ExDShared |
| 108 | + image: windows-2022 |
| 109 | + os: windows |
| 110 | + |
| 111 | + customBuildTags: |
| 112 | + - ES365AIMigrationTooling |
| 113 | + |
| 114 | + stages: |
| 115 | + - stage: Build_Binaries |
| 116 | + displayName: 'Build Executables' |
| 117 | + jobs: |
| 118 | + |
| 119 | + # Build Binaries for all targets in parallel |
| 120 | + - template: .azure-pipelines/templates/Rust.Build.Job.yml@self |
| 121 | + parameters: |
| 122 | + isOfficialBuild: ${{ eq(parameters.officialBuild, 'Official') }} |
| 123 | + matrix: |
| 124 | + - name: windows_x64 |
| 125 | + os: windows |
| 126 | + arch: x64 |
| 127 | + component: WXC |
| 128 | + - name: windows_arm64 |
| 129 | + os: windows |
| 130 | + arch: arm64 |
| 131 | + component: WXC |
| 132 | + - name: linux_x64 |
| 133 | + os: linux |
| 134 | + arch: x64 |
| 135 | + component: LXC |
| 136 | + - name: linux_arm64 |
| 137 | + os: linux |
| 138 | + arch: arm64 |
| 139 | + component: LXC |
| 140 | + |
| 141 | + ESRPInfo: ${{ parameters.ESRPInfo }} |
| 142 | + |
| 143 | + # macOS uses a separate template because it runs on a different |
| 144 | + # pool (Microsoft-hosted). The produced artifact name follows the same |
| 145 | + # scheme (mxc-binaries-<triplet>) so Package_MXC_NPM_SDK can consume it. |
| 146 | + - template: .azure-pipelines/templates/Mac.Build.Job.yml@self |
| 147 | + parameters: |
| 148 | + isOfficialBuild: ${{ eq(parameters.officialBuild, 'Official') }} |
| 149 | + ESRPInfo: ${{ parameters.ESRPInfo }} |
| 150 | + |
| 151 | + - stage: Package_MXC |
| 152 | + displayName: 'Package MXC' |
| 153 | + dependsOn: Build_Binaries |
| 154 | + jobs: |
| 155 | + - template: .azure-pipelines/templates/Package.NpmSdk.Job.yml@self |
| 156 | + parameters: |
| 157 | + targets: |
| 158 | + - artifact: wxc-binaries-x86_64-pc-windows-msvc |
| 159 | + sdkArch: x64 |
| 160 | + - artifact: wxc-binaries-aarch64-pc-windows-msvc |
| 161 | + sdkArch: arm64 |
| 162 | + - artifact: lxc-binaries-x86_64-unknown-linux-gnu |
| 163 | + sdkArch: x64 |
| 164 | + - artifact: lxc-binaries-aarch64-unknown-linux-gnu |
| 165 | + sdkArch: arm64 |
| 166 | + - artifact: mxc-binaries-aarch64-apple-darwin |
| 167 | + sdkArch: arm64 |
| 168 | + |
| 169 | + ESRPInfo: ${{ parameters.ESRPInfo }} |
| 170 | + |
| 171 | + - template: .azure-pipelines/templates/Mxc.Binary.Packaging.Job.yml@self |
| 172 | + |
| 173 | + - stage: Lint |
| 174 | + displayName: 'Lint' |
| 175 | + dependsOn: [] |
| 176 | + jobs: |
| 177 | + - template: .azure-pipelines/templates/Lint.Job.yml@self |
| 178 | + |
| 179 | + - stage: SDK_Unit_Tests |
| 180 | + displayName: 'SDK Unit Tests' |
| 181 | + dependsOn: [] |
| 182 | + jobs: |
| 183 | + - template: .azure-pipelines/templates/SDK.Unit.Test.Job.yml@self |
| 184 | + parameters: |
| 185 | + debug: ${{ parameters.debug }} |
| 186 | + |
| 187 | + - stage: SDK_Integration_Tests |
| 188 | + displayName: 'SDK Integration Tests' |
| 189 | + dependsOn: Package_MXC |
| 190 | + jobs: |
| 191 | + - template: .azure-pipelines/templates/SDK.Integration.Test.Job.yml@self |
| 192 | + parameters: |
| 193 | + debug: ${{ parameters.debug }} |
0 commit comments