Enable SPM support for Ext and configure pipelines for extensions target testing (#3)

* initial ext files

* add a workable version of spm for extensions

* update

* update pipeline

* update pipelines

* fix dev/release pipelines for extensions pod

* fix dev pipelines for extensions pod

* fix release pipelines for extensions pod

* fix dev  pipelines for extensions pod

* adding empty include folder for configuring extensions target path

* test

* test

* test

* revert pipeline changes

* revert gitignore changes

* add ext pod binary target for release pipeline

* add pipeline for extensions

* update

* update package.swift

* update latest from branch

* update

* fix

* fix

* update

* try dummy empty file

* test

* update package.swift to use fatalerror

* syntax

* try gitignore revert

* update gitignore

* add -list

* onnxruntime-Package

* update using onnxruntime-Package

* update dev pipeline

* fix dev pipelines

* syntax

* pull extensions/

* update pipelines again

* syntax

* variables

* fix

* fix -r

* update Package.swift

* update Package.swift

* minor update

* address pr comments

* minor updates

* fix

* refine messages

* syntax

* syntax again

* address pr comments partial

* address pr comments

* add .h header file and notes

* minor updates

* syncing objc source files and add code to register custom ops using function pointer

* format

* move to the header for function doc

---------

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
Co-authored-by: rachguo <rachguo@rachguos-Mac-mini.local>
This commit is contained in:
Rachel Guo
2023-08-11 10:07:43 -07:00
committed by GitHub
parent 7acc38c99c
commit c76787fd3e
33 changed files with 1424 additions and 62 deletions
@@ -68,5 +68,5 @@
displayName: "Print ORT iOS Pod checksum and Test Package.swift usage"
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
parameters:
condition: 'succeeded'
@@ -0,0 +1,102 @@
jobs:
- job: j
displayName: "Test with ORT Extensions native pod"
pool:
vmImage: "macOS-13"
variables:
xcodeVersion: "14.3"
artifactsName: "ios_packaging_artifacts_full"
artifactsNameForExt: "ios_packaging_artifacts"
timeoutInMinutes: 60
steps:
- template: templates/use-xcode-version.yml
parameters:
xcodeVersion: ${{ variables.xcodeVersion }}
- script: |
mkdir tmp
cd tmp
git clone -n --depth=1 --filter=tree:0 https://github.com/microsoft/onnxruntime.git
cd onnxruntime
git sparse-checkout set --no-cone objectivec
git checkout
workingDirectory: "$(Build.SourcesDirectory)"
displayName: "Sparse checkout objectivec/ folders from latest ORT main repository"
- script: |
ls -R "$(Build.SourcesDirectory)/tmp/onnxruntime"
workingDirectory: "$(Build.SourcesDirectory)/tmp"
displayName: "List sparse checkout repo contents"
# Download artifacts for ORT C pod from iOS packaging pipeline
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Lotus'
definition: 995 #'definitionid' is obtained from `System.DefinitionId` of ORT CI: onnxruntime-ios-packaging-pipeline
buildVersionToDownload: 'latest'
branchName: 'main'
targetPath: '$(Build.ArtifactStagingDirectory)'
- script: |
set -e -x
ls
workingDirectory: '$(Build.ArtifactStagingDirectory)/$(artifactsName)'
displayName: "List staged artifacts for ORT C Pod"
# Download artifacts for ORT Ext C pod from extensions iOS packaging pipeline
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Lotus'
definition: 1206 #'definitionid' is obtained from `System.DefinitionId` of extensions CI: extensions.ios_packaging
buildVersionToDownload: 'latest'
branchName: 'main'
targetPath: '$(Build.ArtifactStagingDirectory)'
- script: |
set -e -x
ls
workingDirectory: '$(Build.ArtifactStagingDirectory)/$(artifactsNameForExt)'
displayName: "List staged artifacts for ORT Ext C Pod"
# Note: Running xcodebuild test on `onnxruntime-Package` scheme will perform swift unit tests for both OnnxRuntimeBindings
# and OnnxRuntimeExtensions targets.
- script: |
set -e -x
cd "$(Build.ArtifactStagingDirectory)/$(artifactsName)"
POD_ARCHIVE=$(find . -name "pod-archive-onnxruntime-c-*.zip")
echo "Printing the checksum here to make it easier when updating for actual release pod archive file in Package.swift"
shasum -a 256 "$(Build.ArtifactStagingDirectory)/$(artifactsName)/${POD_ARCHIVE}"
cd "$(Build.ArtifactStagingDirectory)/$(artifactsNameForExt)"
POD_ARCHIVE_EXT=$(find . -name "pod-archive-onnxruntime-extensions-c-*.zip")
echo "Printing the checksum here to make it easier when updating for actual release extensions pod archive file in Package.swift"
shasum -a 256 "$(Build.ArtifactStagingDirectory)/$(artifactsNameForExt)/${POD_ARCHIVE_EXT}"
cd "$(Build.SourcesDirectory)/tmp/onnxruntime"
cp -r "$(Build.SourcesDirectory)/swift" .
cp "$(Build.SourcesDirectory)/Package.swift" .
cp -r "$(Build.SourcesDirectory)/extensions" .
cp "$(Build.ArtifactStagingDirectory)/$(artifactsName)/${POD_ARCHIVE}" swift/
export ORT_IOS_POD_LOCAL_PATH="swift/${POD_ARCHIVE}"
cp "$(Build.ArtifactStagingDirectory)/$(artifactsNameForExt)/${POD_ARCHIVE_EXT}" swift/
export ORT_EXTENSIONS_IOS_POD_LOCAL_PATH="swift/${POD_ARCHIVE_EXT}"
xcodebuild test -scheme onnxruntime-Package -destination 'platform=iOS Simulator,name=iPhone 14'
rm swift/pod-archive-onnxruntime-c-*.zip
rm swift/pod-archive-onnxruntime-extensions-c-*.zip
workingDirectory: "$(Build.SourcesDirectory)/tmp"
displayName: "Test Package.swift usage for ORT and ORT Extensions"
- template: templates/component-governance-component-detection-steps.yml
parameters:
condition: 'succeeded'
@@ -14,13 +14,40 @@
- template: templates/use-xcode-version.yml
parameters:
xcodeVersion: ${{ variables.xcodeVersion }}
# Note: Currently it requires a dev version extensions c pod for testing
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Lotus'
definition: 1206 #'definitionid' is obtained from `System.DefinitionId` of extensions CI: extensions.ios_packaging
buildVersionToDownload: 'latest'
branchName: 'main'
targetPath: '$(Build.ArtifactStagingDirectory)'
- script: |
set -e -x
xcodebuild test -scheme onnxruntime -destination 'platform=iOS Simulator,name=iPhone 14'
ls
workingDirectory: "$(Build.ArtifactStagingDirectory)/ios_packaging_artifacts"
displayName: "List staged artifacts for ORT Ext C Pod"
# Note: Running xcodebuild test on `onnxruntime-Package` scheme will perform swift tests for both OnnxRuntimeBindings
# and OnnxRuntimeExtensions targets.
- script: |
set -e -x
cd "$(Build.ArtifactStagingDirectory)/ios_packaging_artifacts"
POD_ARCHIVE=$(find . -name "pod-archive-onnxruntime-extensions-c-*.zip")
cd "$(Build.SourcesDirectory)"
cp "$(Build.ArtifactStagingDirectory)/ios_packaging_artifacts/${POD_ARCHIVE}" swift/
export ORT_EXTENSIONS_IOS_POD_LOCAL_PATH="swift/${POD_ARCHIVE}"
xcodebuild test -scheme onnxruntime-Package -destination 'platform=iOS Simulator,name=iPhone 14'
rm swift/pod-archive-onnxruntime-extensions-c-*.zip
workingDirectory: "$(Build.SourcesDirectory)"
displayName: "Test Package.swift usage"
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
parameters:
condition: 'succeeded'