Merge coverage reporting with unit tests execution

As of now, coverage is only generated by unit tests execution. Since Gradle 8.x is incompatible with the Cobertura task we use, avoid re-running unit tests when running the report task and keep everything within the same step.

MAILANDR-584
This commit is contained in:
Niccolò Forlini
2023-06-09 09:18:13 +02:00
parent 381404aa4c
commit 982cbc0969
4 changed files with 43 additions and 20 deletions
+10 -18
View File
@@ -30,7 +30,6 @@ stages:
- build
- startReview
- test
- report
- deploy
- stopReview
@@ -148,6 +147,16 @@ run_unit_test:
- build_dev_debug
script:
- bundle exec fastlane unitTest
- bundle exec fastlane coverageReport
coverage: /Total.*?(\d{1,3}\.\d{0,2})%/
artifacts:
expire_in: 1 week
paths:
- build/reports
reports:
coverage_report:
coverage_format: cobertura
path: build/reports/cobertura-coverage.xml
run_firebase_proton_core_libs_tests:
extends: .firebase_test_job
@@ -182,23 +191,6 @@ run_firebase_full_regression_tests:
rules:
- if: $CI_COMMIT_BRANCH == "master" && $NIGHTLY_ALPHA_BUILD == "true"
coverage report:
stage: report
extends: .base_job
tags:
- xlarge-k8s
script:
- bundle exec fastlane coverageReport
coverage: /Total.*?(\d{1,3}\.\d{0,2})%/
artifacts:
expire_in: 1 week
paths:
- build/reports
reports:
coverage_report:
coverage_format: cobertura
path: build/reports/cobertura-coverage.xml
deploy_to_firebase_dev:
extends: .firebase_deploy_job
script:
+1
View File
@@ -65,6 +65,7 @@ subprojects {
}
protonCoverageMultiModuleOptions {
runTestTasksBefore = false
sharedExcludes = listOf("**/me/proton/core/**")
coverageConversionScript = { "$rootDir/../proton-libs/plugins/jacoco/scripts/cover2cover.py" }
}
+2 -2
View File
@@ -46,7 +46,7 @@ platform :android do
desc "Runs Unit Tests"
lane :unitTest do
gradle(tasks: ["testDevDebugUnitTest", "testDebugUnitTest"])
gradle(tasks: ["testDevDebugUnitTest", "testDebugUnitTest", "testUtilsUnitTest"])
end
desc "Setup UI Tests mocked network assets"
@@ -76,7 +76,7 @@ platform :android do
desc "Generate test coverage report based on the last test run"
lane :coverageReport do
gradle(task: "-Pci --console=plain coberturaCoverageReport -x testAlphaDebugUnitTest -x testProdDebugUnitTest")
gradle(task: "-Pci --console=plain coberturaCoverageReport")
end
desc "Publish alpha build to firebase dev group"
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton Technologies AG and Proton Mail.
*
* Proton Mail is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Proton Mail is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proton Mail. If not, see <https://www.gnu.org/licenses/>.
*/
plugins {
id("org.jetbrains.kotlin.jvm")
}
tasks.register("testUtilsUnitTest", Test::class) {
// No need for a specific execution order.
dependsOn(
":test:network-mocks:test",
":test:robot:ksp:processor:test",
":test:robot:ksp:annotations:test"
)
}