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

[ci] Check APK sizes on Azure Pipelines #4133

Merged
merged 3 commits into from
Jan 24, 2020

Conversation

pjcollins
Copy link
Member

This target was overlooked in the initial split up and porting efforts
for our APK tests. This target calculates the sizes of or test APKs and
compares them against a baseline. This change ensures that we will
report a failure in our Azure Pipelines build if any project's APK size
drifts too far from the baseline.

This target was overlooked in the initial split up and porting efforts
for our APK tests. This target calculates the sizes of or test APKs and
compares them against a baseline. This change ensures that we will
report a failure in our Azure Pipelines build if any project's APK size
drifts too far from the baseline.
When comparing APK sizes, we need to make sure the correct `TestsFlavor`
metadata is set. In order for `-Aot` to be included in the test name,
the `AotAssemblies` property must be explicitly set.

Fixes:

    error MSB4018: The "ProcessApkSizes" task failed unexpectedly. [/Users/runner/runners/2.164.3/work/1/s/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj]
    error MSB4018: System.Collections.Generic.KeyNotFoundException: The given key 'apk-Release-Profiled' was not present in the dictionary. [/Users/runner/runners/2.164.3/work/1/s/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj]
Copy link
Member

@radekdoulik radekdoulik left a comment

Choose a reason for hiding this comment

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

Looks like the test triggered and the size difference is more than the threshold of 100kb.

error : the reference 16540799 and actual size 16995788 for apk-Release differs too much (>100kb). [/Users/runner/runners/2.164.3/work/1/s/src/Mono.Android/Test/Mono.Android-Tests.csproj]
error : please check if it is correct and update the reference apk sizes files if it is. [/Users/runner/runners/2.164.3/work/1/s/src/Mono.Android/Test/Mono.Android-Tests.csproj]
error : it can be done by running `make CONFIGURATION=<Debug or Release> update-apk-sizes-reference` in XA root directory [/Users/runner/runners/2.164.3/work/1/s/src/Mono.Android/Test/Mono.Android-Tests.csproj]

That would need more investigation as the size measurements were not recorded for some time, until fixed recently. https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/plot/Tests%20size/ - there is about 450k increase during the gap for that test :(

It happened between Jenkins builds 776 and 1029.

So we need to look into that. Hopefully the azure artifacts should contain the measurements.

@radekdoulik
Copy link
Member

radekdoulik commented Jan 17, 2020

Build 900: Release apk size 16548991
950: 16565375
1000: 16491729
1015: 16995788
1008: 16491729
1011: 16995788
1010: 16995788
1009: 16995788

So it looks like the increase is result of 130905e (build 1009 https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/1009/)

@pjcollins
Copy link
Member Author

I'm trying to figure out why the APK size comparison is failing on Azure Pipelines but not Jenkins. Is it at all possible that the .apk files we produce when building against a system installation would be slightly larger than the ones created against a build tree? That seems unlikely...

@radekdoulik
Copy link
Member

The numbers on Jenkins from the last builds are equal to those reported in the error. So I am trying to trace it now in my above comment.

@pjcollins
Copy link
Member Author

Ok great, thanks for the investigation. I'll prepare a diff to bump the baseline sizes as part of this PR if we determine that these increases are acceptable.

@radekdoulik
Copy link
Member

I will try to look at it closer next week. Opened the above issue for it so that I don't forget.

@pjcollins
Copy link
Member Author

Release apk size diff:

diff --git a/tests/apk-sizes-reference/TestResult-Mono.Android_Tests-values-Release.csv b/tests/apk-sizes-reference/TestResult-Mono.Android_Tests-values-Release.csv
index 73a25954..9fce41ef 100644
--- a/tests/apk-sizes-reference/TestResult-Mono.Android_Tests-values-Release.csv
+++ b/tests/apk-sizes-reference/TestResult-Mono.Android_Tests-values-Release.csv
@@ -1,2 +1,2 @@
-apk-Release,Java.Interop.dll-Release,Mono.Android.dll-Release,mscorlib.dll-Release,monosgen-armeabi-v7a-Release,apk-Release-Aot,Java.Interop.dll-Release-Aot,Mono.Android.dll-Release-Aot,mscorlib.dll-Release-Aot,monosgen-armeabi-v7a-Release-Aot,Java.Interop.dll.so-Release-Aot,Mono.Android.dll.so-Release-Aot,mscorlib.dll.so-Release-Aot,apk-Release-Profiled-Aot,Java.Interop.dll-Release-Profiled-Aot,Mono.Android.dll-Release-Profiled-Aot,mscorlib.dll-Release-Profiled-Aot,monosgen-armeabi-v7a-Release-Profiled-Aot,Mono.Android.dll.so-Release-Profiled-Aot,mscorlib.dll.so-Release-Profiled-Aot,Java.Interop.dll.so-Release-Profiled-Aot,apk-Release-Bundle,monosgen-armeabi-v7a-Release-Bundle
-16540799,161792,1400832,2112000,3843248,32985861,161792,1400832,2112000,3843248,842432,5908196,8641772,18506501,161792,1400832,2112000,3843248,421036,1685856,220904,14229016,3843248
+apk-Release,Java.Interop.dll-Release,Mono.Android.dll-Release,mscorlib.dll-Release,monosgen-armeabi-v7a-Release,apk-Release-Aot,Java.Interop.dll-Release-Aot,Mono.Android.dll-Release-Aot,mscorlib.dll-Release-Aot,monosgen-armeabi-v7a-Release-Aot,Java.Interop.dll.so-Release-Aot,Mono.Android.dll.so-Release-Aot,mscorlib.dll.so-Release-Aot,apk-Release-Profiled-Aot,Java.Interop.dll-Release-Profiled-Aot,Mono.Android.dll-Release-Profiled-Aot,mscorlib.dll-Release-Profiled-Aot,monosgen-armeabi-v7a-Release-Profiled-Aot,Mono.Android.dll.so-Release-Profiled-Aot,Java.Interop.dll.so-Release-Profiled-Aot,mscorlib.dll.so-Release-Profiled-Aot,apk-Release-Bundle,monosgen-armeabi-v7a-Release-Bundle
+16995788,173568,1410560,2103808,3844692,35870532,173568,1410560,2103808,3844692,1194160,6762616,10086236,20154180,173568,1410560,2103808,3844692,419856,235520,1695084,14392856,3844692
diff --git a/tests/apk-sizes-reference/TestResult-Mono.Android_TestsMultiDex-values-Release.csv b/tests/apk-sizes-reference/TestResult-Mono.Android_TestsMultiDex-values-Release.csv
index 256e89fc..da361b49 100644
--- a/tests/apk-sizes-reference/TestResult-Mono.Android_TestsMultiDex-values-Release.csv
+++ b/tests/apk-sizes-reference/TestResult-Mono.Android_TestsMultiDex-values-Release.csv
@@ -1,2 +1,2 @@
 apk-Release,Mono.Android.dll-Release,mscorlib.dll-Release,monosgen-armeabi-v7a-Release,apk-Release-Aot,Mono.Android.dll-Release-Aot,mscorlib.dll-Release-Aot,monosgen-armeabi-v7a-Release-Aot,apk-Release-Profiled-Aot,Mono.Android.dll-Release-Profiled-Aot,mscorlib.dll-Release-Profiled-Aot,monosgen-armeabi-v7a-Release-Profiled-Aot,apk-Release-Bundle,Mono.Android.dll-Release-Bundle,mscorlib.dll-Release-Bundle,monosgen-armeabi-v7a-Release-Bundle
-16192740,987136,2112000,3843248,16192740,987136,2112000,3843248,16192740,987136,2112000,3843248,16192740,987136,2112000,3843248
+16659977,1008128,2103808,3844692,16659977,1008128,2103808,3844692,16659977,1008128,2103808,3844692,16659977,1008128,2103808,3844692
diff --git a/tests/apk-sizes-reference/TestResult-Xamarin.Forms_Tests-values-Release.csv b/tests/apk-sizes-reference/TestResult-Xamarin.Forms_Tests-values-Release.csv
index 09d448da..22ab0b28 100644
--- a/tests/apk-sizes-reference/TestResult-Xamarin.Forms_Tests-values-Release.csv
+++ b/tests/apk-sizes-reference/TestResult-Xamarin.Forms_Tests-values-Release.csv
@@ -1,2 +1,2 @@
 apk-Release,Java.Interop.dll-Release,Mono.Android.dll-Release,mscorlib.dll-Release,monosgen-armeabi-v7a-Release,apk-Release-Aot,Java.Interop.dll-Release-Aot,Mono.Android.dll-Release-Aot,mscorlib.dll-Release-Aot,monosgen-armeabi-v7a-Release-Aot,Java.Interop.dll.so-Release-Aot,mscorlib.dll.so-Release-Aot,Mono.Android.dll.so-Release-Aot,apk-Release-Profiled-Aot,Java.Interop.dll-Release-Profiled-Aot,Mono.Android.dll-Release-Profiled-Aot,mscorlib.dll-Release-Profiled-Aot,monosgen-armeabi-v7a-Release-Profiled-Aot,Mono.Android.dll.so-Release-Profiled-Aot,Java.Interop.dll.so-Release-Profiled-Aot,mscorlib.dll.so-Release-Profiled-Aot,apk-Release-Bundle,monosgen-armeabi-v7a-Release-Bundle
-21069561,162816,2226688,2113024,3843248,46788671,162816,2226688,2113024,3843248,831180,8460084,9131876,25268287,162816,2226688,2113024,3843248,759148,285668,2053044,15935912,3843248
+21069561,162816,2226688,2113024,3843248,47058467,164352,2228224,2103808,3844692,872920,8410108,9426332,25268287,162816,2226688,2113024,3843248,759148,285668,2053044,15935912,3843248

@radekdoulik
Copy link
Member

I think once #4153 is in, hopefully the apk size test should not fail anymore.

@radekdoulik
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radekdoulik
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radekdoulik
Copy link
Member

We should analyze when the XF test apk sizes changed.

@pjcollins
Copy link
Member Author

@radekdoulik Could you link me to the Jenkins page which contains the APK size information? I'm not exactly sure how to track this one down and how to determine if we've seen the same increase in the XF test app on Jenkins.

@radekdoulik
Copy link
Member

radekdoulik commented Jan 24, 2020

The XF apk size increase happened in build 1007 and this commit bb36e3e

The difference is 372736 bytes for apk-Release-Aot size. @jonpryor: do you know what might have caused this? Maybe the aggressive inlining attribute?

@radekdoulik
Copy link
Member

@radekdoulik Could you link me to the Jenkins page which contains the APK size information? I'm not exactly sure how to track this one down and how to determine if we've seen the same increase in the XF test app on Jenkins.

The page is here https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/plot/Tests%20size/

Unfortunately we are missing sizes between builds 776 and 1029. So I had to download all the xa-test-results*zip files and extract the csv files from there :-)

@radekdoulik
Copy link
Member

For the record, here is a chart of master builds which changed the size

Screen Shot 2020-01-24 at 14 58 14

@radekdoulik
Copy link
Member

Interestingly the nice drop in build 960 is a mono bump to 2019-10@18920a83

@radekdoulik
Copy link
Member

I have created a new issue for the AOT apk size increase, so that we don't forget about it. #4169

Otherwise the PR looks good to me.

@jonpryor jonpryor merged commit 1a2beea into dotnet:master Jan 24, 2020
@pjcollins pjcollins deleted the azp-check-apk-sizes branch January 24, 2020 16:52
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants