Skip to content

Commit 69178df

Browse files
author
Prathik Rao
committed
stages to steps
1 parent 4dedcdb commit 69178df

File tree

2 files changed

+95
-109
lines changed

2 files changed

+95
-109
lines changed

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

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,107 @@ name: Build C# SDK
22

33
on:
44
workflow_call:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
9+
useWinML:
10+
required: false
11+
type: boolean
12+
default: false
13+
buildConfiguration:
14+
required: false
15+
type: string
16+
default: 'Debug' # or 'Release'
517

618
jobs:
719
build:
820
runs-on: windows-latest
21+
env:
22+
buildConfiguration: 'Debug'
923

1024
steps:
1125
- name: Checkout repository
1226
uses: actions/checkout@v4
1327
with:
14-
clean: true
28+
clean: true
29+
30+
- name: Setup .NET 9 SDK
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: '9.0.x'
34+
35+
- name: Restore dependencies
36+
run: |
37+
dotnet restore ${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\src\Microsoft.AI.Foundry.Local.csproj `
38+
/p:UseWinML=${{ inputs.useWinML }}
39+
40+
- name: Build solution
41+
run: |
42+
dotnet build ${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\src\Microsoft.AI.Foundry.Local.csproj `
43+
--no-restore `
44+
--configuration ${{ inputs.buildConfiguration }} `
45+
/p:UseWinML=${{ inputs.useWinML }}
46+
47+
- name: Checkout test-data-shared
48+
uses: actions/checkout@v4
49+
with:
50+
repository: 'windows.ai.toolkit/test-data-shared'
51+
path: 'test-data-shared'
52+
lfs: true
53+
token: ${{ secrets.TEST_DATA_SHARED_PAT }}
54+
55+
- name: Checkout specific commit in test-data-shared
56+
shell: pwsh
57+
working-directory: ${{ github.workspace }}/test-data-shared
58+
run: |
59+
Write-Host "Current directory: $(Get-Location)"
60+
git checkout 231f820fe285145b7ea4a449b112c1228ce66a41
61+
if ($LASTEXITCODE -ne 0) {
62+
Write-Error "Git checkout failed."
63+
exit 1
64+
}
65+
Write-Host "`nDirectory contents:"
66+
Get-ChildItem -Recurse -Depth 2 | ForEach-Object { Write-Host " $($_.FullName)" }
67+
68+
- name: Run Foundry Local Core tests
69+
working-directory: ${{ github.workspace }}
70+
run: |
71+
dotnet test ${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\test\FoundryLocal.Tests\Microsoft.AI.Foundry.Local.Tests.csproj `
72+
--verbosity normal `
73+
/p:UseWinML=${{ inputs.useWinML }}
74+
75+
- name: Pack NuGet package
76+
shell: pwsh
77+
run: |
78+
$projectPath = "${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\src\Microsoft.AI.Foundry.Local.csproj"
79+
$outputDir = "${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\bin"
80+
$version = "${{ inputs.version }}"
81+
$config = "${{ inputs.buildConfiguration }}"
82+
$useWinML = "${{ inputs.useWinML }}"
83+
84+
Write-Host "Packing project: $projectPath"
85+
Write-Host "Output directory: $outputDir"
86+
Write-Host "Version: $version"
87+
Write-Host "Configuration: $config"
88+
Write-Host "UseWinML: $useWinML"
89+
90+
& dotnet pack $projectPath --no-build --configuration $config --output $outputDir /p:PackageVersion=$version /p:UseWinML=$useWinML /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --verbosity normal
91+
92+
if ($LASTEXITCODE -ne 0) {
93+
Write-Error "dotnet pack failed with exit code $LASTEXITCODE"
94+
exit $LASTEXITCODE
95+
}
96+
97+
Write-Host "Pack completed successfully"
98+
Write-Host "Generated packages:"
99+
Get-ChildItem -Path $outputDir -Filter "*.nupkg" | ForEach-Object { Write-Host " $($_.Name)" }
100+
Get-ChildItem -Path $outputDir -Filter "*.snupkg" | ForEach-Object { Write-Host " $($_.Name)" }
101+
102+
- name: Upload NuGet packages
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: nuget-packages
106+
path: |
107+
${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\bin\*.nupkg
108+
${{ github.workspace }}\foundry-local-sdk\sdk_v2\cs\bin\*.snupkg

.github/workflows/sdk_v2/templates/stages-build-cs.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)