Skip to content

Commit f8fd180

Browse files
committed
follow 0b2c4ac
1 parent 0f0dbd1 commit f8fd180

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

tools/ci_build/github/azure-pipelines/dml-nuget-packaging.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ extends:
7777
NuPackScript: |
7878
python -m pip install setuptools
7979
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.DirectML /p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} /p:CurrentData=$(BuildDate) /p:CurrentTime=$(BuildTime)
80+
if errorlevel 1 exit /b 1
8081
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
81-
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
82+
if errorlevel 1 exit /b 1
83+
powershell -Command "$$isRelease = [System.Convert]::ToBoolean('${{ parameters.IsReleaseBuild }}'); $$pkg = Get-ChildItem $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\Microsoft.ML.OnnxRuntime.DirectML.*.nupkg | Where-Object { $$_.Name -notlike '*symbols*' -and (($$isRelease -and $$_.Name -notlike '*-dev*') -or (-not $$isRelease -and $$_.Name -like '*-dev*')) } | Select-Object -First 1; if ($$pkg) { Copy-Item $$pkg.FullName $(Build.ArtifactStagingDirectory) } else { Write-Error 'No matching nupkg found'; exit 1 }"
84+
if errorlevel 1 exit /b 1
8285
mkdir $(Build.ArtifactStagingDirectory)\testdata
8386
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
8487
@@ -97,9 +100,12 @@ extends:
97100
NuPackScript: |
98101
python -m pip install setuptools
99102
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=arm64 /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.DirectML /p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
103+
if errorlevel 1 exit /b 1
100104
cd $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\
101-
powershell -Command \"Get-ChildItem Microsoft.ML.OnnxRuntime.DirectML.*.nupkg -ErrorAction Stop | Sort-Object {$_.Name.Length} | Select-Object -First 1 | Rename-Item -NewName win-dml-arm64.zip\"
105+
powershell -Command "$$isRelease = [System.Convert]::ToBoolean('${{ parameters.IsReleaseBuild }}'); $$pkg = Get-ChildItem Microsoft.ML.OnnxRuntime.DirectML.*.nupkg | Where-Object { $$_.Name -notlike '*symbols*' -and (($$isRelease -and $$_.Name -notlike '*-dev*') -or (-not $$isRelease -and $$_.Name -like '*-dev*')) } | Select-Object -First 1; if ($$pkg) { Rename-Item -Path $$pkg.FullName -NewName win-dml-arm64.zip } else { Write-Error 'No matching nupkg found'; exit 1 }"
106+
if errorlevel 1 exit /b 1
102107
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\win-dml-arm64.zip $(Build.ArtifactStagingDirectory)
108+
if errorlevel 1 exit /b 1
103109
mkdir $(Build.ArtifactStagingDirectory)\testdata
104110
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
105111

tools/ci_build/github/azure-pipelines/templates/validate-package.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ parameters:
44
PackageType: ''
55
PackageName: ''
66
PackagePath: ''
7+
IsReleaseBuild: false
78
ScriptPath: '$(Build.SourcesDirectory)/tools/nuget/validate_package.py'
89
workingDirectory: "$(Build.BinariesDirectory)"
910

@@ -17,5 +18,5 @@ steps:
1718
displayName: 'Validate Package'
1819
inputs:
1920
scriptPath: '${{parameters.ScriptPath}}'
20-
arguments: '--package_type ${{parameters.PackageType}} --package_name ${{parameters.PackageName}} --package_path ${{parameters.PackagePath}} --platforms_supported ${{parameters.PlatformsSupported}} --verify_nuget_signing ${{parameters.VerifyNugetSigning}}'
21+
arguments: '--package_type ${{parameters.PackageType}} --package_name ${{parameters.PackageName}} --package_path ${{parameters.PackagePath}} --platforms_supported ${{parameters.PlatformsSupported}} --verify_nuget_signing ${{parameters.VerifyNugetSigning}} --is_release_build ${{parameters.IsReleaseBuild}}'
2122
workingDirectory: ${{parameters.workingDirectory}}

tools/nuget/validate_package.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ def parse_arguments():
6767
"--verify_nuget_signing",
6868
help="Flag indicating if Nuget package signing is to be verified. Only accepts 'true' or 'false'",
6969
)
70+
parser.add_argument(
71+
"--is_release_build",
72+
help="Flag indicating if validating a release build or dev build. Only accepts 'true' or 'false'",
73+
)
7074

7175
return parser.parse_args()
7276

@@ -285,7 +289,14 @@ def validate_zip(args):
285289

286290
def validate_nuget(args):
287291
files = glob.glob(os.path.join(args.package_path, args.package_name))
288-
nuget_packages_found_in_path = [i for i in files if i.endswith(".nupkg") and "Managed" not in i]
292+
is_release_build = args.is_release_build and args.is_release_build.lower() == "true"
293+
nuget_packages_found_in_path = [
294+
i
295+
for i in files
296+
if i.endswith(".nupkg")
297+
and "Managed" not in i
298+
and ((is_release_build and "-dev" not in i) or (not is_release_build and "-dev" in i))
299+
]
289300
if len(nuget_packages_found_in_path) != 1:
290301
print("Nuget packages found in path: ")
291302
print(nuget_packages_found_in_path)

0 commit comments

Comments
 (0)