From ed0b989e3f70df50a1c997ca6403a054288a6ffb Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 15:29:45 -0700 Subject: [PATCH 1/4] migrate --- .pipelines/v2/templates/stages-cs.yml | 16 ++++------------ .pipelines/v2/templates/stages-js.yml | 12 +++--------- .pipelines/v2/templates/stages-python.yml | 16 ++++------------ .pipelines/v2/templates/steps-build-linux.yml | 7 ++----- .pipelines/v2/templates/steps-build-macos.yml | 7 ++----- .pipelines/v2/templates/steps-build-windows.yml | 7 ++----- 6 files changed, 17 insertions(+), 48 deletions(-) diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index c271dda13..645fea58f 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -129,9 +129,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' @@ -159,9 +157,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_winml.nativeArtifact }}' @@ -192,9 +188,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' @@ -230,9 +224,7 @@ stages: fi git lfs install displayName: 'Install git-lfs (macOS)' - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-cs.yml parameters: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' diff --git a/.pipelines/v2/templates/stages-js.yml b/.pipelines/v2/templates/stages-js.yml index e434f7c74..867bf0c1b 100644 --- a/.pipelines/v2/templates/stages-js.yml +++ b/.pipelines/v2/templates/stages-js.yml @@ -198,9 +198,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-js.yml parameters: rid: 'win-x64' @@ -224,9 +222,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-js.yml parameters: rid: 'linux-x64' @@ -259,9 +255,7 @@ stages: fi git lfs install displayName: 'Install git-lfs (macOS)' - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-js.yml parameters: rid: 'osx-arm64' diff --git a/.pipelines/v2/templates/stages-python.yml b/.pipelines/v2/templates/stages-python.yml index 7a07c7dae..495a31f9e 100644 --- a/.pipelines/v2/templates/stages-python.yml +++ b/.pipelines/v2/templates/stages-python.yml @@ -178,9 +178,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-base-win-x64' @@ -204,9 +202,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-base-linux-x64' @@ -239,9 +235,7 @@ stages: fi git lfs install displayName: 'Install git-lfs (macOS)' - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-base-osx-arm64' @@ -336,9 +330,7 @@ stages: steps: - checkout: self clean: true - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared + - checkout: test-data-shared - template: steps-test-python.yml parameters: wheelDir: '$(Pipeline.Workspace)/python-sdk-winml-win-x64' diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index b16b13fdd..efc5a3f21 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -43,10 +43,7 @@ steps: displayName: 'Append version define' - ${{ if eq(parameters.runTests, true) }}: - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared - basePath: '$(Agent.BuildDirectory)' + - checkout: test-data-shared - bash: | set -euo pipefail @@ -66,7 +63,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg - FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared + FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)/test-data-shared - bash: | echo "=== vcpkg buildtrees error logs ===" diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index 278bdbff8..e360cbee2 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -51,10 +51,7 @@ steps: displayName: 'Append version define' - ${{ if eq(parameters.runTests, true) }}: - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared - basePath: '$(Agent.BuildDirectory)' + - checkout: test-data-shared - bash: | set -euo pipefail @@ -74,7 +71,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg - FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)/test-data-shared + FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)/test-data-shared - bash: | echo "=== vcpkg buildtrees error logs ===" diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 0e17f07b6..b62b2bf48 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -78,10 +78,7 @@ steps: # Tests need shared model files. - ${{ if eq(parameters.runTests, true) }}: - - template: ../../templates/checkout-steps.yml@self - parameters: - repoName: test-data-shared - basePath: '$(Agent.BuildDirectory)' + - checkout: test-data-shared - ${{ if and(eq(parameters.arch, 'x64'), eq(parameters.useWinml, false)) }}: - script: >- @@ -143,7 +140,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg - FOUNDRY_TEST_DATA_DIR: $(Agent.BuildDirectory)\test-data-shared + FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)\test-data-shared # Stage the redistributable native artifacts. # - Standard build: vcpkg statically links ORT/GenAI/azure-*/spdlog/fmt/ From 5519b46570cbf8abcd58fa587941e938d5025f17 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 15:34:01 -0700 Subject: [PATCH 2/4] sdl --- .pipelines/foundry-local-packaging.yml | 7 +++++++ sdk_v2/DEVELOPMENT.md | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/.pipelines/foundry-local-packaging.yml b/.pipelines/foundry-local-packaging.yml index bedd8a3d1..ad07a975c 100644 --- a/.pipelines/foundry-local-packaging.yml +++ b/.pipelines/foundry-local-packaging.yml @@ -70,6 +70,10 @@ resources: type: git name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release + - repository: test-data-shared + type: git + name: AIFoundryLocal/test-data-shared + ref: refs/heads/main extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates @@ -81,6 +85,9 @@ extends: name: onnxruntime-Win-CPU-2022 os: windows sdl: + sourceRepositoriesToScan: + exclude: + - repository: test-data-shared binskim: break: false scanOutputDirectoryOnly: true diff --git a/sdk_v2/DEVELOPMENT.md b/sdk_v2/DEVELOPMENT.md index bc8afb6c2..6ce486d48 100644 --- a/sdk_v2/DEVELOPMENT.md +++ b/sdk_v2/DEVELOPMENT.md @@ -69,6 +69,11 @@ install per-SDK package dependencies on first run: | Python | `python -m pip install -e .[dev]` (compiles the cffi extension; needs MSVC/Clang) → `python -m pytest test/`. | | JS | `npm install` (runs `node-gyp` against the C++ build output) → `npm run build` → `npm test` (vitest). | +In CI, the shared `test-data-shared` cache is checked out from +`AIFoundryLocal/test-data-shared` in the same ADO org that runs the Foundry +Local Packaging pipeline, so sdk_v2 jobs no longer depend on the older +`windows.ai.toolkit` org path. + ## Common knobs ```powershell From 890599a5845630f5ec09636451bf8b6c80f7e68b Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 15:50:47 -0700 Subject: [PATCH 3/4] copilit --- .pipelines/v2/templates/stages-cs.yml | 2 +- .pipelines/v2/templates/steps-build-linux.yml | 11 ++++--- .pipelines/v2/templates/steps-build-macos.yml | 11 ++++--- .../v2/templates/steps-build-windows.yml | 23 +++++++------- .pipelines/v2/templates/steps-test-cs.yml | 20 +++++++++++-- .pipelines/v2/templates/steps-test-js.yml | 30 ++++++++++++++----- .pipelines/v2/templates/steps-test-python.yml | 16 +++++++++- 7 files changed, 82 insertions(+), 31 deletions(-) diff --git a/.pipelines/v2/templates/stages-cs.yml b/.pipelines/v2/templates/stages-cs.yml index 645fea58f..6ffa2354f 100644 --- a/.pipelines/v2/templates/stages-cs.yml +++ b/.pipelines/v2/templates/stages-cs.yml @@ -230,4 +230,4 @@ stages: flNugetDir: '$(Pipeline.Workspace)/${{ parameters._config_base.nativeArtifact }}' isWinML: false testDataSharedDir: '$(Build.SourcesDirectory)/test-data-shared' - additionalTestArgs: '--settings $(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/sequential.runsettings' + additionalTestArgs: '--settings $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cs/test/FoundryLocal.Tests/sequential.runsettings' diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index efc5a3f21..ab32317ba 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -32,6 +32,9 @@ steps: includeOrtGpuLinux: true shell: bash +- checkout: self + clean: true + # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. - bash: | @@ -51,7 +54,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -60,10 +63,10 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg - FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)/test-data-shared + FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)/Foundry-Local/test-data-shared - bash: | echo "=== vcpkg buildtrees error logs ===" @@ -82,7 +85,7 @@ steps: # side); test/example binaries are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' + src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index e360cbee2..b6f2f892f 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -40,6 +40,9 @@ steps: includeWinml: false shell: bash +- checkout: self + clean: true + # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. - bash: | @@ -59,7 +62,7 @@ steps: --config ${{ parameters.buildConfig }} \ --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg @@ -68,10 +71,10 @@ steps: set -euo pipefail python3 build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)/vcpkg - FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)/test-data-shared + FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)/Foundry-Local/test-data-shared - bash: | echo "=== vcpkg buildtrees error logs ===" @@ -87,7 +90,7 @@ steps: # are not part of the redistributable surface. - bash: | set -euo pipefail - src='$(Build.SourcesDirectory)/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' + src='$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin' dst='$(Build.ArtifactStagingDirectory)/native' mkdir -p "$dst" diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index b62b2bf48..1f8e4a660 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -63,6 +63,9 @@ steps: includeWinml: ${{ parameters.useWinml }} shell: pwsh +- checkout: self + clean: true + # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version (e.g. 0.1.0-dev.202605111234) instead of the cmake default. - task: PowerShell@2 @@ -88,7 +91,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -102,7 +105,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64, WinML)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -115,7 +118,7 @@ steps: --cmake_generator "Visual Studio 17 2022" --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -129,7 +132,7 @@ steps: --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile, WinML)' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg PKG_CONFIG: $(Build.BinariesDirectory)\tools\pkg-config.bat @@ -137,10 +140,10 @@ steps: - ${{ if and(eq(parameters.runTests, true), eq(parameters.arch, 'x64')) }}: - script: python build.py --test --config ${{ parameters.buildConfig }} displayName: 'Run tests' - workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp + workingDirectory: $(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp env: VCPKG_ROOT: $(Build.BinariesDirectory)\vcpkg - FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)\test-data-shared + FOUNDRY_TEST_DATA_DIR: $(Build.SourcesDirectory)\Foundry-Local\test-data-shared # Stage the redistributable native artifacts. # - Standard build: vcpkg statically links ORT/GenAI/azure-*/spdlog/fmt/ @@ -159,8 +162,8 @@ steps: targetType: inline pwsh: true script: | - $binDir = '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' - $linkDir = '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' + $binDir = '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/bin/${{ parameters.buildConfig }}' + $linkDir = '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/${{ parameters.buildConfig }}' $dst = '$(Build.ArtifactStagingDirectory)/native' New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -186,7 +189,7 @@ steps: - task: CopyFiles@2 displayName: 'Stage public headers' inputs: - SourceFolder: '$(Build.SourcesDirectory)/sdk_v2/cpp/include' + SourceFolder: '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/include' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include' @@ -199,6 +202,6 @@ steps: - task: CopyFiles@2 displayName: 'Stage ms-gsl headers' inputs: - SourceFolder: '$(Build.SourcesDirectory)/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' + SourceFolder: '$(Build.SourcesDirectory)/Foundry-Local/sdk_v2/cpp/build/Windows/${{ parameters.buildConfig }}/vcpkg_installed/x64-windows/include/gsl' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/include/gsl' diff --git a/.pipelines/v2/templates/steps-test-cs.yml b/.pipelines/v2/templates/steps-test-cs.yml index 73274e275..adecbb9d9 100644 --- a/.pipelines/v2/templates/steps-test-cs.yml +++ b/.pipelines/v2/templates/steps-test-cs.yml @@ -21,6 +21,20 @@ parameters: steps: +- task: PowerShell@2 + displayName: 'Set source paths' + inputs: + targetType: inline + pwsh: true + script: | + $multiCheckout = "$(Build.SourcesDirectory)/Foundry-Local" + if (Test-Path $multiCheckout) { + $repoRoot = $multiCheckout + } else { + $repoRoot = "$(Build.SourcesDirectory)" + } + Write-Host "##vso[task.setvariable variable=repoRoot]$repoRoot" + - task: UseDotNet@2 displayName: 'Use .NET 10 SDK' inputs: @@ -110,7 +124,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" + $proj = "$(repoRoot)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" $rid = dotnet msbuild $proj -getProperty:NETCoreSdkRuntimeIdentifier if ($LASTEXITCODE -ne 0 -or -not $rid) { throw "Failed to determine RuntimeIdentifier" } Write-Host "Restoring for RuntimeIdentifier: $rid" @@ -142,7 +156,7 @@ steps: # The redirect file foundry_local.native.cfg is a local-dev override that, if # present, takes priority in DllLoader and would silently point the loader at # an arbitrary path on the agent. Sweep it out of every bin folder before tests. - $root = "$(Build.SourcesDirectory)/sdk_v2/cs" + $root = "$(repoRoot)/sdk_v2/cs" $stale = Get-ChildItem -Path $root -Recurse -Force -Filter 'foundry_local.native.cfg' -ErrorAction SilentlyContinue if ($stale) { Write-Host "Removing stale redirect files:" @@ -157,7 +171,7 @@ steps: targetType: inline pwsh: true script: | - $proj = "$(Build.SourcesDirectory)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" + $proj = "$(repoRoot)/sdk_v2/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj" # Test TFMs: # * net9.0 covers the .NET (Core) runtime test surface. diff --git a/.pipelines/v2/templates/steps-test-js.yml b/.pipelines/v2/templates/steps-test-js.yml index d161da06e..003b3420b 100644 --- a/.pipelines/v2/templates/steps-test-js.yml +++ b/.pipelines/v2/templates/steps-test-js.yml @@ -18,6 +18,20 @@ parameters: steps: +- task: PowerShell@2 + displayName: 'Set source paths' + inputs: + targetType: inline + pwsh: true + script: | + $multiCheckout = "$(Build.SourcesDirectory)/Foundry-Local" + if (Test-Path $multiCheckout) { + $repoRoot = $multiCheckout + } else { + $repoRoot = "$(Build.SourcesDirectory)" + } + Write-Host "##vso[task.setvariable variable=repoRoot]$repoRoot" + - task: NodeTool@0 displayName: 'Use Node.js 20' inputs: @@ -26,7 +40,7 @@ steps: - ${{ if eq(parameters.rid, 'win-x64') }}: - pwsh: | $src = "${{ parameters.prebuildArtifactDir }}/prebuilds" - $dst = "$(Build.SourcesDirectory)/sdk_v2/js/prebuilds" + $dst = "$(repoRoot)/sdk_v2/js/prebuilds" if (-not (Test-Path $src)) { throw "Prebuild artifact missing: $src" } if (Test-Path $dst) { Remove-Item -Recurse -Force $dst } New-Item -ItemType Directory -Force -Path $dst | Out-Null @@ -38,7 +52,7 @@ steps: - bash: | set -euo pipefail src="${{ parameters.prebuildArtifactDir }}/prebuilds" - dst="$(Build.SourcesDirectory)/sdk_v2/js/prebuilds" + dst="$(repoRoot)/sdk_v2/js/prebuilds" if [ ! -d "$src" ]; then echo "Prebuild artifact missing: $src" >&2; exit 1; fi rm -rf "$dst" mkdir -p "$dst" @@ -51,17 +65,17 @@ steps: displayName: 'npm ci (runs install-native postinstall)' inputs: command: custom - workingDir: '$(Build.SourcesDirectory)/sdk_v2/js' + workingDir: '$(repoRoot)/sdk_v2/js' customCommand: 'ci --no-audit --no-fund' - pwsh: | - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(repoRoot)/sdk_v2/js" npm run build:ts if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Build TypeScript' - pwsh: | - Set-Location "$(Build.SourcesDirectory)/sdk_v2/js" + Set-Location "$(repoRoot)/sdk_v2/js" npx --no-install vitest run --reporter=verbose if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } displayName: 'Run vitest' @@ -71,19 +85,19 @@ steps: - ${{ if or(eq(parameters.rid, 'linux-x64'), eq(parameters.rid, 'osx-arm64')) }}: - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(repoRoot)/sdk_v2/js" npm ci --no-audit --no-fund displayName: 'npm ci (runs install-native postinstall)' - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(repoRoot)/sdk_v2/js" npm run build:ts displayName: 'Build TypeScript' - bash: | set -euo pipefail - cd "$(Build.SourcesDirectory)/sdk_v2/js" + cd "$(repoRoot)/sdk_v2/js" npx --no-install vitest run --reporter=verbose displayName: 'Run vitest' env: diff --git a/.pipelines/v2/templates/steps-test-python.yml b/.pipelines/v2/templates/steps-test-python.yml index 9396a7cce..996f07a24 100644 --- a/.pipelines/v2/templates/steps-test-python.yml +++ b/.pipelines/v2/templates/steps-test-python.yml @@ -23,6 +23,20 @@ parameters: steps: +- task: PowerShell@2 + displayName: 'Set source paths' + inputs: + targetType: inline + pwsh: true + script: | + $multiCheckout = "$(Build.SourcesDirectory)/Foundry-Local" + if (Test-Path $multiCheckout) { + $repoRoot = $multiCheckout + } else { + $repoRoot = "$(Build.SourcesDirectory)" + } + Write-Host "##vso[task.setvariable variable=repoRoot]$repoRoot" + - task: UsePythonVersion@0 displayName: 'Use Python 3.12' inputs: @@ -80,7 +94,7 @@ steps: targetType: inline pwsh: true script: | - Push-Location "$(Build.SourcesDirectory)/sdk_v2/python" + Push-Location "$(repoRoot)/sdk_v2/python" try { # Override pythonpath = ["src"] from pyproject.toml so pytest # imports the installed wheel (which contains the compiled cffi From d2197c2f8a4ced52f14bf1b7fdd5d18e1c2f0221 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 26 Jun 2026 16:20:34 -0700 Subject: [PATCH 4/4] ordering --- .pipelines/v2/templates/steps-build-linux.yml | 6 +++--- .pipelines/v2/templates/steps-build-macos.yml | 6 +++--- .pipelines/v2/templates/steps-build-windows.yml | 6 +++--- .pipelines/v2/templates/steps-prefetch-nuget.yml | 8 +++++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index ab32317ba..fe31dd75c 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -23,6 +23,9 @@ steps: "$(Build.BinariesDirectory)/vcpkg/bootstrap-vcpkg.sh" -disableMetrics displayName: 'Bootstrap vcpkg' +- checkout: self + clean: true + - template: steps-prefetch-nuget.yml parameters: ortVersion: ${{ parameters.ortVersion }} @@ -32,9 +35,6 @@ steps: includeOrtGpuLinux: true shell: bash -- checkout: self - clean: true - # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. - bash: | diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index b6f2f892f..a49a052fe 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -32,6 +32,9 @@ steps: pkg-config --version displayName: 'Verify build tools' +- checkout: self + clean: true + - template: steps-prefetch-nuget.yml parameters: ortVersion: ${{ parameters.ortVersion }} @@ -40,9 +43,6 @@ steps: includeWinml: false shell: bash -- checkout: self - clean: true - # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version instead of the cmake default. - bash: | diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 1f8e4a660..16d577a91 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -55,6 +55,9 @@ steps: echo @exit /b 0 > $(Build.BinariesDirectory)\tools\pkg-config.bat displayName: 'Bootstrap vcpkg' +- checkout: self + clean: true + - template: steps-prefetch-nuget.yml parameters: ortVersion: ${{ parameters.ortVersion }} @@ -63,9 +66,6 @@ steps: includeWinml: ${{ parameters.useWinml }} shell: pwsh -- checkout: self - clean: true - # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() # matches the .nupkg version (e.g. 0.1.0-dev.202605111234) instead of the cmake default. - task: PowerShell@2 diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 661075294..34f853392 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -41,7 +41,13 @@ steps: pwsh: true script: | $ErrorActionPreference = 'Stop' - $depsFile = Join-Path "$(Build.SourcesDirectory)" "sdk_v2/deps_versions.json" + $multiCheckout = Join-Path "$(Build.SourcesDirectory)" "Foundry-Local" + if (Test-Path $multiCheckout) { + $repoRoot = $multiCheckout + } else { + $repoRoot = "$(Build.SourcesDirectory)" + } + $depsFile = Join-Path $repoRoot "sdk_v2/deps_versions.json" if (-not (Test-Path $depsFile)) { throw "deps_versions.json not found at $depsFile" } $deps = Get-Content $depsFile -Raw | ConvertFrom-Json $expected = @{