Skip to content

Commit 2a1bf56

Browse files
prathikrPrathik RaoCopilot
authored
implement ADO packaging pipeline for FLC & SDK (#552)
## Foundry Local Packaging Pipeline ### Summary This PR introduces the **Foundry Local Packaging Pipeline**, a unified ADO pipeline that builds, signs, and tests Foundry Local Core (FLC) for all platforms, packages it as NuGet and Python wheels, then builds, signs, and tests the C#, JS, Python, and Rust SDKs — for both standard and WinML variants. **Pipeline stages:** 1. **Build FLC** — Native AOT binaries for win-x64, win-arm64, linux-x64, osx-arm64 2. **Package FLC** — Multi-platform NuGet package + Python wheels from the built binaries 3. **Build SDKs** — C#, JS, Python, Rust using the packaged FLC 4. **Test SDKs** — Validate each SDK against the pipeline-built FLC **Produced artifacts:** `flc-nuget`, `flc-nuget-winml`, `flc-wheels`, `flc-wheels-winml`, `cs-sdk`, `cs-sdk-winml`, `js-sdk`, `js-sdk-winml`, `python-sdk`, `python-sdk-winml`, `rust-sdk`, `rust-sdk-winml` **SDK Changes:** 1. Adds ability for python sdk to skip installing native depenencies and use pre-installed binaries like `foundry-local-core`, `onnxruntime`, `onnxruntime-genai` 2. Adjusts APIs to leverage new download_and_register_eps native interop call for manually downloading and registering EPs 3. Adds temporary nuget.config to github actions c# pipeline to allow ORT-Nightly to auto-fetch missing dependencies from upstream nuget.org ### Test coverage All SDK tests currently run on **win-x64 only**. Additional platform test jobs are blocked on infrastructure: - **Windows ARM64** — waiting on a 1ES-hosted win-arm64 pool - **macOS ARM64** — waiting on a 1ES-hosted macOS ARM64 pool - **Linux x64** — waiting on the Linux onnxruntime dependency to be stabilized TODOs are tracked in the pipeline YAML for each. ### Build strategy All FLC builds (including win-arm64 and osx-arm64) run on **x64 machines** because .NET Native AOT supports cross-compilation. The win-arm64 build cross-compiles from x64 Windows — see [Cross-compilation docs](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/cross-compile#windows). Linux builds run on its own respective x64 hosted image. ### Origin - **Foundry Local Core build steps** were lifted from `neutron-server/.pipelines/FoundryLocalCore/` - **SDK build/test steps** were lifted from `Foundry-Local/.github/` --------- Co-authored-by: Prathik Rao <prathikrao@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9e0c70d commit 2a1bf56

25 files changed

+2693
-119
lines changed

.github/workflows/build-cs-steps.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,41 @@ jobs:
4141
env:
4242
NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_PAT }}
4343

44+
- name: Generate temporary NuGet.config
45+
run: |
46+
# The repo-level NuGet.config cleared all sources and only included ORT-Nightly.
47+
# We generate a temporary one with both nuget.org and ORT-Nightly.
48+
# We provide credentials to allow the ORT-Nightly feed to pull from its upstreams.
49+
$xml = @"
50+
<?xml version="1.0" encoding="utf-8"?>
51+
<configuration>
52+
<packageSources>
53+
<clear />
54+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
55+
<add key="ORT-Nightly" value="https://pkgs.dev.azure.com/aiinfra/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json" />
56+
</packageSources>
57+
<packageSourceCredentials>
58+
<ORT-Nightly>
59+
<add key="Username" value="az" />
60+
<add key="ClearTextPassword" value="${{ secrets.ORT_NIGHTLY_PAT }}" />
61+
</ORT-Nightly>
62+
</packageSourceCredentials>
63+
</configuration>
64+
"@
65+
Set-Content -Path sdk/cs/NuGet.temp.config -Value $xml
66+
shell: pwsh
67+
4468
# TODO: once the nightly packaging is fixed, add back the commented out lines with /p:FoundryLocalCoreVersion="*-*"
4569
# /p:FoundryLocalCoreVersion="*-*" to always use nightly version of Foundry Local Core
46-
- name: Authenticate to Azure Artifacts NuGet feed
47-
run: dotnet nuget update source ORT-Nightly --username az --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text --configfile sdk/cs/NuGet.config
48-
4970
- name: Restore dependencies
5071
run: |
51-
# dotnet restore sdk/cs/src/Microsoft.AI.Foundry.Local.csproj /p:UseWinML=${{ inputs.useWinML }} /p:FoundryLocalCoreVersion="*-*" --configfile sdk/cs/NuGet.config
52-
dotnet restore sdk/cs/src/Microsoft.AI.Foundry.Local.csproj /p:UseWinML=${{ inputs.useWinML }} --configfile sdk/cs/NuGet.config
72+
# Clear the local NuGet cache to avoid bad metadata or corrupted package states.
73+
dotnet nuget locals all --clear
74+
# Restore using the temporary config file with credentials.
75+
dotnet restore sdk/cs/src/Microsoft.AI.Foundry.Local.csproj /p:UseWinML=${{ inputs.useWinML }} --configfile sdk/cs/NuGet.temp.config
5376
5477
- name: Build solution
5578
run: |
56-
# dotnet build sdk/cs/src/Microsoft.AI.Foundry.Local.csproj --no-restore --configuration ${{ inputs.buildConfiguration }} /p:UseWinML=${{ inputs.useWinML }} /p:FoundryLocalCoreVersion="*-*"
5779
dotnet build sdk/cs/src/Microsoft.AI.Foundry.Local.csproj --no-restore --configuration ${{ inputs.buildConfiguration }} /p:UseWinML=${{ inputs.useWinML }}
5880
5981
# need to use direct git commands to clone from Azure DevOps instead of actions/checkout
@@ -89,6 +111,7 @@ jobs:
89111
- name: Run Foundry Local Core tests
90112
run: |
91113
# dotnet test sdk/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj --verbosity normal /p:UseWinML=${{ inputs.useWinML }} /p:FoundryLocalCoreVersion="*-*"
114+
# Use the temporary config file for test restore as well.
92115
dotnet test sdk/cs/test/FoundryLocal.Tests/Microsoft.AI.Foundry.Local.Tests.csproj --verbosity normal /p:UseWinML=${{ inputs.useWinML }}
93116
94117
- name: Pack NuGet package

.github/workflows/foundry-local-sdk-build.yml

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,60 +17,8 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
build-cs-windows:
21-
uses: ./.github/workflows/build-cs-steps.yml
22-
with:
23-
version: '0.9.0.${{ github.run_number }}'
24-
platform: 'windows'
25-
secrets: inherit
26-
build-js-windows:
27-
uses: ./.github/workflows/build-js-steps.yml
28-
with:
29-
version: '0.9.0.${{ github.run_number }}'
30-
platform: 'windows'
31-
secrets: inherit
32-
build-python-windows:
33-
uses: ./.github/workflows/build-python-steps.yml
34-
with:
35-
version: '0.9.0.${{ github.run_number }}'
36-
platform: 'windows'
37-
secrets: inherit
38-
build-rust-windows:
39-
uses: ./.github/workflows/build-rust-steps.yml
40-
with:
41-
platform: 'windows'
42-
run-integration-tests: true
43-
secrets: inherit
44-
45-
build-cs-windows-WinML:
46-
uses: ./.github/workflows/build-cs-steps.yml
47-
with:
48-
version: '0.9.0.${{ github.run_number }}'
49-
platform: 'windows'
50-
useWinML: true
51-
secrets: inherit
52-
build-js-windows-WinML:
53-
uses: ./.github/workflows/build-js-steps.yml
54-
with:
55-
version: '0.9.0.${{ github.run_number }}'
56-
platform: 'windows'
57-
useWinML: true
58-
secrets: inherit
59-
build-python-windows-WinML:
60-
uses: ./.github/workflows/build-python-steps.yml
61-
with:
62-
version: '0.9.0.${{ github.run_number }}'
63-
platform: 'windows'
64-
useWinML: true
65-
secrets: inherit
66-
build-rust-windows-WinML:
67-
uses: ./.github/workflows/build-rust-steps.yml
68-
with:
69-
platform: 'windows'
70-
useWinML: true
71-
run-integration-tests: true
72-
secrets: inherit
73-
20+
# Windows build/test moved to .pipelines/foundry-local-packaging.yml and runs in ADO
21+
# MacOS ARM64 not supported in ADO, need to use GitHub Actions
7422
build-cs-macos:
7523
uses: ./.github/workflows/build-cs-steps.yml
7624
with:

0 commit comments

Comments
 (0)