Skip to content

Commit 61766c2

Browse files
authored
Add pods in spec testing (#9190)
* Add pods for spec testing.
1 parent fdeb13d commit 61766c2

File tree

5 files changed

+65
-9
lines changed

5 files changed

+65
-9
lines changed

.github/workflows/health-metrics-presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
# Check all the modified SDKs, the flags will be true if changed files match patterns in the file
15-
# scripts/health_metrics/code_coverage_file_list.json
15+
# scripts/health_metrics/file_patterns.json
1616
check:
1717
if: github.repository == 'Firebase/firebase-ios-sdk' && (github.event.action == 'opened' || github.event.action == 'synchronize')
1818
name: Check changed files

scripts/health_metrics/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ This directory includes code coverage report generation and binary size report g
33

44
## Code Coverage Report Generation
55

6-
This tool is to help generate coverage reports for pull requests. It's defined by the [test_coverage workflow](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/health_metrics/code_coverage_file_list.json).
6+
This tool is to help generate coverage reports for pull requests. It's defined by the [test_coverage workflow](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/health_metrics/file_patterns.json).
77

88
Coverage reports of SDK frameworks will be displayed in a pull request if the change is under corresponding SDK file patterns.
99

10-
[UpdatedFilesCollector](https://github.com/firebase/firebase-ios-sdk/tree/master/scripts/health_metrics/generate_code_coverage_report/Sources/UpdatedFilesCollector) will detect file changes and compare file paths to file patterns in [code_coverage_file_list.json](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/health_metrics/code_coverage_file_list.json). If updated file paths fit any patterns, corresponding SDK coverage job will be triggered.
10+
[UpdatedFilesCollector](https://github.com/firebase/firebase-ios-sdk/tree/master/scripts/health_metrics/generate_code_coverage_report/Sources/UpdatedFilesCollector) will detect file changes and compare file paths to file patterns in [file_patterns.json](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/health_metrics/file_patterns.json). If updated file paths fit any patterns, corresponding SDK coverage job will be triggered.
1111

1212
### Add a new coverage workflow
1313

1414
To create a code coverage workflow for a new SDK,
15-
1. Add `newsdk` and its patterns in [code_coverage_file_list.json](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/health_metrics/code_coverage_file_list.json).
16-
2. Add a new output flag, e.g. `newsdk_run_job`, in the [coverage workflow](https://github.com/firebase/firebase-ios-sdk/blob/64d50a7f7b3af104a88f9c9203285ae20ea309d4/.github/workflows/test_coverage.yml#L17). `newsdk_run_job` should be aligned with the name of SDK `newsdk` in code_coverage_file_list.json.
15+
1. Add `newsdk` and its patterns in [file_patterns.json](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/health_metrics/file_patterns.json).
16+
2. Add a new output flag, e.g. `newsdk_run_job`, in the [coverage workflow](https://github.com/firebase/firebase-ios-sdk/blob/64d50a7f7b3af104a88f9c9203285ae20ea309d4/.github/workflows/test_coverage.yml#L17). `newsdk_run_job` should be aligned with the name of SDK `newsdk` in file_patterns.json.
1717
3. Add a newsdk coverage job in the [workflow](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/test_coverage.yml):
1818
```
1919
pod-lib-lint-newsdk:

scripts/health_metrics/create_binary_size_report.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ set -ex
2424
BINARY_SIZE_SDK=()
2525

2626
# In presubmits, `check` job in the health_metrics.yml workflow will turn on SDK flags if a corresponding
27-
# file path, in `scripts/health_metrics/code_coverage_file_list.json` is updated.
27+
# file path, in `scripts/health_metrics/file_patterns.json` is updated.
2828
# In postsubmits, all SDKs should be measured, so binary size data of all SDKs should be uploaded to a
2929
# merged commit. Next time a new PR can compare the head of the PR to a commit on the base branch.
3030
if [[ "${POSTSUBMIT}" == true || "${FirebaseABTesting}" == 'true' ]]; then

scripts/health_metrics/code_coverage_file_list.json renamed to scripts/health_metrics/file_patterns.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,24 @@
4040
"\\.github/workflows/auth\\.yml"
4141
]
4242
},
43+
{
44+
"sdk": "core",
45+
"podspecs": ["FirebaseCore.podspec"],
46+
"filePatterns": [
47+
"^FirebaseCore.*",
48+
"FirebaseCore.podspec",
49+
"Interop/CoreDiagnostics/Public/[^/]+\\.h"
50+
]
51+
},
52+
{
53+
"sdk": "core-diagnostics",
54+
"podspecs": ["FirebaseCoreDiagnostics.podspec"],
55+
"filePatterns": [
56+
"Firebase/CoreDiagnostics/.*",
57+
"Example/CoreDiagnostics/.*",
58+
"Interop/CoreDiagnostics/Public/[^/]+\\.h"
59+
]
60+
},
4361
{
4462
"sdk": "crashlytics",
4563
"podspecs": ["FirebaseCrashlytics.podspec"],
@@ -67,6 +85,15 @@
6785
"Interop/Analytics/Public/[^/]+\\.h"
6886
]
6987
},
88+
{
89+
"sdk": "firebase",
90+
"podspecs": ["Firebase.podspec"],
91+
"filePatterns": [
92+
".*.podspec",
93+
".*.podspec.json",
94+
"CoreOnly/.*"
95+
]
96+
},
7097
{
7198
"sdk": "firestore",
7299
"podspecs": ["FirebaseFirestore.podspec", "FirebaseFirestoreSwift.podspec"],
@@ -92,6 +119,13 @@
92119
"FirebaseMessaging/Sources/Interop/[^/]+\\.h"
93120
]
94121
},
122+
{
123+
"sdk": "google-utilities-components",
124+
"podspecs": ["GoogleUtilitiesComponents.podspec"],
125+
"filePatterns": [
126+
"^GoogleUtilitiesComponents.*"
127+
]
128+
},
95129
{
96130
"sdk": "inappmessaging",
97131
"podspecs": ["FirebaseInAppMessaging.podspec", "FirebaseInAppMessagingSwift.podspec"],
@@ -118,6 +152,14 @@
118152
"\\.github/workflows/messaging\\.yml"
119153
]
120154
},
155+
{
156+
"sdk": "mlmodeldownloader",
157+
"podspecs": ["FirebaseMLModelDownloader.podspec"],
158+
"filePatterns": [
159+
"^FirebaseMLModelDownloader/.*",
160+
"FirebaseMLModelDownloader\\.podspec"
161+
]
162+
},
121163
{
122164
"sdk": "performance",
123165
"podspecs": ["FirebasePerformance.podspec"],
@@ -137,6 +179,20 @@
137179
"scripts/generate_access_token\\.sh"
138180
]
139181
},
182+
{
183+
"sdk": "segmentation",
184+
"podspecs": ["FirebaseSegmentation.podspec"],
185+
"filePatterns": [
186+
"^FirebaseSegmentation.*"
187+
]
188+
},
189+
{
190+
"sdk": "shared-swift",
191+
"podspecs": ["FirebaseSharedSwift.podspec"],
192+
"filePatterns": [
193+
"^FirebaseSharedSwift.*"
194+
]
195+
},
140196
{
141197
"sdk": "storage",
142198
"podspecs": ["FirebaseStorage.podspec", "FirebaseStorageSwift.podspec"],

scripts/health_metrics/get_updated_files.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
set -ex
16-
# Updated files in paths in code_coverage_file_list.json will trigger code coverage workflows.
16+
# Updated files in paths in file_patterns.json will trigger code coverage workflows.
1717
# Updates in a pull request will generate a code coverage report in a PR.
1818

1919
while getopts p: flag
@@ -37,8 +37,8 @@ cd scripts/health_metrics/generate_code_coverage_report
3737
git diff --name-only remotes/origin/${GITHUB_BASE_REF} ${GITHUB_SHA} > updated_files.txt
3838

3939
if [ -z $spec_output_file] ; then
40-
swift run UpdatedFilesCollector --changed-file-paths updated_files.txt --code-coverage-file-patterns ../code_coverage_file_list.json
40+
swift run UpdatedFilesCollector --changed-file-paths updated_files.txt --code-coverage-file-patterns ../file_patterns.json
4141
else
42-
swift run UpdatedFilesCollector --changed-file-paths updated_files.txt --code-coverage-file-patterns ../code_coverage_file_list.json --output-sdk-file-url "${spec_output_file}"
42+
swift run UpdatedFilesCollector --changed-file-paths updated_files.txt --code-coverage-file-patterns ../file_patterns.json --output-sdk-file-url "${spec_output_file}"
4343
mv "${spec_output_file}" "${dir}"
4444
fi

0 commit comments

Comments
 (0)