Skip to content

Commit 1011a66

Browse files
authored
Refine the project setup for SDK health metrics (#3438)
* Refine the project setup for SDK health metrics - Reword languages in README and link to the health metrics page on Firebase devsite - Move folders for size and macrobenchmark to `health-metrics` under project root
1 parent 9adbd59 commit 1011a66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+58
-41
lines changed

apk-size/README.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

ci/README.md

Lines changed: 1 addition & 1 deletion

ci/fireci/fireciplugins/binary_size.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def binary_size(pull_request, log, metrics_service_url, access_token):
5757
artifacts = affected_artifacts if pull_request else all_artifacts
5858
sdks = ','.join(artifacts)
5959

60-
gradle.run('assemble', '--continue', gradle.P('sdks', sdks), workdir='apk-size', check=False)
60+
workdir = 'health-metrics/apk-size'
61+
gradle.run('assemble', '--continue', gradle.P('sdks', sdks), workdir=workdir, check=False)
6162

6263
test_results = _measure_aar_sizes(artifacts) + _measure_apk_sizes()
6364
test_report = {'metric': 'BinarySize', 'results': test_results, 'log': log}
@@ -82,7 +83,8 @@ def _measure_aar_sizes(artifacts):
8283
def _measure_apk_sizes():
8384
test_results = []
8485

85-
apk_files = glob.glob(fr'./apk-size/**/*.apk', recursive=True)
86+
regex = r'./health-metrics/apk-size/**/*.apk'
87+
apk_files = glob.glob(regex, recursive=True)
8688
for apk_file in apk_files:
8789
filename = os.path.basename(apk_file)
8890
artifact, build_type, abi = os.path.splitext(filename)[0].split('::')

ci/fireci/fireciplugins/macrobenchmark.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ async def _launch_macrobenchmark_test():
5353
_copy_google_services(),
5454
)
5555

56-
with chdir('macrobenchmark'):
56+
_logger.info(f'Artifact versions: {artifact_versions}')
57+
58+
with chdir('health-metrics/macrobenchmark'):
5759
runners = [MacrobenchmarkTest(k, v, artifact_versions) for k, v in config.items()]
5860
results = await asyncio.gather(*[x.run() for x in runners], return_exceptions=True)
5961

@@ -77,12 +79,12 @@ def _artifact_key_version(artifact):
7779

7880

7981
async def _parse_config_yaml():
80-
with open('macrobenchmark/config.yaml') as yaml_file:
82+
with open('health-metrics/macrobenchmark/config.yaml') as yaml_file:
8183
return yaml.safe_load(yaml_file)
8284

8385

8486
async def _create_gradle_wrapper():
85-
with open('macrobenchmark/settings.gradle', 'w'):
87+
with open('health-metrics/macrobenchmark/settings.gradle', 'w'):
8688
pass
8789

8890
proc = await asyncio.subprocess.create_subprocess_exec(
@@ -91,15 +93,15 @@ async def _create_gradle_wrapper():
9193
'--gradle-version',
9294
'6.9',
9395
'--project-dir',
94-
'macrobenchmark'
96+
'health-metrics/macrobenchmark'
9597
)
9698
await proc.wait()
9799

98100

99101
async def _copy_google_services():
100102
if 'FIREBASE_CI' in os.environ:
101103
src = os.environ['FIREBASE_GOOGLE_SERVICES_PATH']
102-
dst = 'macrobenchmark/template/app/google-services.json'
104+
dst = 'health-metrics/macrobenchmark/template/app/google-services.json'
103105
_logger.info(f'Running on CI. Copying "{src}" to "{dst}"...')
104106
shutil.copyfile(src, dst)
105107

@@ -222,7 +224,7 @@ async def _prepare_mustache_context(self):
222224
async def _aggregate_benchmark_results(self):
223225
results = []
224226
blobs = self.gcs_client.list_blobs(self.test_results_bucket, prefix=self.test_results_dir)
225-
files = [x for x in blobs if re.search(r'artifacts/[^/]*\.json', x.name)]
227+
files = [x for x in blobs if re.search(r'sdcard/Download/[^/]*\.json', x.name)]
226228
for file in files:
227229
device = re.search(r'([^/]*)/artifacts/', file.name).group(1)
228230
benchmarks = json.loads(file.download_as_bytes())['benchmarks']

health-metrics/README.md

Lines changed: 15 additions & 0 deletions

health-metrics/apk-size/README.md

Lines changed: 27 additions & 0 deletions

apk-size/apk-size.gradle renamed to health-metrics/apk-size/apk-size.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ plugins {
2828
id "com.dorongold.task-tree" version "1.5"
2929
}
3030

31-
apply from: '../sdkProperties.gradle'
31+
apply from: '../../sdkProperties.gradle'
3232

3333
task clean(type: Delete) {
3434
delete rootProject.buildDir
File renamed without changes.

apk-size/app/configure.gradle renamed to health-metrics/apk-size/app/configure.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
repositories {
1717
maven {
18-
url '../../build/m2repository/'
18+
url '../../../build/m2repository/'
1919
}
2020
google()
2121
jcenter()
File renamed without changes.
File renamed without changes.
File renamed without changes.

macrobenchmark/template/build.gradle renamed to health-metrics/macrobenchmark/template/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ allprojects {
4141
mavenCentral()
4242

4343
maven {
44-
url rootProject.file('../../../build/m2repository')
44+
url rootProject.file('../../../../build/m2repository')
4545
}
4646
}
4747
}

0 commit comments

Comments
 (0)