-
Notifications
You must be signed in to change notification settings - Fork 281
108 lines (93 loc) · 3.53 KB
/
build-cs-steps.yml
File metadata and controls
108 lines (93 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Build C# SDK
on:
workflow_call:
inputs:
version:
required: true
type: string
useWinML:
required: false
type: boolean
default: false
buildConfiguration:
required: false
type: string
default: 'Debug' # or 'Release'
jobs:
build:
runs-on: windows-latest
env:
buildConfiguration: 'Debug'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
clean: true
- name: Setup .NET 9 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: |
dotnet restore sdk_v2\cs\src\Microsoft.AI.Foundry.Local.csproj `
/p:UseWinML=${{ inputs.useWinML }}
- name: Build solution
run: |
dotnet build sdk_v2\cs\src\Microsoft.AI.Foundry.Local.csproj `
--no-restore `
--configuration ${{ inputs.buildConfiguration }} `
/p:UseWinML=${{ inputs.useWinML }}
- name: Checkout test-data-shared
uses: actions/checkout@v4
with:
repository: 'windows.ai.toolkit/test-data-shared'
path: 'test-data-shared'
lfs: true
token: ${{ secrets.TEST_DATA_SHARED_PAT }}
- name: Checkout specific commit in test-data-shared
shell: pwsh
working-directory: test-data-shared
run: |
Write-Host "Current directory: $(Get-Location)"
git checkout 231f820fe285145b7ea4a449b112c1228ce66a41
if ($LASTEXITCODE -ne 0) {
Write-Error "Git checkout failed."
exit 1
}
Write-Host "`nDirectory contents:"
Get-ChildItem -Recurse -Depth 2 | ForEach-Object { Write-Host " $($_.FullName)" }
- name: Run Foundry Local Core tests
working-directory: ${{ github.workspace }}
run: |
dotnet test sdk_v2\cs\test\FoundryLocal.Tests\Microsoft.AI.Foundry.Local.Tests.csproj `
--verbosity normal `
/p:UseWinML=${{ inputs.useWinML }}
- name: Pack NuGet package
shell: pwsh
run: |
$projectPath = "sdk_v2\cs\src\Microsoft.AI.Foundry.Local.csproj"
$outputDir = "sdk_v2\cs\bin"
$version = "${{ inputs.version }}"
$config = "${{ inputs.buildConfiguration }}"
$useWinML = "${{ inputs.useWinML }}"
Write-Host "Packing project: $projectPath"
Write-Host "Output directory: $outputDir"
Write-Host "Version: $version"
Write-Host "Configuration: $config"
Write-Host "UseWinML: $useWinML"
& dotnet pack $projectPath --no-build --configuration $config --output $outputDir /p:PackageVersion=$version /p:UseWinML=$useWinML /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --verbosity normal
if ($LASTEXITCODE -ne 0) {
Write-Error "dotnet pack failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "Pack completed successfully"
Write-Host "Generated packages:"
Get-ChildItem -Path $outputDir -Filter "*.nupkg" | ForEach-Object { Write-Host " $($_.Name)" }
Get-ChildItem -Path $outputDir -Filter "*.snupkg" | ForEach-Object { Write-Host " $($_.Name)" }
- name: Upload NuGet packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
sdk_v2\cs\bin\*.nupkg
sdk_v2\cs\bin\*.snupkg