diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml index c3176ec54fd79..23c968f35a27f 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml @@ -27,6 +27,12 @@ pr: - 'js/web' - 'onnxruntime/core/providers/js' #### end trigger #### +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release parameters: - name: buildType @@ -41,59 +47,29 @@ parameters: default: normal name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format - -stages: -- stage: IosPackaging_SetCommonVariables - dependsOn: [] - - variables: - skipComponentGovernanceDetection: true - - jobs: - - job: j - displayName: "Set common variables" - +extends: + # The pipeline extends the 1ES PT which will inject different SDL and compliance tasks. + # For non-production pipelines, use "Unofficial" as defined below. + # For productions pipelines, use "Official". + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + # Update the pool with your team's 1ES hosted pool. pool: - vmImage: "macOS-13" - - timeoutInMinutes: 5 - - steps: - - bash: | - set -e + name: "Azure Pipelines" + image: "macOS-13" + os: macOS + sdl: + sourceAnalysisPool: + name: onnxruntime-Win-CPU-2022 + os: windows + stages: - BUILD_TYPE="${{ parameters.buildType }}" - BASE_VERSION="$(cat ./VERSION_NUMBER)" - SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)" - DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}" + - template: templates/stages/mac-ios-packaging-build-stage.yml + parameters: + packageVariant: Full + buildType: ${{ parameters.buildType }} - case "${BUILD_TYPE}" in - ("release") - VERSION="${BASE_VERSION}" ;; - ("normal") - VERSION="${DEV_VERSION}" ;; - (*) - 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};isoutput=true;isreadonly=true]${VAR_VALUE}" - echo "${VAR_NAME}: ${VAR_VALUE}" - } - - set_var "ORT_POD_VERSION" "${VERSION}" - displayName: "Set common variables" - name: SetCommonVariables - -- template: templates/stages/mac-ios-packaging-build-stage.yml - parameters: - packageVariant: Full - -- template: templates/stages/mac-ios-packaging-build-stage.yml - parameters: - packageVariant: Training + - template: templates/stages/mac-ios-packaging-build-stage.yml + parameters: + packageVariant: Training + buildType: ${{ parameters.buildType }} diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 5d7ea5e7b2727..90670858c8417 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -5,27 +5,26 @@ parameters: - Full - Training +- name: buildType + type: string + values: + - release + - normal + default: normal + stages: - stage: IosPackaging_Build_${{ parameters.packageVariant }} - dependsOn: - - IosPackaging_SetCommonVariables - + dependsOn: [] jobs: - - job: j + - job: displayName: "Build iOS package for variant: ${{ parameters.packageVariant}}" - pool: - vmImage: "macOS-13" - variables: # Note: Keep the Xcode version and iOS simulator version compatible. # Check the table here to see what iOS simulator versions are supported by a particular Xcode version: # https://developer.apple.com/support/xcode/ xcodeVersion: "14.3.1" iosSimulatorRuntimeVersion: "16.4" - - ortPodVersion: $[stageDependencies.IosPackaging_SetCommonVariables.j.outputs['SetCommonVariables.ORT_POD_VERSION']] - ${{ if eq(parameters.packageVariant, 'Full') }}: buildSettingsFile: "tools/ci_build/github/apple/default_full_apple_framework_build_settings.json" cPodName: onnxruntime-c @@ -35,10 +34,38 @@ stages: buildSettingsFile: "tools/ci_build/github/apple/default_training_ios_framework_build_settings.json" cPodName: onnxruntime-training-c objcPodName: onnxruntime-training-objc - timeoutInMinutes: 240 + templateContext: + outputs: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: ios_packaging_artifacts_${{ lower(parameters.packageVariant) }} steps: + - bash: | + set -e + + BUILD_TYPE="${{ parameters.buildType }}" + BASE_VERSION="$(cat ./VERSION_NUMBER)" + SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)" + DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}" + + case "${BUILD_TYPE}" in + ("release") + VERSION="${BASE_VERSION}" ;; + ("normal") + VERSION="${DEV_VERSION}" ;; + (*) + 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 + echo "##vso[task.setvariable variable=ortPodVersion;]${VERSION}" + echo "ortPodVersion : ${ortPodVersion}, VERSION : ${VERSION}" + displayName: "Set common variables" + name: SetCommonVariables + - script: | if [[ -z "$(ortPodVersion)" ]]; then echo "ORT pod version is unspecified. Make sure that the IosPackaging_SetCommonVariables stage has run." @@ -160,9 +187,11 @@ stages: # Publish the BrowserStack artifacts first so that if the next step fails, the artifacts will still be published # so that users can attempt to locally debug - - publish: "$(Build.ArtifactStagingDirectory)" - artifact: "browserstack_test_artifacts_${{ lower(parameters.packageVariant) }}" - displayName: "Publish BrowserStack test artifacts" + - task: 1ES.PublishPipelineArtifact@1 + inputs: + path: $(Build.ArtifactStagingDirectory) + artifact: browserstack_test_artifacts_${{ lower(parameters.packageVariant) }} + displayName: "Publish BrowserStack artifacts" - script: | set -e -x @@ -200,10 +229,6 @@ stages: ls -R "$(Build.ArtifactStagingDirectory)" displayName: "List staged artifacts" - - publish: "$(Build.ArtifactStagingDirectory)" - artifact: "ios_packaging_artifacts_${{ lower(parameters.packageVariant) }}" - displayName: "Publish artifacts" - - template: ../component-governance-component-detection-steps.yml - parameters : - condition : 'succeeded' + parameters: + condition: 'succeeded'