mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
The time for nuget pkg should be consistent (#20522)
This pull request primarily involves changes to the build scripts in the `tools/ci_build/github/azure-pipelines` directory. The changes add build date and time information to the build process. This is achieved by introducing two new parameters, `BuildDate` and `BuildTime`, and incorporating them into the `msbuildArguments` in multiple locations. Addition of new parameters: * [`tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml`](diffhunk://#diff-00815920cc190d10fdebceac0c3a4b8a59e408684ae38177dfe7f96cae276c59R309-R310): Added `BuildDate` and `BuildTime` parameters using the pipeline's start time. Incorporation of new parameters in `msbuildArguments`: * [`tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml`](diffhunk://#diff-efb530efd945fdd9d3e1b92e53d25cc8db7df2e28071c364b07a7193092de01bL947-R948): Added `CurrentDate` and `CurrentTime` parameters to `msbuildArguments` in multiple locations. [[1]](diffhunk://#diff-efb530efd945fdd9d3e1b92e53d25cc8db7df2e28071c364b07a7193092de01bL947-R948) [[2]](diffhunk://#diff-efb530efd945fdd9d3e1b92e53d25cc8db7df2e28071c364b07a7193092de01bL1092-R1093) [[3]](diffhunk://#diff-efb530efd945fdd9d3e1b92e53d25cc8db7df2e28071c364b07a7193092de01bL1114-R1115) [[4]](diffhunk://#diff-efb530efd945fdd9d3e1b92e53d25cc8db7df2e28071c364b07a7193092de01bL1137-R1138) * [`tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml`](diffhunk://#diff-00815920cc190d10fdebceac0c3a4b8a59e408684ae38177dfe7f96cae276c59L446-R448): Incorporated the `CurrentDate` and `CurrentTime` parameters into `msbuildArguments`.### Description <!-- Describe your changes. --> ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
This commit is contained in:
parent
69cfcba38a
commit
d1cbb3e076
4 changed files with 50 additions and 21 deletions
|
|
@ -50,8 +50,12 @@ CMake creates a target to this project
|
|||
<PropertyGroup>
|
||||
<!-- If we create multiple nuget packages in one job, major package and dependent packages version should be the same-->
|
||||
<!-- CurrentDate and CurrentTime are only used for dev packages-->
|
||||
<CurrentDate Condition=" '$(BuildDate)'!='' ">$(BuildDate)</CurrentDate>
|
||||
<CurrentTime Condition=" '$(BuildTime)'!='' ">$(BuildTime)</CurrentTime>
|
||||
<CurrentDate Condition="'$(CurrentDate)'==''">$([System.DateTime]::UtcNow.ToString(yyyyMMdd))</CurrentDate>
|
||||
<CurrentTime Condition="'$(CurrentTime)'==''">$([System.DateTime]::UtcNow.ToString(hhmm))</CurrentTime>
|
||||
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
|||
|
|
@ -123,6 +123,21 @@ stages:
|
|||
echo "##vso[task.setvariable variable=ReleaseVersionSuffix;isOutput=true]"
|
||||
fi
|
||||
name: Set_Release_Version_Suffix
|
||||
- script: |
|
||||
# Extracting hours and minutes
|
||||
date=$(date +'%Y%m%d')
|
||||
# Set the hhmm value as a pipeline variable
|
||||
echo "##vso[task.setvariable variable=BuildDate;isOutput=true]$date"
|
||||
displayName: 'Set Start Date as Variable'
|
||||
name: Set_Build_Date
|
||||
|
||||
- script: |
|
||||
# Extracting hours and minutes
|
||||
hhmm=$(date +'%H%M')
|
||||
# Set the hhmm value as a pipeline variable
|
||||
echo "##vso[task.setvariable variable=BuildTime;isOutput=true]$hhmm"
|
||||
displayName: 'Set Start Time as Variable'
|
||||
name: Set_Build_Time
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
|
|
@ -136,12 +151,16 @@ stages:
|
|||
vmImage: ubuntu-latest
|
||||
variables:
|
||||
MyVar: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
steps:
|
||||
- checkout: none
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
displayName: 'Clean Agent Directories'
|
||||
condition: always()
|
||||
- bash: echo $(MyVar)
|
||||
- bash: echo $(BuildTime)
|
||||
- bash: echo $(BuildDate)
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
|
|
@ -609,8 +628,8 @@ stages:
|
|||
variables:
|
||||
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
||||
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate: $[format('{0:yyyyMMdd}', pipeline.startTime)]
|
||||
BuildTime: $[format('{0:HHmm}', pipeline.startTime)]
|
||||
BuildDate: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime: $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
|
|
@ -826,6 +845,8 @@ stages:
|
|||
variables:
|
||||
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
||||
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
|
|
@ -953,7 +974,7 @@ stages:
|
|||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
|
||||
configuration: RelWithDebInfo
|
||||
platform: 'Any CPU'
|
||||
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
|
||||
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) -p:CurrentTime=$(BuildTime) -p:CurrentDate=$(BuildDate)'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: CopyFiles@2
|
||||
|
|
@ -1032,8 +1053,8 @@ stages:
|
|||
|
||||
- template: nuget/templates/test_win.yml
|
||||
parameters:
|
||||
AgentPool : 'onnxruntime-Win2022-GPU-A10'
|
||||
NugetPackageName : 'Microsoft.ML.OnnxRuntime.Gpu'
|
||||
AgentPool: 'onnxruntime-Win2022-GPU-A10'
|
||||
NugetPackageName: 'Microsoft.ML.OnnxRuntime.Gpu'
|
||||
ArtifactSuffix: 'GPU'
|
||||
StageSuffix: 'GPU'
|
||||
Skipx86Tests: 'true'
|
||||
|
|
@ -1043,8 +1064,8 @@ stages:
|
|||
|
||||
- template: nuget/templates/test_win.yml
|
||||
parameters:
|
||||
AgentPool : 'onnxruntime-Win2022-GPU-A10'
|
||||
NugetPackageName : 'Microsoft.ML.OnnxRuntime.Gpu.Windows'
|
||||
AgentPool: 'onnxruntime-Win2022-GPU-A10'
|
||||
NugetPackageName: 'Microsoft.ML.OnnxRuntime.Gpu.Windows'
|
||||
ArtifactSuffix: 'GPU'
|
||||
StageSuffix: 'GPU'
|
||||
MoreSuffix: '_Windows'
|
||||
|
|
@ -1055,7 +1076,7 @@ stages:
|
|||
|
||||
- template: nuget/templates/test_linux.yml
|
||||
parameters:
|
||||
AgentPool : Onnxruntime-Linux-GPU-A10
|
||||
AgentPool: Onnxruntime-Linux-GPU-A10
|
||||
ArtifactSuffix: 'GPU'
|
||||
StageSuffix: 'GPU'
|
||||
NugetPackageName : 'Microsoft.ML.OnnxRuntime.Gpu'
|
||||
|
|
@ -1065,7 +1086,7 @@ stages:
|
|||
|
||||
- template: nuget/templates/test_linux.yml
|
||||
parameters:
|
||||
AgentPool : Onnxruntime-Linux-GPU-A10
|
||||
AgentPool: Onnxruntime-Linux-GPU-A10
|
||||
ArtifactSuffix: 'GPU'
|
||||
StageSuffix: 'GPU'
|
||||
MoreSuffix: '_Linux'
|
||||
|
|
@ -1079,14 +1100,14 @@ stages:
|
|||
AgentPool: AMD-GPU
|
||||
ArtifactSuffix: 'ROCm'
|
||||
StageSuffix: 'ROCm'
|
||||
NugetPackageName : 'Microsoft.ML.OnnxRuntime.ROCm'
|
||||
NugetPackageName: 'Microsoft.ML.OnnxRuntime.ROCm'
|
||||
SpecificArtifact: ${{ parameters.specificArtifact }}
|
||||
CustomOpArtifactName: 'onnxruntime-linux-x64-rocm'
|
||||
BuildId: ${{ parameters.BuildId }}
|
||||
|
||||
- template: nuget/templates/dml-vs-2022.yml
|
||||
parameters:
|
||||
AgentPool : 'onnxruntime-Win2022-GPU-dml-A10'
|
||||
AgentPool: 'onnxruntime-Win2022-GPU-dml-A10'
|
||||
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
|
||||
ArtifactName: 'drop-nuget-dml'
|
||||
StageName: 'Windows_CI_GPU_DML_Dev'
|
||||
|
|
@ -1096,11 +1117,11 @@ stages:
|
|||
EnvSetupScript: 'setup_env.bat'
|
||||
sln_platform: 'x64'
|
||||
DoDebugBuild: 'false'
|
||||
DoNugetPack : 'true'
|
||||
DoNugetPack: 'true'
|
||||
DoCompliance: 'false'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.DirectML /p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
|
||||
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)
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
|
@ -1108,7 +1129,7 @@ stages:
|
|||
|
||||
- template: nuget/templates/dml-vs-2022.yml
|
||||
parameters:
|
||||
AgentPool : 'onnxruntime-Win2022-GPU-dml-A10'
|
||||
AgentPool: 'onnxruntime-Win2022-GPU-dml-A10'
|
||||
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
|
||||
ArtifactName: 'drop-win-dml-x86-zip'
|
||||
StageName: 'Windows_CI_GPU_DML_Dev_x86'
|
||||
|
|
@ -1117,7 +1138,7 @@ stages:
|
|||
EnvSetupScript: 'setup_env_x86.bat'
|
||||
sln_platform: 'Win32'
|
||||
DoDebugBuild: 'false'
|
||||
DoNugetPack : 'true'
|
||||
DoNugetPack: 'true'
|
||||
DoCompliance: ${{ parameters.DoCompliance }}
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
RunTests: 'false'
|
||||
|
|
@ -1131,7 +1152,7 @@ stages:
|
|||
|
||||
- template: nuget/templates/dml-vs-2022.yml
|
||||
parameters:
|
||||
AgentPool : 'onnxruntime-Win2022-GPU-dml-A10'
|
||||
AgentPool: 'onnxruntime-Win2022-GPU-dml-A10'
|
||||
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
|
||||
ArtifactName: 'drop-win-dml-arm64-zip'
|
||||
StageName: 'Windows_CI_GPU_DML_Dev_arm64'
|
||||
|
|
@ -1140,7 +1161,7 @@ stages:
|
|||
EnvSetupScript: 'setup_env.bat'
|
||||
sln_platform: 'arm64'
|
||||
DoDebugBuild: 'false'
|
||||
DoNugetPack : 'true'
|
||||
DoNugetPack: 'true'
|
||||
DoCompliance: ${{ parameters.DoCompliance }}
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
RunTests: 'false'
|
||||
|
|
@ -1246,5 +1267,5 @@ stages:
|
|||
artifactName: 'drop-signed-nuget-dml'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
parameters:
|
||||
condition: 'succeeded'
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ parameters:
|
|||
IsReleaseBuild: false
|
||||
stages:
|
||||
- stage: ${{ parameters.StageName }}
|
||||
dependsOn: []
|
||||
dependsOn: Setup
|
||||
jobs:
|
||||
- job:
|
||||
timeoutInMinutes: 200
|
||||
|
|
@ -47,6 +47,8 @@ stages:
|
|||
runCodesignValidationInjection: and(${{ parameters.DoNodejsPack }},${{ parameters. DoEsrp}}) #For the others, code sign is in a separated job
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
||||
ALLOW_RELEASED_ONNX_OPSET_ONLY: ${{ parameters.AllowReleasedOpsetOnly }}
|
||||
BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
${{ if eq(parameters.EnableLto, true) }}:
|
||||
build_py_lto_flag: --enable_lto
|
||||
|
||||
|
|
|
|||
|
|
@ -298,6 +298,8 @@ stages:
|
|||
OrtPackageId: ${{ parameters.OrtNugetPackageId }}
|
||||
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
|
||||
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
|
||||
BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
|
||||
BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
|
|
@ -435,7 +437,7 @@ stages:
|
|||
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
|
||||
platform: 'Any CPU'
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)'
|
||||
msbuildArguments: '-t:CreatePackage -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} -p:ReleaseVersionSuffix=$(ReleaseVersionSuffix) -p:CurrentTime=$(BuildTime) -p:CurrentDate=$(BuildDate)'
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
|
||||
- task: CopyFiles@2
|
||||
|
|
|
|||
Loading…
Reference in a new issue