Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
289 changes: 289 additions & 0 deletions azure_pipelines/cred_management/cred-management-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
# =============================================================================

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not update CHANGELOG.md.

Please consider if this change would be noticeable to a partner or user and either update CHANGELOG.md or resolve this conversation.

# MSALNativeCredManagment SDK — Release Pipeline (SPM + XCFramework)
# =============================================================================
#
# This pipeline builds the credential management SDK for release distribution.
#
# Triggers:
# - Tag push matching 'credmgmt/*' (e.g., credmgmt/1.0.0)
#
# Stages:
# 1. PR Validation — Build iOS + macOS, run unit tests, validate SPM resolution
# 2. Build Release — Create versioned XCFramework artifact
# 3. Publish — Attach XCFramework to pipeline artifacts
#
# Distribution: Swift Package Manager only (no CocoaPods).
# =============================================================================

trigger:
tags:
include:
- 'credmgmt/*'
branches:
include:
- sedemche/ciam-cred-managment-release

pr:
branches:
include:
- sedemche/ciam-cred-managment-release

variables:
SDK_PATH: 'lib/native/MSALNativeCredManagment'
XCODE_VERSION: '16.2'
XCFRAMEWORK_OUTPUT: '$(Build.ArtifactStagingDirectory)/MSALNativeCredManagment.xcframework'

stages:

# =============================================================================
# Stage 1: Validate — Build & Test
# =============================================================================
- stage: Validate
displayName: 'Validate SDK (Build + Test)'
jobs:

- job: Build_iOS
displayName: 'Build & Test — iOS'
pool:
vmImage: 'macOS-14'
timeoutInMinutes: 30
steps:
- checkout: self
clean: true
submodules: true
fetchDepth: 1

- script: |
sudo xcode-select -s /Applications/Xcode_$(XCODE_VERSION).app
displayName: 'Select Xcode $(XCODE_VERSION)'

- script: |
cd $(SDK_PATH)
xcodebuild -resolvePackageDependencies \
-scheme MSALNativeCredManagment \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages
displayName: 'Resolve iOS Package Dependencies'

- script: |
cd $(SDK_PATH)
xcodebuild build-for-testing \
-scheme MSALNativeCredManagment \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
-derivedDataPath $(Build.BinariesDirectory)/ios \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
| xcpretty

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without set -o pipefail, an xcodebuild failure is masked when xcpretty exits successfully. Preserve the xcodebuild exit status so failed iOS builds fail validation.

displayName: 'Build iOS'

- script: |
cd $(SDK_PATH)
xcodebuild test-without-building \
-scheme MSALNativeCredManagment \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
-derivedDataPath $(Build.BinariesDirectory)/ios \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
-resultBundlePath $(Build.ArtifactStagingDirectory)/TestResults-iOS.xcresult \
| xcpretty --report junit --output $(Build.ArtifactStagingDirectory)/test-results-ios.xml
displayName: 'Run Unit Tests — iOS'
continueOnError: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failures are explicitly allowed here, so the Release stage can publish an XCFramework after failed tests. Remove continueOnError from both platform test steps if tests gate release.


- task: PublishTestResults@2
condition: always()
displayName: 'Publish iOS Test Results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(Build.ArtifactStagingDirectory)/test-results-ios.xml'
testRunTitle: 'CredManagement iOS Tests'

- job: Build_macOS
displayName: 'Build & Test — macOS'
pool:
vmImage: 'macOS-14'
timeoutInMinutes: 30
steps:
- checkout: self
clean: true
submodules: true
fetchDepth: 1

- script: |
sudo xcode-select -s /Applications/Xcode_$(XCODE_VERSION).app
displayName: 'Select Xcode $(XCODE_VERSION)'

- script: |
cd $(SDK_PATH)
xcodebuild -resolvePackageDependencies \
-scheme MSALNativeCredManagment \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages
displayName: 'Resolve macOS Package Dependencies'

- script: |
cd $(SDK_PATH)
xcodebuild build \
-scheme MSALNativeCredManagment \
-destination 'platform=macOS' \
-derivedDataPath $(Build.BinariesDirectory)/macos \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
displayName: 'Build macOS'

- script: |
cd $(SDK_PATH)
xcodebuild test \
-scheme MSALNativeCredManagment \
-destination 'platform=macOS' \
-derivedDataPath $(Build.BinariesDirectory)/macos \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
-resultBundlePath $(Build.ArtifactStagingDirectory)/TestResults-macOS.xcresult \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO \
| xcpretty --report junit --output $(Build.ArtifactStagingDirectory)/test-results-macos.xml
displayName: 'Run Unit Tests — macOS'
continueOnError: true

- task: PublishTestResults@2
condition: always()
displayName: 'Publish macOS Test Results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(Build.ArtifactStagingDirectory)/test-results-macos.xml'
testRunTitle: 'CredManagement macOS Tests'

- job: Validate_SPM
displayName: 'Validate SPM Resolution'
pool:
vmImage: 'macOS-14'
timeoutInMinutes: 15
steps:
- checkout: self
clean: true
submodules: true
fetchDepth: 1

- script: |
sudo xcode-select -s /Applications/Xcode_$(XCODE_VERSION).app
displayName: 'Select Xcode $(XCODE_VERSION)'

- script: |
cd $(SDK_PATH)
swift package resolve
displayName: 'SPM — Resolve Dependencies'

- script: |
cd $(SDK_PATH)
swift build
displayName: 'SPM — Build (Debug)'

- script: |
cd $(SDK_PATH)
swift build -c release
displayName: 'SPM — Build (Release)'

# =============================================================================
# Stage 2: Release — Build XCFramework
# =============================================================================
- stage: Release
displayName: 'Build XCFramework'
dependsOn: Validate
condition: succeeded()
jobs:

- job: Build_XCFramework
displayName: 'Archive & Create XCFramework'
pool:
vmImage: 'macOS-14'
timeoutInMinutes: 45
steps:
- checkout: self
clean: true
submodules: true
fetchDepth: 1

- script: |
sudo xcode-select -s /Applications/Xcode_$(XCODE_VERSION).app
displayName: 'Select Xcode $(XCODE_VERSION)'

# Extract version from tag (credmgmt/1.0.0 → 1.0.0) or use 'dev' for branch builds
- script: |
if [[ "$(Build.SourceBranch)" == refs/tags/credmgmt/* ]]; then
TAG_NAME=$(echo "$(Build.SourceBranchName)")
echo "##vso[task.setvariable variable=SDK_VERSION]${TAG_NAME}"
echo "SDK Version: ${TAG_NAME}"
else
echo "##vso[task.setvariable variable=SDK_VERSION]dev-$(Build.BuildNumber)"
echo "SDK Version: dev-$(Build.BuildNumber)"
fi
displayName: 'Extract Version'

- script: |
cd $(SDK_PATH)
xcodebuild -resolvePackageDependencies \
-scheme MSALNativeCredManagment \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages
displayName: 'Resolve Package Dependencies'

# Archive for iOS device
- script: |
cd $(SDK_PATH)
xcodebuild archive \
-scheme MSALNativeCredManagment \
-destination 'generic/platform=iOS' \
-archivePath $(Build.BinariesDirectory)/archives/ios.xcarchive \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
displayName: 'Archive — iOS Device'

# Archive for iOS Simulator
- script: |
cd $(SDK_PATH)
xcodebuild archive \
-scheme MSALNativeCredManagment \
-destination 'generic/platform=iOS Simulator' \
-archivePath $(Build.BinariesDirectory)/archives/ios-simulator.xcarchive \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
displayName: 'Archive — iOS Simulator'

# Archive for macOS
- script: |
cd $(SDK_PATH)
xcodebuild archive \
-scheme MSALNativeCredManagment \
-destination 'generic/platform=macOS' \
-archivePath $(Build.BinariesDirectory)/archives/macos.xcarchive \
-clonedSourcePackagesDirPath $(Build.BinariesDirectory)/spm-packages \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
displayName: 'Archive — macOS'

# Create XCFramework from all archives
- script: |
xcodebuild -create-xcframework \
-framework $(Build.BinariesDirectory)/archives/ios.xcarchive/Products/Library/Frameworks/MSALNativeCredManagment.framework \
-framework $(Build.BinariesDirectory)/archives/ios-simulator.xcarchive/Products/Library/Frameworks/MSALNativeCredManagment.framework \
-framework $(Build.BinariesDirectory)/archives/macos.xcarchive/Products/Library/Frameworks/MSALNativeCredManagment.framework \
-output $(XCFRAMEWORK_OUTPUT)
displayName: 'Create XCFramework'

# Zip for distribution
- script: |
cd $(Build.ArtifactStagingDirectory)
zip -r MSALNativeCredManagment-$(SDK_VERSION).xcframework.zip MSALNativeCredManagment.xcframework
displayName: 'Zip XCFramework'

- task: PublishBuildArtifacts@1
displayName: 'Publish XCFramework Artifact'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)/MSALNativeCredManagment-$(SDK_VERSION).xcframework.zip'
artifactName: 'MSALNativeCredManagment-XCFramework'
publishLocation: 'Container'

- task: PublishBuildArtifacts@1
displayName: 'Publish Raw XCFramework'
inputs:
pathToPublish: '$(XCFRAMEWORK_OUTPUT)'
artifactName: 'MSALNativeCredManagment-XCFramework-Raw'
publishLocation: 'Container'
3 changes: 3 additions & 0 deletions lib/native/MSALNativeCredManagment/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [0.1.0]
* Initial implementation of MSAL Native Credential Management SDK.
* Add credential method support for CIAM scenarios.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Minimal MSAL_Private module for credential management.
// Exposes IdentityCore types needed by Swift code (logger, context).
// Paths are relative to this modulemap file's location.
module MSAL_Private {
header "../../../../../MSAL/IdentityCore/IdentityCore/src/MSIDBasicContext.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/logger/MSIDLogger.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/logger/MSIDLogger+Internal.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/logger/MSIDMaskedHashableLogParameter.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/logger/MSIDMaskedLogParameter.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/logger/MSIDMaskedUsernameLogParameter.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/MSIDError.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/oauth2/MSIDExternalSSOContext.h"
header "../../../../../MSAL/IdentityCore/IdentityCore/src/parameters/MSIDRequestParameters.h"
export *
}
24 changes: 24 additions & 0 deletions lib/native/MSALNativeCredManagment/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
Loading