update Package.swift and move pipelines

This commit is contained in:
rachguo
2023-07-19 13:48:48 -07:00
parent 6dcdf0b6b4
commit ff358ee37a
4 changed files with 6 additions and 8 deletions
@@ -0,0 +1,117 @@
parameters:
- name: BuildType
displayName: |-
Type of build.
"normal": A normal build not for publication.
type: string #TODO: add other build types here
values:
- normal
default: normal
name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format
stages:
- stage: SPM_IOS_Local_Packaging_Testing
dependsOn: []
jobs:
- job: SPMIosPackaging
displayName: "SPM iOS Packaging Local"
pool:
vmImage: "macOS-13"
variables:
xcodeVersion: "14.3"
artifactsName: "ios_packaging_artifacts" #TODO: Add `_full` suffix when syncing to latest main
timeoutInMinutes: 300
steps:
- template: templates/use-xcode-version.yml
parameters:
xcodeVersion: ${{ variables.xcodeVersion }}
# Download artifacts from a specific pipeline
# For now, it consumes rel-1.15.0 version ORT iOS Pod which matches the current source code
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'Lotus'
definition: 995
buildVersionToDownload: 'latest'
branchName: 'rel-1.15.0'
targetPath: '$(Build.ArtifactStagingDirectory)'
- script: |
set -e -x
ls
workingDirectory: '$(Build.ArtifactStagingDirectory)/$(artifactsName)'
displayName: "List staged artifacts"
# copy the pod archive to a path relative to Package.swift and set the env var required by Package.swift to use that.
# xcodebuild will implicitly use Package.swift and build/run the .testTarget (tests in swift/onnxTests).
# once that's done cleanup the copy of the pod zip file
- script: |
set -e -x
cd "$(Build.ArtifactStagingDirectory)/$(artifactsName)"
ARTIFACTS_LIST=$(ls)
POD_ARCHIVE=$(echo "${ARTIFACTS_LIST}" | sed -n '5p')
shasum -a 256 "$(Build.ArtifactStagingDirectory)/$(artifactsName)/${POD_ARCHIVE}"
cd "$(Build.SourcesDirectory)"
cp "$(Build.ArtifactStagingDirectory)/$(artifactsName)/${POD_ARCHIVE}" swift/
export ORT_IOS_POD_LOCAL_PATH="swift/${POD_ARCHIVE}"
xcodebuild test -scheme onnxruntime -destination 'platform=iOS Simulator,name=iPhone 14'
rm swift/pod-archive-onnxruntime-c-*.zip
workingDirectory: "$(Build.SourcesDirectory)"
displayName: "Print ORT iOS Pod checksum and Test Package.swift usage"
- publish: "$(Build.ArtifactStagingDirectory)/$(artifactsName)"
artifact: ios_packaging_artifacts
displayName: "Publish artifacts"
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- stage: SPM_IOS_Release_Packaging_Testing
dependsOn: []
jobs:
- job: SPMIosPackaging
displayName: "SPM iOS Packaging Release"
pool:
vmImage: "macOS-13"
variables:
xcodeVersion: "14.3"
timeoutInMinutes: 300
steps:
- template: templates/use-xcode-version.yml
parameters:
xcodeVersion: ${{ variables.xcodeVersion }}
- script: |
set -e -x
VERSION_FILE="$(Build.SourcesDirectory)/version.txt"
SPM_POD_VERSION="$(cat "${VERSION_FILE}")"
POD_ARCHIVE_URL="https://onnxruntimepackages.z14.web.core.windows.net/pod-archive-onnxruntime-c-${SPM_POD_VERSION}.zip"
curl -o pod-archive-onnxruntime-c-${SPM_POD_VERSION}.zip ${POD_ARCHIVE_URL}
shasum -a 256 "pod-archive-onnxruntime-c-${SPM_POD_VERSION}.zip"
workingDirectory: "$(Build.SourcesDirectory)"
displayName: "Print ORT iOS Release Pod checksum"
- script: |
set -e -x
xcodebuild test -scheme onnxruntime -destination 'platform=iOS Simulator,name=iPhone 14'
workingDirectory: "$(Build.SourcesDirectory)"
displayName: "Test Package.swift usage"
- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
@@ -0,0 +1,18 @@
# component detection for component governance checks
parameters:
- name: condition
type: string
default: 'succeeded' # could be 'ci_only', 'always', 'succeeded'
steps:
- ${{ if eq(variables['System.TeamProject'], 'Lotus') }}:
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
condition:
or(or(and(eq('${{parameters.condition}}', 'ci_only'), and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Scheduled'))),
and(eq('${{parameters.condition}}', 'always'), always())),
and(eq('${{parameters.condition}}', 'succeeded'), succeeded()))
inputs:
# ignore dmlc-core tracker for its CI, which is not used in onnxruntime build
# ignore unit tests in emscripten. emscripten unit tests are not used in onnxruntime build
ignoreDirectories: '$(Build.SourcesDirectory)/cmake/external/emsdk/upstream/emscripten/tests'
@@ -0,0 +1,14 @@
# Specify use of a specific Xcode version.
parameters:
- name: xcodeVersion
type: string
default: "14.3"
steps:
- bash: |
set -e -x
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ parameters.xcodeVersion }}.app/Contents/Developer"
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
displayName: Use Xcode ${{ parameters.xcodeVersion }}