Skip to content

Commit 8c2dce3

Browse files
authored
Add Native Auth E2E tests to CI. Skip Native Auth E2E tests in pr-validation if label is present (#2274)
* Add MSAL Native Auth E2E tests to the pr-validation.yml script * Add condition to skip the NativeAuth E2E tests if label skip-native-auth-e2e-tests is included in the PR * Add MSAL Native Auth E2E tests to the automation.yml script
1 parent 021181d commit 8c2dce3

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

azure_pipelines/automation.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ jobs:
7979
issue_body = '''@AzureAD/appleidentity \nAutomation failed for [$(repositoryName)]({0}) ran against commit : {1} \n Pipeline URL : [{2}]({2})'''.format('$(Build.Repository.Uri)', git_commit, pipeline_uri)
8080
github.create_issue(github_org, repo, issue_title, issue_body, labels=['automation failure'])
8181
82+
- job: e2e_test_native_auth
83+
displayName: 'Run MSAL E2E tests for native auth'
84+
timeoutInMinutes: 30
85+
cancelTimeoutInMinutes: 5
86+
workspace:
87+
clean: all
88+
89+
steps:
90+
- template: templates/tests-with-conf-file.yml
91+
parameters:
92+
schema: 'MSAL iOS Native Auth E2E Tests'
93+
build: 'MSAL iOS Native Auth E2E Tests_MSAL iOS Native Auth E2E Tests'
94+
8295
- job: cocoapods_lib_lint
8396
displayName: Run Cocoapods lib lint
8497
timeoutInMinutes: 30

azure_pipelines/pr-validation.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,55 @@ jobs:
8484
failTaskOnFailedTests: true
8585
testRunTitle: 'Test Run - $(target)'
8686

87+
- job: fetch_pr_labels
88+
displayName: 'Check for PR Label'
89+
timeoutInMinutes: 5
90+
pool:
91+
vmImage: 'macOS-14'
92+
steps:
93+
- script: |
94+
url="https://api.github.com/repos/$BUILD_REPOSITORY_ID/issues/$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/labels"
95+
96+
echo "Fetching labels from $url "
97+
98+
# Temporary file to store the raw response
99+
temp_file=$(mktemp)
100+
101+
# Store the response code and the raw response in separate variables
102+
response_code=$(curl -s -w "%{http_code}" -o "$temp_file" "$url")
103+
response_content=$(cat "$temp_file")
104+
105+
echo "Response code: $response_code"
106+
echo "Raw response: $response_content"
107+
108+
if [[ "$response_code" -eq 200 ]]; then
109+
label_names=$(echo $response_content | jq -r '.[].name' | paste -sd ', ' -)
110+
echo "##vso[task.setvariable variable=PR_LABELS;isOutput=true]$label_names"
111+
[ -z "$label_names" ] && echo "PR labels: <empty>" || echo "PR labels: $label_names"
112+
else
113+
echo "Request failed with status code: $response_code - Skipping Native Auth E2E tests as a preventive measure"
114+
echo "##vso[task.setvariable variable=PR_LABELS;isOutput=true]'skip-native-auth-e2e-tests'"
115+
fi
116+
117+
name: fetchPrLabels
118+
119+
- job: e2e_test_native_auth
120+
displayName: 'Run MSAL E2E tests for native auth'
121+
dependsOn: fetch_pr_labels
122+
condition: and( succeeded(), not(contains(dependencies.fetch_pr_labels.outputs['fetchPrLabels.PR_LABELS'], 'skip-native-auth-e2e-tests')) )
123+
timeoutInMinutes: 30
124+
cancelTimeoutInMinutes: 5
125+
pool:
126+
vmImage: 'macOS-14'
127+
workspace:
128+
clean: all
129+
130+
steps:
131+
- template: templates/tests-with-conf-file.yml
132+
parameters:
133+
schema: 'MSAL iOS Native Auth E2E Tests'
134+
build: 'MSAL iOS Native Auth E2E Tests_MSAL iOS Native Auth E2E Tests'
135+
87136
- job: 'Validate_SPM_Integration'
88137
displayName: Validate SPM Integration
89138
pool:

0 commit comments

Comments
 (0)