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

[RunAllTests] Fix part of #5343: Upload generated code coverage report as comments #5469

Merged
merged 471 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
471 commits
Select commit Hold shift + click to select a range
a35d7a0
Save lobby - Collecting protos into one coverage report container pro…
Rd4dev Jul 31, 2024
05a007b
Updating the coverage missing test case while removing the job and re…
Rd4dev Jul 31, 2024
a3a661e
Clean up and changed the test case names to be more specific on what …
Rd4dev Jul 31, 2024
8a12cf4
Added validation to ensure exactly one unique value of filePath and f…
Rd4dev Jul 31, 2024
e72179a
Clean up of aggreagation code and replaced conditional error statment…
Rd4dev Jul 31, 2024
f00ebc6
Removed the mock data used for coverage report with n:1 file target a…
Rd4dev Jul 31, 2024
2fa9737
Resolve merge conflicts with changes to upstream one to may targets b…
Rd4dev Jul 31, 2024
8b2415e
Hardcoded implementation of saving the protos to their own path
Rd4dev Jul 31, 2024
b0839ca
New proto structure for coverage to having distinct case for success …
Rd4dev Aug 1, 2024
d9ef7d8
Roughly organized layout / implementation of the flow of the protos a…
Rd4dev Aug 1, 2024
333607e
Re-writing the CoverageReporter script to handle the container proto …
Rd4dev Aug 1, 2024
b17e0d1
First set of cleanup with coverage reporter implemented
Rd4dev Aug 1, 2024
824c406
Reference point for mock data with new repeated bazel test target pro…
Rd4dev Aug 1, 2024
5ee99c0
Clean up and simplification of usage of single usage entry
Rd4dev Aug 1, 2024
372ae95
Fix lint checks and failing test case with update to the proto strucu…
Rd4dev Aug 1, 2024
6499311
Added missing import for BazelTestTarget
Rd4dev Aug 1, 2024
aa68b95
Final md report generation with failure, details - 1. failure below t…
Rd4dev Aug 2, 2024
5e0da59
Refactored CoverageReporter into unit functionalities and avoid repet…
Rd4dev Aug 2, 2024
bcb0bf2
Added parameter to save the proto to the path specified
Rd4dev Aug 2, 2024
8ff593f
Added Coverage Check Status that check through every fail and details…
Rd4dev Aug 2, 2024
9b2f0d8
Added a helper method to calculate coverage percentages
Rd4dev Aug 2, 2024
40b5f14
Updated tests for Coverage Runner Test
Rd4dev Aug 2, 2024
257e434
Added test case for CoverageReporter to test success detail, falure a…
Rd4dev Aug 2, 2024
a63a4d0
Added test case for CoverageReporter to test success detail, falure a…
Rd4dev Aug 2, 2024
edfd42d
Added combined success failure and exempted test file cases
Rd4dev Aug 2, 2024
91cd498
Updated RunCoverageTest test cases with new rewritten report implemen…
Rd4dev Aug 4, 2024
a4d5e58
Resolve merge conflicts with changes to upstream proto BazelTestTarge…
Rd4dev Aug 4, 2024
b41ad71
Fix lint checks indents and max line lengths
Rd4dev Aug 4, 2024
db74fee
Fix test with unresolved bazel test target list, added kdoc
Rd4dev Aug 4, 2024
d7ab04d
Fix failing test cases, lint checks indents, missing new lines and ma…
Rd4dev Aug 4, 2024
e5da141
Fix failing test with absence of trimEnd
Rd4dev Aug 4, 2024
c847231
Conditional new line additions; with next commits replace them with a…
Rd4dev Aug 4, 2024
2172905
Replaced appendLine with append to use \n in line
Rd4dev Aug 4, 2024
2ff0bda
Fix Tests with Failure cases and used the public const MIN_THRESHOLD …
Rd4dev Aug 4, 2024
61accfb
Kdoc checks and fix test with list of files
Rd4dev Aug 4, 2024
eef9618
Added Coverage Check Status to entire check and md report
Rd4dev Aug 4, 2024
aed8081
Refactored new lines in tests and added Coverage status to test templ…
Rd4dev Aug 4, 2024
4293d43
Fix failing tests with color codes and new line missing
Rd4dev Aug 5, 2024
d93762e
Updated test failure with appropriate failure type in test cases
Rd4dev Aug 5, 2024
75048d2
Fix failing test cases with missing new line
Rd4dev Aug 5, 2024
a294810
Bumping shard_count to 24 that got overriden with merge
Rd4dev Aug 5, 2024
d1ceedd
Added new tests with failing cases and new types of reports
Rd4dev Aug 5, 2024
464840c
Fix Lint check removed unused imports
Rd4dev Aug 5, 2024
7d875a9
Readding the shard count, removing while local testing
Rd4dev Aug 5, 2024
8c35412
Refactored log report to log only the failed coverage report to avoid…
Rd4dev Aug 5, 2024
d9358fd
Fixed Kdoc issues and redundant quotes
Rd4dev Aug 5, 2024
d4dc9fe
Resolve merge conflict with upstream list of files and modified alway…
Rd4dev Aug 5, 2024
e024b8f
Added remaining test target collection test cases for retrieveChangeF…
Rd4dev Aug 5, 2024
5ea6054
Introducing ComputeChangedFilesTest test file
Rd4dev Aug 5, 2024
267b1b3
Base test case setup to add a file as a changed file for computeChang…
Rd4dev Aug 6, 2024
12df19d
Added test cases for ComputeChangedFiles replicated exactly from the …
Rd4dev Aug 6, 2024
e20782c
Enable Functionality to compute on all available .kt source files
Rd4dev Aug 6, 2024
5e528fe
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Aug 6, 2024
e72eec3
Added the copy of local and shared test to ensure the multiple test f…
Rd4dev Aug 6, 2024
49d2029
Resolve merge conflict with upstream RunCoverageTest
Rd4dev Aug 6, 2024
226f8b6
Added test to verify that the final container is saved to output prot…
Rd4dev Aug 6, 2024
223c266
Save lobby for proto extraction and storage
Rd4dev Aug 6, 2024
8aa42bb
Added test case to verify one single line hit my multiple targets of …
Rd4dev Aug 6, 2024
871a48e
Updated the Final coverage report template as suggested. This introdu…
Rd4dev Aug 7, 2024
2221bad
Updated tests with updated md template and fixed few review comments
Rd4dev Aug 7, 2024
c670ec3
Reverting the shard count change for ci run
Rd4dev Aug 7, 2024
45ee041
Resolve merge conflicts with upstream one to many targets :(
Rd4dev Aug 7, 2024
9b01b54
Save lobby while fixing tests as they take too long
Rd4dev Aug 7, 2024
2535777
Enabled and refactored compute changed files to have all files settin…
Rd4dev Aug 7, 2024
c6b45db
Remove unintended shard count
Rd4dev Aug 7, 2024
4e4c687
Cleaned up the BazelClient could be refactored more, will do after 1s…
Rd4dev Aug 7, 2024
87b45a9
Little clean with left debugging lines
Rd4dev Aug 7, 2024
30f3e97
Added test case with compute all file settings
Rd4dev Aug 8, 2024
e527dd9
Refactoring with test file exemption removal
Rd4dev Aug 8, 2024
2f11be3
Fixed test cases with Coverage Reporter and also added test cases cor…
Rd4dev Aug 8, 2024
667ed45
Fix failing test with CoverageRunnerTest due to incorrect target spec…
Rd4dev Aug 8, 2024
09277b6
Fixing test cases part 1 - md report template changes
Rd4dev Aug 8, 2024
0738388
Fix Lint checks majorly formattings
Rd4dev Aug 8, 2024
bdddfd5
Fix tests part 2 - exceptions and templates
Rd4dev Aug 8, 2024
9400e9e
Fix Tests part 3 - remove unnecessary lines
Rd4dev Aug 8, 2024
5d6b16b
Fix test after bumping min threshold to 70
Rd4dev Aug 8, 2024
0f3309c
Fix tests part 4 - with template and min threshold changes :|
Rd4dev Aug 8, 2024
ad5aa58
Fix Lint check Remove needless blank line
Rd4dev Aug 8, 2024
4ee8269
Updating with the upstream list of files
Rd4dev Aug 8, 2024
6aeda6b
Removing the logic to run test with args
Rd4dev Aug 8, 2024
71a9ce2
Bumping the processTimeout to 15 since the code coverage run failed w…
Rd4dev Aug 8, 2024
395a3b1
Fix Lint checks and re running ci to verify coverage pass
Rd4dev Aug 8, 2024
d8b9e6a
Removed the supress cases and comments
Rd4dev Aug 8, 2024
bec21b7
Bumping the process timeout straight in the RunCoverage to 35 and rem…
Rd4dev Aug 8, 2024
89dcd05
Trying to bump processTimeout in test
Rd4dev Aug 8, 2024
fed6a79
Brought in changes from the exempt-test-targets-incompatible-with-cod…
Rd4dev Aug 8, 2024
cec0f34
Changing the report format to proto for the ci runs and also bumping …
Rd4dev Aug 8, 2024
15b6d63
Resolved conflicts with upstream list of files
Rd4dev Aug 8, 2024
2274c0d
Fix Lint check missing space after =
Rd4dev Aug 8, 2024
d8d121e
Fix Lint check missing space after =
Rd4dev Aug 8, 2024
cba7a13
Triggering ci since many checks seem to fail after update
Rd4dev Aug 8, 2024
dad1370
Remove old implementation for collecting data
Rd4dev Aug 8, 2024
4462e12
Merge from upstream remove old implementation
Rd4dev Aug 8, 2024
83836bc
Fix failing test cases with changes from pull from exemptions pr
Rd4dev Aug 8, 2024
d1307c9
Added tests for BazelClient and Missing Build declarations inclusions
Rd4dev Aug 9, 2024
2639294
Fix Lint checks max line legth
Rd4dev Aug 9, 2024
013c951
Merge with develop branch
Rd4dev Aug 9, 2024
b8b70ed
Reordering the coverage output
Rd4dev Aug 9, 2024
743024d
Readjusted the bazel client test output
Rd4dev Aug 9, 2024
fa9cde0
Merge with latest upstream list of files
Rd4dev Aug 9, 2024
65419db
Removed unused instrumentation / path finder variables
Rd4dev Aug 9, 2024
0801ea5
Updated md template with replacing the file name links with the detai…
Rd4dev Aug 9, 2024
ac2f97e
Moved exempted list too to a details summary as they too might grow big
Rd4dev Aug 9, 2024
f951993
Updated tests to reflect changes in md report with replacement of lin…
Rd4dev Aug 9, 2024
fdf274a
Updated with suggested edits in the review
Rd4dev Aug 9, 2024
dc47fc6
Removed parsing of the pb file in the Coverage Reporter Test
Rd4dev Aug 9, 2024
bc7054b
Fix failing tests and lint checks
Rd4dev Aug 9, 2024
2d4b338
Fixed a flaky test, expected it to be since the order depends on the …
Rd4dev Aug 9, 2024
12e9f3e
Fix Lint check indentation
Rd4dev Aug 9, 2024
91f031f
Merge from upstream list of files branch
Rd4dev Aug 9, 2024
aed0c18
Mapping tests to targets right in the compute changed files
Rd4dev Aug 9, 2024
7c8dac9
Code cleanup the changes need verification in ci
Rd4dev Aug 9, 2024
f6460e3
Removed steps: git-secret, decrypt secrets and all with caching steps…
Rd4dev Aug 9, 2024
69256ea
Split instrumentation test cases and added test for non kt files checks
Rd4dev Aug 9, 2024
618a9ee
Updated test cases and added tests for non kotlin files
Rd4dev Aug 9, 2024
9b0c209
Updating tests to work on files that are committed and not just added…
Rd4dev Aug 9, 2024
48bc7f7
Fixed/Updated all the test cases with changes to the computing only t…
Rd4dev Aug 9, 2024
3eac085
Reverting the commented check unit test completed job to verify ci runs
Rd4dev Aug 9, 2024
32860d0
Resolve merge conflicts with all upstream list of files and ci workflows
Rd4dev Aug 9, 2024
db0461b
Setup for having the coverage report for main call, moving around tes…
Rd4dev Aug 9, 2024
18e8389
Added necessary changes to be accessible with cli - named as coverage…
Rd4dev Aug 9, 2024
e086d08
Logging: Still trying to figure out matrix workflows to collect pb files
Rd4dev Aug 10, 2024
28593b5
Merge and resolving with upstream after incompatible files are exempted
Rd4dev Aug 10, 2024
7949695
Resolve conflict with coverage BUILD
Rd4dev Aug 10, 2024
8839a01
Updated tests with source incompatible exemption changes
Rd4dev Aug 10, 2024
a970df2
Fix Tests after merging with upstream exemptions
Rd4dev Aug 10, 2024
ea1be84
Storing the protos to their respective file name paths and updated it…
Rd4dev Aug 10, 2024
fa85aa6
Fix tests with saving proto - yet to confirm test case with changes t…
Rd4dev Aug 10, 2024
3377795
Added log statement for md report path
Rd4dev Aug 10, 2024
aeaa8fc
Resolved merge conflict with upstream list of files
Rd4dev Aug 10, 2024
fe67c3a
Commented the dependency to unit test to test coverage runs after cac…
Rd4dev Aug 10, 2024
2709e46
Removing the need dependency for coverage workflow
Rd4dev Aug 10, 2024
7836bdc
Added test cases to cover the mapping of test to source file
Rd4dev Aug 10, 2024
9ee65c2
Fix upstream override of findTestFile args
Rd4dev Aug 10, 2024
73231c5
Fix failing test with additional message missing errors
Rd4dev Aug 10, 2024
f834919
Merge with upstream list of files after test fixes
Rd4dev Aug 10, 2024
7a8f32f
Fix failing tests with high Coverage Exemption
Rd4dev Aug 10, 2024
b89dfb9
Merge with upstream list of files
Rd4dev Aug 10, 2024
b655df7
Reverting the commented out check unit job
Rd4dev Aug 10, 2024
9c47f2f
Resolve merge conflict with upstream ci worflow branch
Rd4dev Aug 10, 2024
e69d44c
Removed older way of loading exemption
Rd4dev Aug 10, 2024
daa43f0
Uploading artifacts to collect the coverage reports dir
Rd4dev Aug 10, 2024
c50117a
Reverting the single comma change with RunCoverage
Rd4dev Aug 10, 2024
71e1591
Improper indentation causing invalid workflow
Rd4dev Aug 10, 2024
c6e8f49
Removing the echo line
Rd4dev Aug 10, 2024
1d35054
Changing the proto to MD as keeping the proto would skip the coverage…
Rd4dev Aug 10, 2024
be67385
Display all downloaded artifacts
Rd4dev Aug 10, 2024
dd207a1
Triggering ci with empty commit, the format here should be proto
Rd4dev Aug 10, 2024
3a6652b
Testing with proto insertion again as md was reported
Rd4dev Aug 10, 2024
7d3bb16
Resolving conflict, guess this might have caused previous mis represe…
Rd4dev Aug 10, 2024
c2e6559
Adding a new line change to app module file to create a new bucket an…
Rd4dev Aug 10, 2024
0252c8a
Filtering out the pb files
Rd4dev Aug 10, 2024
b915295
Fix invalid workflow file
Rd4dev Aug 10, 2024
5250d07
Passing the pb file list to the coverage reporter cli
Rd4dev Aug 10, 2024
24de7e2
Fix Invalid workflow file
Rd4dev Aug 10, 2024
23a9710
Print repo root to avoid workflow fail
Rd4dev Aug 10, 2024
4838527
Save point while testing coverage report collection from pb files loc…
Rd4dev Aug 10, 2024
b251288
Adding setup bazel actions
Rd4dev Aug 10, 2024
7612849
Fix invalid workflow due to incorrect indentation
Rd4dev Aug 10, 2024
defd5d3
Removing the matrix shard encoded name as they contain special charac…
Rd4dev Aug 10, 2024
0126462
Adding in the cache and build environments
Rd4dev Aug 10, 2024
58204d3
Added cache directory and checkout to have the codebase
Rd4dev Aug 10, 2024
495ce30
Added step for cache for bazel
Rd4dev Aug 10, 2024
207def4
Uploading and adding comment job added
Rd4dev Aug 10, 2024
784a782
Upload needs to wait for report collection
Rd4dev Aug 10, 2024
3169075
Using body path instead of body
Rd4dev Aug 10, 2024
e9e26a0
Removed the name for upload artifact
Rd4dev Aug 10, 2024
89c51be
Add part of shard name
Rd4dev Aug 10, 2024
dd05e27
Having shard name need to figure out a way
Rd4dev Aug 10, 2024
35f8046
Reading coverageReport.md and changing upload name
Rd4dev Aug 10, 2024
d236f3c
Changing downloadn name
Rd4dev Aug 10, 2024
197af0e
Resolve conflict with develop
Rd4dev Aug 10, 2024
354e857
Min threshold conflict
Rd4dev Aug 10, 2024
daf29d5
Removing new line in RunCoverage don't want to run it as it takes too…
Rd4dev Aug 10, 2024
d1f05b9
Resolve conflict
Rd4dev Aug 10, 2024
c75aee8
Changing the shard name structure withiout ;
Rd4dev Aug 10, 2024
b53d6b9
Logging find as that seems to be malfuncitoning
Rd4dev Aug 10, 2024
6252a11
Removed call before script
Rd4dev Aug 10, 2024
1774b08
Pb file list and path prefix removed
Rd4dev Aug 10, 2024
3250ed0
Fixing the formats sent
Rd4dev Aug 10, 2024
5a0df85
pb file path saved to env
Rd4dev Aug 11, 2024
257f467
find collection and manipulation is the causer
Rd4dev Aug 11, 2024
6eeb0ae
Retrigger
Rd4dev Aug 11, 2024
2b538dc
Retrigger
Rd4dev Aug 11, 2024
77fb7f6
Retriggering after removing commented liens
Rd4dev Aug 11, 2024
d8fb927
Including only one script runner job
Rd4dev Aug 11, 2024
6df0cd5
save coverage report path to env
Rd4dev Aug 11, 2024
e428e9a
Non reachable null
Rd4dev Aug 11, 2024
ae65826
Added test and coverage content as body
Rd4dev Aug 11, 2024
ba46f4f
Fix unclosed warning
Rd4dev Aug 11, 2024
0bfc314
File path as path
Rd4dev Aug 11, 2024
1bf24e7
commenting test due to ambiguity error
Rd4dev Aug 11, 2024
f8bcbb5
Workaround to atleast get comment out
Rd4dev Aug 11, 2024
e4450a8
Converting it to txt to display it
Rd4dev Aug 11, 2024
ce32858
read text
Rd4dev Aug 11, 2024
b1f9bde
add 2
Rd4dev Aug 11, 2024
010b7ec
Making changes to each type of fail, pass and exemption to see if the…
Rd4dev Aug 11, 2024
50a2a91
Artifact name conflicts saving to a common default directory
Rd4dev Aug 11, 2024
df7361b
Changing the shard name to set to artifact name as it is conflicting,…
Rd4dev Aug 11, 2024
d6fe94e
Reverting format lets see if we can use the existing ones
Rd4dev Aug 11, 2024
391b997
Typo causing failure
Rd4dev Aug 11, 2024
a2181fb
Shard name
Rd4dev Aug 11, 2024
82063eb
Adding shard name to name ; lets see if this drops them in their indi…
Rd4dev Aug 11, 2024
0e0933c
Retrigger since download fail
Rd4dev Aug 11, 2024
1fc466a
Adding condition to run it regardless of pass or fail status to alway…
Rd4dev Aug 11, 2024
1a652a6
Saving them to a certain path while collecting them as a pattern
Rd4dev Aug 11, 2024
e2e14c7
Invalid workflow file
Rd4dev Aug 11, 2024
5c08d7a
Invalid workflow file
Rd4dev Aug 11, 2024
90cc458
uncomment configure bazel
Rd4dev Aug 11, 2024
170b0cc
Adding run line
Rd4dev Aug 11, 2024
31cc9d5
commenting to figure out the issue
Rd4dev Aug 11, 2024
7045263
ADding download
Rd4dev Aug 11, 2024
093fb7f
log dirs
Rd4dev Aug 11, 2024
ea22c30
Fixed the exemption template that missed the new line and added them …
Rd4dev Aug 11, 2024
ad1d3ff
Fix / update tests with changes
Rd4dev Aug 11, 2024
f702a93
Clean up and temporarily exempting RunCoverage as that would fail and…
Rd4dev Aug 11, 2024
90d2a7e
Fix test with CoverageReporterTest color codes
Rd4dev Aug 11, 2024
1d15ea4
Added docs and reverted all testing data
Rd4dev Aug 11, 2024
f1e3463
Revert unintended removal
Rd4dev Aug 11, 2024
a7cd685
Renamed step name for coverage check
Rd4dev Aug 12, 2024
03a8db5
Restructured the Coverage Reporter to its own package since ambiguity…
Rd4dev Aug 12, 2024
aedb5cf
Fix Lint checks and also a save point before reverting to a older com…
Rd4dev Aug 12, 2024
a785c25
Fix Lint check buildifier error
Rd4dev Aug 12, 2024
a38d190
Fix Lint Checks and tests
Rd4dev Aug 12, 2024
81cf307
Mergin with upstream upload-comments branch
Rd4dev Aug 12, 2024
6e960ee
Fix failing tests with new line changes adapted to fit conditional di…
Rd4dev Aug 12, 2024
292a4e9
Added the reference note to the file exemptions list
Rd4dev Aug 12, 2024
59091df
Updated the template for Exempted cases to now be in a tabular form a…
Rd4dev Aug 12, 2024
91084b4
Reverting all new line changes after verifying the report
Rd4dev Aug 12, 2024
8be1411
Reverting all new line changes after verifying the report 2
Rd4dev Aug 12, 2024
5c06aec
Triggering RunAllTests CI run
Rd4dev Aug 12, 2024
3c1b0ac
The previous run all tests failed since the env list was too big, to …
Rd4dev Aug 12, 2024
8801759
Removing the dependency on the unit test workflow to run and verify t…
Rd4dev Aug 12, 2024
c0d2788
Fixing bad substitution of pb_files.txt file in bash command
Rd4dev Aug 12, 2024
0aa4659
Reverting faster coverage report changes to set ready for RunAllTests
Rd4dev Aug 12, 2024
98364e2
New line change to test locally if changes to coverage reporter is ma…
Rd4dev Aug 13, 2024
1338913
New line change to consolelogger as coveragereporter doesn't seem to …
Rd4dev Aug 13, 2024
b9c1d15
Parsing txt file right in script instead of reading it in the workflo…
Rd4dev Aug 13, 2024
912d4f5
Remvoing suffix from the pb file path list as they don't seem to proc…
Rd4dev Aug 13, 2024
272a25b
Including the moved file and trying to figure out ways to parse the l…
Rd4dev Aug 13, 2024
a558149
Testing out the proto save state
Rd4dev Aug 13, 2024
3ce14b6
Pre test push after fixing the list of pb file collection
Rd4dev Aug 13, 2024
a1c187e
Running for a RunAllTests; but the git client test for move files is …
Rd4dev Aug 13, 2024
7d1e592
Running RunAllTests without unit test dependency
Rd4dev Aug 13, 2024
352fd97
Test file exemption added with files that are overriding a min covera…
Rd4dev Aug 13, 2024
3d4151a
File exemption with overridden min coverage threshold sorted
Rd4dev Aug 13, 2024
ba0159b
Clean up after sorting the test exemptions; test to be added for move…
Rd4dev Aug 13, 2024
93d97ee
Added and updated tests with changes to retrieving renamed / moved files
Rd4dev Aug 13, 2024
0f051a5
Reverting commented unit test workflow dependency
Rd4dev Aug 13, 2024
da05cf1
Updated Kdocs for CoverageReporter with changes to providing proto pa…
Rd4dev Aug 13, 2024
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
98 changes: 94 additions & 4 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
# Push events on develop branch
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check_unit_tests_completed:
name: Check unit test completed
Expand Down Expand Up @@ -149,18 +153,21 @@ jobs:

- name: Extract caching bucket
env:
CHANGED_FILESS_BUCKET_BASE64_ENCODED_SHARD: ${{ matrix.changed-files-bucket-base64-encoded-shard }}
CHANGED_FILES_BUCKET_BASE64_ENCODED_SHARD: ${{ matrix.changed-files-bucket-base64-encoded-shard }}
run: |
# See https://stackoverflow.com/a/29903172 for cut logic. This is needed to remove the
# user-friendly shard prefix from the matrix value.
CHANGED_FILES_BUCKET_BASE64=$(echo "$CHANGED_FILESS_BUCKET_BASE64_ENCODED_SHARD" | cut -d ";" -f 2)
CHANGED_FILES_BUCKET_BASE64=$(echo "$CHANGED_FILES_BUCKET_BASE64_ENCODED_SHARD" | cut -d ";" -f 2)
SHARD_NAME=$(echo "$CHANGED_FILES_BUCKET_BASE64_ENCODED_SHARD" | cut -d ";" -f 1)
bazel run //scripts:retrieve_changed_files -- $(pwd) $CHANGED_FILES_BUCKET_BASE64 $(pwd)/file_bucket_name $(pwd)/changed_files $(pwd)/bazel_test_targets
FILE_CATEGORY=$(cat ./file_bucket_name)
CHANGED_FILES=$(cat ./changed_files)
BAZEL_TEST_TARGETS=$(cat ./bazel_test_targets)
echo "File category: $FILE_CATEGORY"
echo "Changed Files: $CHANGED_FILES"
echo "Bazel test targets: $BAZEL_TEST_TARGETS"
echo "Shard name: $SHARD_NAME"
echo "SHARD_NAME=$SHARD_NAME" >> $GITHUB_ENV
echo "FILE_CACHING_BUCKET=$FILE_CATEGORY" >> $GITHUB_ENV
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
echo "BAZEL_TEST_TARGETS=$BAZEL_TEST_TARGETS" >> $GITHUB_ENV
Expand Down Expand Up @@ -239,12 +246,91 @@ jobs:
env:
CHANGED_FILES: ${{ env.CHANGED_FILES }}
run: |
bazel run //scripts:run_coverage -- $(pwd) $CHANGED_FILES --format=MARKDOWN --processTimeout=15
echo "CHANGED FILES: $CHANGED_FILES"
bazel run //scripts:run_coverage -- $(pwd) $CHANGED_FILES --format=PROTO --processTimeout=15

- name: Upload Coverage Report Artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ env.SHARD_NAME }} # Saving with unique names to avoid conflict
path: coverage_reports

evaluate-code-coverage-reports:
name: Evaluate Code Coverage Reports
runs-on: ubuntu-20.04
needs: code_coverage_run
env:
CACHE_DIRECTORY: ~/.bazel_cache
steps:
- uses: actions/checkout@v2

- name: Download Coverage Report Artifacts
uses: actions/download-artifact@v4
with:
path: coverage-report-artifact
pattern: coverage-report-*
merge-multiple: true

- name: Filter Coverage Reports
run: |
# Find all coverage_report.pb files in the current directory and subdirectories
PB_FILES_LIST=($(find . -name "coverage_report.pb" -type f -print0 | xargs -0 -n 1 echo))
echo "${PB_FILES_LIST[@]}" > pb_files.txt

- name: Set up Bazel
uses: abhinavsingh/setup-bazel@v3
with:
version: 6.5.0

- uses: actions/cache@v2
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
key: ${{ runner.os }}-${{ env.CACHE_DIRECTORY }}-bazel-scripts-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.CACHE_DIRECTORY }}-bazel-scripts-
${{ runner.os }}-${{ env.CACHE_DIRECTORY }}-bazel-

- name: Set up build environment
uses: ./.github/actions/set-up-android-bazel-build-environment

- name: Generate Markdown Coverage Report
run: |
bazel run //scripts:coverage_reporter -- $(pwd) pb_files.txt

- name: Upload Generated Markdown Report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status
with:
name: final-coverage-report
path: coverage_reports/CoverageReport.md

publish_coverage_report:
name: Publish Code Coverage Report
needs: evaluate-code-coverage-reports
permissions:
pull-requests: write

# The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations,
# serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Download Generated Markdown Report
uses: actions/download-artifact@v4
with:
name: final-coverage-report

- name: Upload Coverage Report as PR Comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: 'CoverageReport.md'

# Reference: https://github.community/t/127354/7.
check_coverage_results:
name: Check Code Coverage Results
needs: [ compute_changed_files, code_coverage_run ]
needs: [ compute_changed_files, code_coverage_run, evaluate-code-coverage-reports ]
# The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations,
# serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows.
if: ${{ !cancelled() }}
Expand All @@ -253,3 +339,7 @@ jobs:
- name: Check coverages passed
if: ${{ needs.compute_changed_files.outputs.can_skip_files != 'true' && needs.code_coverage_run.result != 'success' }}
run: exit 1

- name: Check that coverage status is passed
if: ${{ needs.evaluate-code-coverage-reports.result != 'success' }}
run: exit 1
10 changes: 10 additions & 0 deletions scripts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ kt_jvm_binary(
],
)

kt_jvm_binary(
name = "coverage_reporter",
testonly = True,
data = TEST_FILE_EXEMPTION_ASSETS,
main_class = "org.oppia.android.scripts.coverage.reporter.CoverageReporterKt",
runtime_deps = [
"//scripts/src/java/org/oppia/android/scripts/coverage/reporter:coverage_reporter_lib",
],
)

kt_jvm_binary(
name = "retrieve_changed_files",
testonly = True,
Expand Down
96 changes: 94 additions & 2 deletions scripts/assets/test_file_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ test_file_exemption {
exempted_file_path: "app/src/main/java/org/oppia/android/app/activity/ActivityComponentImpl.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "app/src/main/java/org/oppia/android/app/activity/ActivityIntentFactories.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "app/src/main/java/org/oppia/android/app/activity/ActivityIntentFactoriesModule.kt"
test_file_not_required: true
Expand Down Expand Up @@ -1015,11 +1019,11 @@ test_file_exemption {
source_file_is_incompatible_with_code_coverage: true
}
test_file_exemption {
exempted_file_path: "app/src/main/java/org/oppia/android/app/home/classroomlist/ClassroomSummaryClickListener.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/home/classroomlist/AllClassroomsViewModel.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "app/src/main/java/org/oppia/android/app/home/classroomlist/AllClassroomsViewModel.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/home/classroomlist/ClassroomSummaryClickListener.kt"
test_file_not_required: true
}
test_file_exemption {
Expand Down Expand Up @@ -3070,6 +3074,10 @@ test_file_exemption {
exempted_file_path: "data/src/main/java/org/oppia/android/data/backends/gae/Constants.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "data/src/main/java/org/oppia/android/data/backends/gae/JsonPrefixNetworkInterceptor.kt"
override_min_coverage_percent_required: 28
}
test_file_exemption {
exempted_file_path: "data/src/main/java/org/oppia/android/data/backends/gae/NetworkApiKey.kt"
test_file_not_required: true
Expand All @@ -3082,6 +3090,10 @@ test_file_exemption {
exempted_file_path: "data/src/main/java/org/oppia/android/data/backends/gae/XssiPrefix.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "data/src/main/java/org/oppia/android/data/backends/gae/api/FeedbackReportingService.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "data/src/main/java/org/oppia/android/data/backends/gae/model/GaeFeedbackReport.kt"
test_file_not_required: true
Expand Down Expand Up @@ -3114,6 +3126,10 @@ test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/audio/CellularAudioDialogController.kt"
source_file_is_incompatible_with_code_coverage: true
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/auth/AuthenticationController.kt"
override_min_coverage_percent_required: 21
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/auth/FirebaseAuthInstance.kt"
test_file_not_required: true
Expand All @@ -3130,6 +3146,10 @@ test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/auth/FirebaseAuthWrapper.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/auth/FirebaseAuthWrapperImpl.kt"
override_min_coverage_percent_required: 31
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/auth/FirebaseUserWrapper.kt"
test_file_not_required: true
Expand Down Expand Up @@ -3582,6 +3602,10 @@ test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/OppiaLogger.kt"
source_file_is_incompatible_with_code_coverage: true
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsController.kt"
override_min_coverage_percent_required: 68
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsStartupListener.kt"
test_file_not_required: true
Expand All @@ -3594,6 +3618,10 @@ test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceLoggingTimePeriodMillis.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/CpuPerformanceSnapshotterModule.kt"
override_min_coverage_percent_required: 26
}
test_file_exemption {
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/LearnerAnalyticsInactivityLimitMillis.kt"
test_file_not_required: true
Expand Down Expand Up @@ -3838,6 +3866,18 @@ test_file_exemption {
exempted_file_path: "instrumentation/src/java/org/oppia/android/instrumentation/testing/EndToEndTestHelper.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "scripts/src/java/org/oppia/android/scripts/apkstats/ApkAnalyzerClient.kt"
override_min_coverage_percent_required: 6
}
test_file_exemption {
exempted_file_path: "scripts/src/java/org/oppia/android/scripts/apkstats/BundleToolClient.kt"
override_min_coverage_percent_required: 59
}
test_file_exemption {
exempted_file_path: "scripts/src/java/org/oppia/android/scripts/apkstats/ComputeAabDifferences.kt"
override_min_coverage_percent_required: 6
}
test_file_exemption {
exempted_file_path: "scripts/src/java/org/oppia/android/scripts/common/CommandExecutor.kt"
test_file_not_required: true
Expand Down Expand Up @@ -3990,10 +4030,18 @@ test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/espresso/KonfettiViewMatcher.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/espresso/TextInputAction.kt"
override_min_coverage_percent_required: 60
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/junit/DefineAppLanguageLocaleContext.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRule.kt"
override_min_coverage_percent_required: 38
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/junit/OppiaParameterizedBaseRunner.kt"
test_file_not_required: true
Expand Down Expand Up @@ -4042,6 +4090,10 @@ test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/logging/EventLogSubject.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/logging/SyncStatusTestModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/math/ComparableOperationSubject.kt"
test_file_not_required: true
Expand Down Expand Up @@ -4098,6 +4150,10 @@ test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/MockFeedbackReportingService.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/MockPlatformParameterService.kt"
override_min_coverage_percent_required: 64
}
test_file_exemption {
exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/MockQuestionPlayerService.kt"
test_file_not_required: true
Expand Down Expand Up @@ -4274,6 +4330,10 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/gcsresource/GcsResourceModule.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/locale/LocaleProdModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/locale/OppiaBidiFormatter.kt"
test_file_not_required: true
Expand All @@ -4282,10 +4342,18 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/locale/OppiaLocale.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/locale/testing/LocaleTestModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/AnalyticsEventLogger.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/ConsoleLogger.kt"
override_min_coverage_percent_required: 54
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/ConsoleLoggerInjector.kt"
test_file_not_required: true
Expand All @@ -4294,6 +4362,10 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/ConsoleLoggerInjectorProvider.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/EventLoggingConfigurationModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt"
test_file_not_required: true
Expand All @@ -4302,6 +4374,10 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/ExceptionLogger.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventTypeToHumanReadableNameConverterImpl.kt"
test_file_not_required: true
Expand Down Expand Up @@ -4398,6 +4474,10 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/math/FractionExtensions.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/math/MathExpressionExtensions.kt"
override_min_coverage_percent_required: 42
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/math/MathParsingError.kt"
test_file_not_required: true
Expand All @@ -4418,6 +4498,14 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/networking/NetworkConnectionUtil.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/networking/NetworkConnectionUtilDebugModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/networking/NetworkConnectionUtilProdModule.kt"
override_min_coverage_percent_required: 0
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/html/ExplorationHtmlParserEntityType.kt"
test_file_not_required: true
Expand Down Expand Up @@ -4494,6 +4582,10 @@ test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/image/TextPictureDrawable.kt"
test_file_not_required: true
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/image/UrlImageParser.kt"
override_min_coverage_percent_required: 57
}
test_file_exemption {
exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/math/MathBitmapModelLoader.kt"
test_file_not_required: true
Expand Down
Loading
Loading