|
| 1 | +# Pipeline will be triggered for PR & any updates on the PR on all branches |
| 2 | +pr: |
| 3 | + branches: |
| 4 | + include: |
| 5 | + - '*' |
| 6 | + |
| 7 | +# Trigger CI for only main/release branches |
| 8 | +trigger: |
| 9 | + branches: |
| 10 | + include: |
| 11 | + - main |
| 12 | + - release/* |
| 13 | + |
| 14 | +resources: |
| 15 | + repositories: |
| 16 | + - repository: microsoft-authentication-library-for-objc |
| 17 | + type: github |
| 18 | + endpoint: 'MSAL ObjC Service Connection' |
| 19 | + name: AzureAD/microsoft-authentication-library-for-objc |
| 20 | + |
| 21 | +# Define parallel jobs that run build script for specified targets |
| 22 | +jobs: |
| 23 | +- job: 'Validate_Pull_Request' |
| 24 | + strategy: |
| 25 | + maxParallel: 3 |
| 26 | + matrix: |
| 27 | + IOS_FRAMEWORK: |
| 28 | + target: "iosFramework iosTestApp sampleIosApp sampleIosAppSwift" |
| 29 | + MAC_FRAMEWORK: |
| 30 | + target: "macFramework" |
| 31 | + VISION_FRAMEWORK: |
| 32 | + target: "visionOSFramework" |
| 33 | + displayName: Validate Pull Request |
| 34 | + pool: |
| 35 | + vmImage: 'macOS-14' |
| 36 | + timeOutInMinutes: 30 |
| 37 | + |
| 38 | + steps: |
| 39 | + - script: | |
| 40 | + /bin/bash -c "sudo xcode-select -s /Applications/Xcode_15.4.app" |
| 41 | + displayName: 'Switch to use Xcode 15.4' |
| 42 | + - task: CmdLine@2 |
| 43 | + displayName: Installing dependencies |
| 44 | + inputs: |
| 45 | + script: | |
| 46 | + gem install xcpretty slather bundler -N |
| 47 | + failOnStderr: true |
| 48 | + |
| 49 | +# The following is needed to install the visionOS SDK on macos-14 vm image which |
| 50 | +# doesn't have visionOS installed by default. |
| 51 | +# TODO: Remove when macos-14-arm64 is supported on ADO. |
| 52 | + - task: Bash@3 |
| 53 | + displayName: download visionOS SDK |
| 54 | + inputs: |
| 55 | + targetType: 'inline' |
| 56 | + script: | |
| 57 | + echo $(target) |
| 58 | + if [ $(target) == 'visionOSFramework' ]; then |
| 59 | + echo "Downloading simulator for visionOS" |
| 60 | + sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer |
| 61 | + defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES |
| 62 | + defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES |
| 63 | + xcodebuild -downloadPlatform visionOS |
| 64 | + else |
| 65 | + echo "Not visionOS job, no download needed" |
| 66 | + fi |
| 67 | + failOnStderr: false |
| 68 | + |
| 69 | + - checkout: microsoft-authentication-library-for-objc |
| 70 | + displayName: 'Checkout MSAL' |
| 71 | + clean: true |
| 72 | + submodules: true |
| 73 | + fetchTags: true |
| 74 | + persistCredentials: true |
| 75 | + |
| 76 | + - checkout: self |
| 77 | + clean: true |
| 78 | + submodules: false |
| 79 | + fetchDepth: 1 |
| 80 | + path: 's/microsoft-authentication-library-for-objc/MSAL/IdentityCore' |
| 81 | + persistCredentials: false |
| 82 | + |
| 83 | + - task: Bash@3 |
| 84 | + displayName: Run Build script & check for Errors |
| 85 | + inputs: |
| 86 | + targetType: 'inline' |
| 87 | + script: | |
| 88 | + cd $(Agent.BuildDirectory)/s/microsoft-authentication-library-for-objc |
| 89 | + { output=$(./build.py --target $(target) 2>&1 1>&3-) ;} 3>&1 |
| 90 | + final_status=$(<./build/status.txt) |
| 91 | + echo "FINAL STATUS = ${final_status}" |
| 92 | + echo "POSSIBLE ERRORS: ${output}" |
| 93 | + |
| 94 | + if [ $final_status != "0" ]; then |
| 95 | + echo "Build & Testing Failed! \n ${output}" >&2 |
| 96 | + fi |
| 97 | + failOnStderr: true |
| 98 | + - task: Bash@3 |
| 99 | + condition: always() |
| 100 | + displayName: Cleanup |
| 101 | + inputs: |
| 102 | + targetType: 'inline' |
| 103 | + script: | |
| 104 | + rm -rf $(Agent.BuildDirectory)/s/build/status.txt |
| 105 | + - task: PublishTestResults@2 |
| 106 | + condition: always() |
| 107 | + displayName: Publish Test Report |
| 108 | + inputs: |
| 109 | + testResultsFormat: 'JUnit' |
| 110 | + testResultsFiles: '$(Agent.BuildDirectory)/s/build/reports/*' |
| 111 | + failTaskOnFailedTests: true |
| 112 | + testRunTitle: 'Test Run - $(target)' |
0 commit comments