add initial test pipeline
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
parameters:
|
||||
- name: BuildType
|
||||
displayName: |-
|
||||
Type of build.
|
||||
"normal": A normal build not for publication.
|
||||
type: string #TODO: add other build types name here
|
||||
values:
|
||||
- normal
|
||||
default: normal
|
||||
|
||||
name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format
|
||||
|
||||
jobs:
|
||||
- job: IosPackaging
|
||||
displayName: "iOS Packaging"
|
||||
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
|
||||
variables:
|
||||
xcodeVersion: "14.3"
|
||||
|
||||
timeoutInMinutes: 300
|
||||
|
||||
steps:
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: '$(ios_signing_certificate_name)'
|
||||
certPwd: '$(ios_signing_certificate_password)'
|
||||
keychain: 'temp'
|
||||
deleteCert: true
|
||||
displayName: 'Install ORT Mobile Test Signing Certificate'
|
||||
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: '$(ios_provision_profile_name)'
|
||||
removeProfile: true
|
||||
displayName: 'Install ORT Mobile Test Provisioning Profile'
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.9"
|
||||
addToPath: true
|
||||
architecture: "x64"
|
||||
|
||||
- template: templates/use-xcode-version.yml
|
||||
parameters:
|
||||
xcodeVersion: ${{ variables.xcodeVersion }}
|
||||
|
||||
# - template: templates/install-appcenter.yml
|
||||
|
||||
- script: |
|
||||
pip install -r tools/ci_build/github/apple/ios_packaging.requirements.txt
|
||||
displayName: "Install Python requirements"
|
||||
|
||||
- bash: |
|
||||
set -e
|
||||
|
||||
BUILD_TYPE="${{ parameters.BuildType }}"
|
||||
VERSION_FILE="$(Build.SourcesDirectory)/version.txt"
|
||||
BASE_VERSION="$(cat "${VERSION_FILE}")"
|
||||
SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)"
|
||||
DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}"
|
||||
|
||||
case "${BUILD_TYPE}" in
|
||||
("normal")
|
||||
VERSION="${DEV_VERSION}"; SHOULD_UPLOAD_ARCHIVES="false" ;;
|
||||
(*)
|
||||
echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
|
||||
set +x
|
||||
|
||||
set_var() {
|
||||
local VAR_NAME=${1:?}
|
||||
local VAR_VALUE=${2:?}
|
||||
echo "##vso[task.setvariable variable=${VAR_NAME}]${VAR_VALUE}"
|
||||
echo "${VAR_NAME}: ${VAR_VALUE}"
|
||||
}
|
||||
|
||||
set_var "ORT_POD_VERSION" "${VERSION}"
|
||||
set_var "ORT_SHOULD_UPLOAD_ARCHIVES" "${SHOULD_UPLOAD_ARCHIVES}"
|
||||
displayName: "Set variables"
|
||||
|
||||
- script: |
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/protobuf_install -d $(Build.SourcesDirectory)/cmake/deps.txt
|
||||
displayName: "Build Host Protoc"
|
||||
|
||||
# create and test full pods
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/build_and_assemble_ios_pods.py \
|
||||
--build-dir "$(Build.BinariesDirectory)/ios_framework_full" \
|
||||
--staging-dir "$(Build.BinariesDirectory)/staging" \
|
||||
--pod-version "${ORT_POD_VERSION}" \
|
||||
--test \
|
||||
--variant Full \
|
||||
--build-settings-file tools/ci_build/github/apple/default_full_ios_framework_build_settings.json \
|
||||
-b="--path_to_protoc_exe" -b "$(Build.BinariesDirectory)/protobuf_install/bin/protoc"
|
||||
displayName: "[Full] Build iOS framework and assemble pod package files"
|
||||
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/test_ios_packages.py \
|
||||
--fail_if_cocoapods_missing \
|
||||
--framework_info_file "$(Build.BinariesDirectory)/ios_framework_full/framework_info.json" \
|
||||
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework_full/framework_out" \
|
||||
--variant Full \
|
||||
--test_project_stage_dir "$(Build.BinariesDirectory)/app_center_test_full" \
|
||||
--prepare_test_project_only
|
||||
displayName: "[Full] Assemble test project for App Center"
|
||||
|
||||
- task: Xcode@5
|
||||
inputs:
|
||||
actions: 'build-for-testing'
|
||||
configuration: 'Debug'
|
||||
xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test_full/ios_package_test/ios_package_test.xcworkspace'
|
||||
sdk: 'iphoneos'
|
||||
scheme: 'ios_package_test'
|
||||
signingOption: 'manual'
|
||||
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
|
||||
provisioningProfileName: 'iOS Team Provisioning Profile'
|
||||
args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test_full/ios_package_test/DerivedData'
|
||||
workingDirectory: $(Build.BinariesDirectory)/app_center_test_full/ios_package_test/
|
||||
displayName: '[Full] Build iphone arm64 tests'
|
||||
|
||||
# - script: |
|
||||
# set -e -x
|
||||
# appcenter test run xcuitest \
|
||||
# --app "AI-Frameworks/ORT-Mobile-iOS" \
|
||||
# --devices $(app_center_test_devices) \
|
||||
# --test-series "master" \
|
||||
# --locale "en_US" \
|
||||
# --build-dir $(Build.BinariesDirectory)/app_center_test_full/ios_package_test/DerivedData/Build/Products/Debug-iphoneos \
|
||||
# --token $(app_center_api_token)
|
||||
# displayName: "[Full] Run E2E tests on App Center"
|
||||
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'AIInfraBuildOnnxRuntimeOSS'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'scriptPath'
|
||||
scriptPath: 'tools/ci_build/github/apple/assemble_ios_packaging_artifacts.sh'
|
||||
arguments: >-
|
||||
"$(Build.BinariesDirectory)/staging"
|
||||
"$(Build.ArtifactStagingDirectory)"
|
||||
"$(ORT_POD_VERSION)"
|
||||
"$(ORT_SHOULD_UPLOAD_ARCHIVES)"
|
||||
displayName: "Assemble artifacts"
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
ls -R "$(Build.ArtifactStagingDirectory)"
|
||||
displayName: "List staged artifacts"
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
shasum -a 256 "$(Build.ArtifactStagingDirectory)/pod-archive-onnxruntime-c-${ORT_POD_VERSION}.zip"
|
||||
displayName: "Print ORT iOS Pod checksum"
|
||||
|
||||
|
||||
# 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
|
||||
cp "$(Build.ArtifactStagingDirectory)/pod-archive-onnxruntime-c-${ORT_POD_VERSION}.zip" swift/
|
||||
export ORT_IOS_POD_LOCAL_PATH="swift/pod-archive-onnxruntime-c-${ORT_POD_VERSION}.zip"
|
||||
xcodebuild test -scheme onnxruntime -destination 'platform=iOS Simulator,name=iPhone 14'
|
||||
rm swift/pod-archive-onnxruntime-c-*.zip
|
||||
displayName: "Test Package.swift usage"
|
||||
|
||||
- publish: "$(Build.ArtifactStagingDirectory)"
|
||||
artifact: ios_packaging_artifacts
|
||||
displayName: "Publish artifacts"
|
||||
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
set -e -x
|
||||
|
||||
INSTALL_PREFIX='/usr'
|
||||
DEP_FILE_PATH='/tmp/scripts/deps.txt'
|
||||
while getopts "p:d:" parameter_Option
|
||||
do case "${parameter_Option}"
|
||||
in
|
||||
p) INSTALL_PREFIX=${OPTARG};;
|
||||
d) DEP_FILE_PATH=${OPTARG};;
|
||||
esac
|
||||
done
|
||||
|
||||
EXTRA_CMAKE_ARGS=""
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin*)
|
||||
echo 'Building ONNX Runtime on Mac OS X'
|
||||
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
|
||||
;;
|
||||
Linux*)
|
||||
# Depending on how the compiler has been configured when it was built, sometimes "gcc -dumpversion" shows the full version.
|
||||
GCC_VERSION=$(gcc -dumpversion | cut -d . -f 1)
|
||||
#-fstack-clash-protection prevents attacks based on an overlapping heap and stack.
|
||||
if [ "$GCC_VERSION" -ge 8 ]; then
|
||||
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||
CXXFLAGS="$CXXFLAGS -fstack-clash-protection"
|
||||
fi
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if [ "$ARCH" == "x86_64" ] && [ "$GCC_VERSION" -ge 9 ]; then
|
||||
CFLAGS="$CFLAGS -fcf-protection"
|
||||
CXXFLAGS="$CXXFLAGS -fcf-protection"
|
||||
fi
|
||||
export CFLAGS
|
||||
export CXXFLAGS
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
mkdir -p $INSTALL_PREFIX
|
||||
echo "Installing protobuf ..."
|
||||
protobuf_url=$(grep '^protobuf' $DEP_FILE_PATH | cut -d ';' -f 2 )
|
||||
if [[ "$protobuf_url" = https* ]]; then
|
||||
protobuf_url=$(echo $protobuf_url | sed 's/\.zip$/\.tar.gz/')
|
||||
curl -sSL --retry 5 --retry-delay 10 --create-dirs --fail -L -o protobuf_src.tar.gz $protobuf_url
|
||||
mkdir protobuf
|
||||
cd protobuf
|
||||
tar -zxf ../protobuf_src.tar.gz --strip=1
|
||||
else
|
||||
cp $protobuf_url protobuf_src.zip
|
||||
unzip protobuf_src.zip
|
||||
cd protobuf-*
|
||||
fi
|
||||
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -Dprotobuf_WITH_ZLIB_DEFAULT=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF $EXTRA_CMAKE_ARGS
|
||||
make -j$(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
cd ..
|
||||
@@ -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,12 @@
|
||||
# Install appcenter CLI
|
||||
|
||||
parameters:
|
||||
- name: appcenterVersion
|
||||
type: string
|
||||
default: "2.13.7"
|
||||
|
||||
steps:
|
||||
- bash: |
|
||||
set -e -x
|
||||
npm install -g appcenter-cli@${{ parameters.appcenterVersion }}
|
||||
displayName: Install appcenter CLI ${{ parameters.appcenterVersion }}
|
||||
@@ -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 }}
|
||||
Reference in New Issue
Block a user