diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4a04023cc..bd4622f78c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/build.gradle.kts b/build.gradle.kts index 3aa652924c..673ba44d6e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,6 +65,7 @@ subprojects { } protonCoverageMultiModuleOptions { + runTestTasksBefore = false sharedExcludes = listOf("**/me/proton/core/**") coverageConversionScript = { "$rootDir/../proton-libs/plugins/jacoco/scripts/cover2cover.py" } } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 8bd820224a..2f374a53ed 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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" diff --git a/test/build.gradle.kts b/test/build.gradle.kts new file mode 100644 index 0000000000..56107a4811 --- /dev/null +++ b/test/build.gradle.kts @@ -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 . + */ + +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" + ) +}