onnxruntime/tools/ci_build/github/azure-pipelines/templates/final-jar-testing.yml
Changming Sun afd3e81c94
Remove PostBuildCleanup (#23233)
Remove PostBuildCleanup tasks since it is deprecated. It is to address a
warning in our pipelines:

"Task 'Post Build Cleanup' version 3 (PostBuildCleanup@3) is dependent
on a Node version (6) that is end-of-life. Contact the extension owner
for an updated version of the task. Task maintainers should review Node
upgrade guidance: https://aka.ms/node-runner-guidance"

Now the cleanup is controlled in another place:

https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/workspace?view=azure-pipelines


The code change was generated by the following Linux command:
```bash
find . -name \*.yml -exec sed -i '/PostBuildCleanup/,+2d' {} \;
```
2024-12-31 13:12:33 -08:00

93 lines
3.1 KiB
YAML

parameters:
- name: OS
displayName: Opserating System
type: string
- name: SpecificArtifact
displayName: Specific Artifact
type: string
default: ''
- name: BuildId
displayName: Build Id
type: string
default: ''
- name: PoolName
type: string
stages:
- stage: Final_Jar_Testing_${{parameters.OS}}
dependsOn:
Jar_Packaging
jobs:
- job: Final_Jar_Testing_${{parameters.OS}}
workspace:
clean: all
${{ if eq(parameters.OS, 'MacOS') }}:
pool:
vmImage: ${{ parameters.PoolName }}
${{ else }}:
pool: ${{ parameters.PoolName }}
variables:
- name: runCodesignValidationInjection
value: false
timeoutInMinutes: 60
steps:
- template: set-version-number-variables-step.yml
- template: flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Final Jar'
ArtifactName: onnxruntime-java
TargetPath: '$(Build.BinariesDirectory)/final-jar'
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
- template: flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Jar Tools'
ArtifactName: onnxruntime-java-tools
TargetPath: '$(Build.BinariesDirectory)/final-jar'
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
- ${{ if eq(parameters.OS, 'Windows') }}:
- task: CmdLine@2
inputs:
script: |
mkdir test
pushd test
jar xf $(Build.BinariesDirectory)\final-jar\testing.jar
popd
java -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.21.7.jar;onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
workingDirectory: '$(Build.BinariesDirectory)\final-jar'
- ${{ else }}:
- task: Bash@3
inputs:
targetType: 'inline'
script: |
set -e -x
echo "Java Version"
java -version
mkdir test
pushd test
jar xf '$(Build.BinariesDirectory)/final-jar/testing.jar'
popd
# if you want to run the tests in the power shell, you need to replace ':' to ';', that is, "-cp .;.\test;protobuf-java-3.21.7.jar;onnxruntime-$(OnnxRuntimeVersion).jar"
java -jar ./junit-platform-console-standalone-1.6.2.jar -cp .:./test:./protobuf-java-3.21.7.jar:./onnxruntime-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
workingDirectory: '$(Build.BinariesDirectory)/final-jar'
env:
${{ if eq(parameters.OS, 'MacOS') }}:
DYLD_LIBRARY_PATH: '$(Build.BinariesDirectory)/final-jar/test:$(DYLD_LIBRARY_PATH)'
${{ if eq(parameters.OS, 'Linux') }}:
LD_LIBRARY_PATH: '$(Build.BinariesDirectory)/final-jar/test:$(LD_LIBRARY_PATH)'
- ${{ if eq(parameters['OS'], 'MacOS') }}:
- template: use-xcode-version.yml
- template: component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'