Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage to ADAL #1650

Open
wants to merge 25 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fa40f3d
added code coverage
paulkagiri Aug 9, 2021
9b38bd5
common submodule update
paulkagiri Aug 9, 2021
0547de9
Merge branch 'dev' into paul/code-coverage
paulkagiri Aug 9, 2021
165666e
updated buildsystem plugin to get code coverage
paulkagiri Oct 4, 2021
a89c26c
updated changelog
paulkagiri Oct 4, 2021
4c632dd
updated common
paulkagiri Oct 5, 2021
38f4276
Merge branch 'paul/code-coverage' of https://github.com/AzureAD/azure…
paulkagiri Oct 5, 2021
797e22d
purged old code coverage tasks
paulkagiri Oct 5, 2021
fedeaf3
updated common
paulkagiri Oct 6, 2021
16848f3
updated the code coverage tool
paulkagiri Oct 14, 2021
816808f
updated common
paulkagiri Oct 21, 2021
eb9af1c
added Code coverage action
paulkagiri Oct 28, 2021
4bf37b3
roboelectric sdk version set
paulkagiri Nov 1, 2021
2282d8a
submodules fix
paulkagiri Nov 1, 2021
e687f2a
just testing
paulkagiri Nov 1, 2021
3cf6884
updated the buildsystem plugin
paulkagiri Nov 1, 2021
655afc3
purged -Plabtest
paulkagiri Nov 3, 2021
a32f2bf
common update
paulkagiri Nov 11, 2021
65e83b6
Merge branch 'dev' into paul/code-coverage
paulkagiri Nov 11, 2021
7c1d63d
updated common
paulkagiri Jan 11, 2022
161f544
Merge branch 'dev' into paul/code-coverage
paulkagiri Jan 11, 2022
27980ba
moved the code coverage pipeline to Azure and also added a code cover…
paulkagiri Jan 11, 2022
a94af0f
purged some minor comments
paulkagiri Jan 19, 2022
9d9c04a
Merge branch 'dev' into paul/code-coverage
gitaumoses4 Feb 9, 2022
7e9c173
added androidTestsCodeCoverageEnabled flag
paulkagiri Feb 15, 2022
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ integration_tests.properties
*.iws
.idea/
*.pom
jacoco-agent.properties
20 changes: 18 additions & 2 deletions adal/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.microsoft.identity.buildsystem' version '0.1.0'
id 'com.microsoft.identity.buildsystem' version '0.2.3'
id 'com.android.library'
id 'pmd'
id 'checkstyle'
Expand All @@ -18,6 +18,22 @@ buildSystem {
desugar = desugarCode
}

def enableCodeCoverage = true
def enableAndroidTestsCodeCoverage = true

if (project.hasProperty("codeCoverageEnabled")) {
enableCodeCoverage = codeCoverageEnabled.toBoolean()
}

if (project.hasProperty("androidTestsCodeCoverageEnabled")) {
enableAndroidTestsCodeCoverage = androidTestsCodeCoverageEnabled.toBoolean()
}

codeCoverageReport {
coverage.enabled = enableCodeCoverage
androidTests.enabled = enableAndroidTestsCodeCoverage
}

group = 'com.microsoft.aad'

configurations {
Expand Down Expand Up @@ -68,7 +84,7 @@ android {
}
buildTypes {
debug {
testCoverageEnabled false
testCoverageEnabled enableCodeCoverage
debuggable true
buildConfigField("String", "VERSION_NAME", "\"${versionName}\"")
}
Expand Down
73 changes: 73 additions & 0 deletions azure-pipelines/code-coverage/adal-code-cov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# File: azure-pipelines\code-coverage\adal-code-cov.yml
# Description: Code coverage for adal
# Variable: 'mvnAccessToken' was defined in the Variables tab
# https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate
name: $(date:yyyyMMdd)$(rev:.r)

trigger: none

pr:
branches:
include:
- '*'

variables:
- name: BuildParameters.jdkVersion
value: 1.8
- name: BuildParameters.jdkArchitecture
value: x64
- name: BuildParameters.javaHomeSelection
value: JDKVersion
- name: robolectricSdkVersion
value: 28

resources:
repositories:
- repository: self
type: git
- repository: common
type: github
name: AzureAD/microsoft-authentication-library-common-for-android
ref: dev
endpoint: ANDROID_GITHUB

jobs:
- job: adal_code_coverage
displayName: ADAL Code Coverage
pool:
name: Hosted Windows 2019 with VS2019
steps:
- checkout: self
displayName: Checkout ADAL Repository
clean: true
submodules: recursive
persistCredentials: True
- template: azure-pipelines/templates/steps/automation-cert.yml@common
- task: JavaToolInstaller@0
displayName: Use Java 8
inputs:
jdkArchitectureOption: x64
jdkSourceOption: PreInstalled
- task: Gradle@1
displayName: Assemble Release
inputs:
tasks: clean adal:assembleLocal
publishJUnitResults: false
jdkVersion: $(BuildParameters.jdkVersion)
jdkArchitecture: $(BuildParameters.jdkArchitecture)
sqGradlePluginVersion: 2.0.1
- task: Gradle@2
displayName: Run ADAL Code Coverage
inputs:
tasks: adal:localDebugAdalUnitTestCoverageReport -Plabtest -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PcodeCoverageEnabled=true -PandroidTestsCodeCoverageEnabled=true
- task: PublishCodeCoverageResults@1
displayName: Publish Code Coverage Report
inputs:
summaryFileLocation: '$(Build.SourcesDirectory)\adal\build\reports\jacoco\localDebugAdalUnitTestCoverageReport\localDebugAdalUnitTestCoverageReport.xml'
reportDirectory: '$(Build.SourcesDirectory)\adal\build\reports\jacoco\localDebugAdalUnitTestCoverageReport\html'
javaHomeSelection: $(BuildParameters.javaHomeSelection)
jdkVersion: 1.11
- bash: |
curl -Os https://uploader.codecov.io/latest/windows/codecov.exe
./codecov.exe -v -t '$(codecovToken)' -B '$(System.PullRequest.SourceBranch)' -P '$(System.PullRequest.PullRequestNumber)' -f "./adal/build/reports/jacoco/localDebugAdalUnitTestCoverageReport/localDebugAdalUnitTestCoverageReport.xml"
displayName: Upload Code Coverage to Codecov and the PR
2 changes: 1 addition & 1 deletion common
Submodule common updated 44 files
+0 −25 .github/workflows/codecov.yml
+0 −3 .gitignore
+1 −1 LabApiUtilities/build.gradle
+17 −9 azure-pipelines/code-coverage/common.yml
+0 −108 azure-pipelines/continous-delivery/common.yml
+111 −0 azure-pipelines/continuous-delivery/common-cd.yml
+14 −12 azure-pipelines/templates/steps/continuous-delivery/assemble-publish-projversion.yml
+37 −0 azure-pipelines/templates/steps/generate-sbom.yml
+5 −0 azure-pipelines/vsts-releases/common.yml
+5 −0 azure-pipelines/vsts-releases/common4j.yml
+4 −0 build.gradle
+4 −0 changelog.txt
+18 −4 common/build.gradle
+1 −0 common/src/androidTest/resources/jacoco-agent.properties
+7 −1 common/src/main/java/com/microsoft/identity/common/AndroidPlatformComponents.java
+9 −24 common/src/main/java/com/microsoft/identity/common/adal/internal/cache/StorageHelper.java
+14 −3 ...main/java/com/microsoft/identity/common/adal/internal/tokensharing/TokenCacheItemSerializationAdapater.java
+173 −17 common/src/test/java/com/microsoft/identity/common/MicrosoftFamilyOAuth2TokenCacheTest.java
+11 −1 common4j/build.gradle
+7 −0 common4j/src/main/com/microsoft/identity/common/components/SettablePlatformComponents.java
+23 −20 common4j/src/main/com/microsoft/identity/common/java/cache/MsalOAuth2TokenCache.java
+24 −12 common4j/src/main/com/microsoft/identity/common/java/controllers/CommandDispatcher.java
+1 −2 common4j/src/main/com/microsoft/identity/common/java/crypto/StorageEncryptionManager.java
+21 −3 common4j/src/main/com/microsoft/identity/common/java/crypto/key/KeyUtil.java
+27 −7 common4j/src/main/com/microsoft/identity/common/java/exception/BaseException.java
+41 −0 common4j/src/main/com/microsoft/identity/common/java/interfaces/IHttpClientWrapper.java
+14 −1 common4j/src/main/com/microsoft/identity/common/java/interfaces/IPlatformComponents.java
+39 −0 common4j/src/main/com/microsoft/identity/common/java/net/DefaultHttpClientWrapper.java
+21 −11 ...rc/main/com/microsoft/identity/common/java/providers/microsoft/microsoftsts/MicrosoftStsOAuth2Strategy.java
+19 −1 common4j/src/main/com/microsoft/identity/common/java/result/LocalAuthenticationResult.java
+42 −0 common4j/src/main/com/microsoft/identity/common/java/telemetry/ITelemetryAccessor.java
+5 −4 common4j/src/main/com/microsoft/identity/common/java/telemetry/Telemetry.java
+12 −0 common4j/src/main/com/microsoft/identity/common/java/util/StringUtil.java
+15 −1 common4j/src/main/com/microsoft/identity/common/java/util/ported/ObjectUtils.java
+65 −0 testutils/src/main/java/com/microsoft/identity/internal/testutils/InterceptedHttpClient.java
+39 −0 testutils/src/main/java/com/microsoft/identity/internal/testutils/InterceptedHttpClientWrapper.java
+0 −4 testutils/src/main/java/com/microsoft/identity/internal/testutils/MockHttpClient.java
+97 −0 testutils/src/main/java/com/microsoft/identity/internal/testutils/TestUtils.java
+38 −0 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/IBrokerHostTest.java
+4 −4 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/broker/AbstractTestBroker.java
+6 −0 ...tomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/broker/BrokerCompanyPortal.java
+52 −42 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/broker/BrokerHost.java
+6 −0 ...tilities/src/main/java/com/microsoft/identity/client/ui/automation/broker/BrokerMicrosoftAuthenticator.java
+118 −0 ...es/src/main/java/com/microsoft/identity/client/ui/automation/interaction/microsoftsts/TlsPromptHandler.java