diff --git a/src/dev/code_coverage/shell_scripts/copy_jest_report.sh b/src/dev/code_coverage/shell_scripts/copy_jest_report.sh new file mode 100755 index 0000000000000..7ecdf21158867 --- /dev/null +++ b/src/dev/code_coverage/shell_scripts/copy_jest_report.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +EXTRACT_START_DIR=tmp/extracted_coverage +EXTRACT_END_DIR=target/kibana-coverage +COMBINED_EXRACT_DIR=/${EXTRACT_START_DIR}/${EXTRACT_END_DIR} + + +echo "### Copy combined jest report" +mkdir -p $EXTRACT_END_DIR/jest-combined +cp -r $COMBINED_EXRACT_DIR/jest-combined/. $EXTRACT_END_DIR/jest-combined/ \ No newline at end of file diff --git a/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh b/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh index 01003b6dc880c..6e6ba9e1b1118 100644 --- a/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh +++ b/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh @@ -7,12 +7,6 @@ COMBINED_EXRACT_DIR=/${EXTRACT_START_DIR}/${EXTRACT_END_DIR} PWD=$(pwd) du -sh $COMBINED_EXRACT_DIR -echo "### Jest: replacing path in json files" -for i in oss oss-integration xpack; do - sed -i "s|/dev/shm/workspace/kibana|${PWD}|g" $COMBINED_EXRACT_DIR/jest/${i}-coverage-final.json & -done -wait - echo "### Functional: replacing path in json files" for i in {1..9}; do sed -i "s|/dev/shm/workspace/kibana|${PWD}|g" $COMBINED_EXRACT_DIR/functional/${i}*.json & diff --git a/src/dev/code_coverage/shell_scripts/generate_team_assignments_and_ingest_coverage.sh b/src/dev/code_coverage/shell_scripts/generate_team_assignments_and_ingest_coverage.sh index caa1f1a761367..69b95524d247d 100644 --- a/src/dev/code_coverage/shell_scripts/generate_team_assignments_and_ingest_coverage.sh +++ b/src/dev/code_coverage/shell_scripts/generate_team_assignments_and_ingest_coverage.sh @@ -32,7 +32,7 @@ TEAM_ASSIGN_PATH=$5 # Build team assignments dat file node scripts/generate_team_assignments.js --verbose --src .github/CODEOWNERS --dest $TEAM_ASSIGN_PATH -for x in jest functional; do +for x in functional; do echo "### Ingesting coverage for ${x}" COVERAGE_SUMMARY_FILE=target/kibana-coverage/${x}-combined/coverage-summary.json @@ -40,5 +40,11 @@ for x in jest functional; do node scripts/ingest_coverage.js --verbose --path ${COVERAGE_SUMMARY_FILE} --vcsInfoPath ./VCS_INFO.txt --teamAssignmentsPath $TEAM_ASSIGN_PATH done +# Need to override COVERAGE_INGESTION_KIBANA_ROOT since jest coverage-summary.json has original intake worker path +COVERAGE_SUMMARY_FILE=target/kibana-coverage/jest-combined/coverage-summary.json +export COVERAGE_INGESTION_KIBANA_ROOT=/dev/shm/workspace/kibana + +node scripts/ingest_coverage.js --verbose --path ${COVERAGE_SUMMARY_FILE} --vcsInfoPath ./VCS_INFO.txt --teamAssignmentsPath $TEAM_ASSIGN_PATH + echo "### Ingesting Code Coverage - Complete" echo "" diff --git a/src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh b/src/dev/code_coverage/shell_scripts/merge_functional.sh old mode 100644 new mode 100755 similarity index 54% rename from src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh rename to src/dev/code_coverage/shell_scripts/merge_functional.sh index 707c6de3f88a0..5f03e5f24528a --- a/src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh +++ b/src/dev/code_coverage/shell_scripts/merge_functional.sh @@ -4,6 +4,4 @@ COVERAGE_TEMP_DIR=/tmp/extracted_coverage/target/kibana-coverage/ export COVERAGE_TEMP_DIR echo "### Merge coverage reports" -for x in jest functional; do - yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.${x}.config.js -done +yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.functional.config.js diff --git a/test/scripts/jenkins_unit.sh b/test/scripts/jenkins_unit.sh index 9e387f97a016e..a483f8378b8b4 100755 --- a/test/scripts/jenkins_unit.sh +++ b/test/scripts/jenkins_unit.sh @@ -32,4 +32,7 @@ else echo " -> Running jest integration tests with coverage" node scripts/jest_integration --ci --verbose --coverage || true; + + echo " -> Combine code coverage in a single report" + yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.jest.config.js fi diff --git a/vars/kibanaCoverage.groovy b/vars/kibanaCoverage.groovy index e393f3a5d2150..29f44dac15809 100644 --- a/vars/kibanaCoverage.groovy +++ b/vars/kibanaCoverage.groovy @@ -59,7 +59,7 @@ def uploadBaseWebsiteFiles(prefix) { def uploadCoverageHtmls(prefix) { [ 'target/kibana-coverage/functional-combined', - 'target/kibana-coverage/jest-combined', + //'target/kibana-coverage/jest-combined', ].each { uploadWithVault(prefix, it) } } @@ -148,7 +148,8 @@ def generateReports(title) { cd .. . src/dev/code_coverage/shell_scripts/extract_archives.sh . src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh - . src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh + . src/dev/code_coverage/shell_scripts/merge_functional.sh + . src/dev/code_coverage/shell_scripts/copy_jest_report.sh # zip combined reports tar -czf kibana-coverage.tar.gz target/kibana-coverage/**/* """, title) diff --git a/vars/kibanaPipeline.groovy b/vars/kibanaPipeline.groovy index e49692568cec8..5e3d9c0b4aa2f 100644 --- a/vars/kibanaPipeline.groovy +++ b/vars/kibanaPipeline.groovy @@ -181,7 +181,7 @@ def withGcsArtifactUpload(workerName, closure) { def ARTIFACT_PATTERNS = [ 'target/junit/**/*', 'target/kibana-*', - 'target/kibana-coverage/**/*', + 'target/kibana-coverage/jest*/**/*', 'target/kibana-security-solution/**/*.png', 'target/test-metrics/*', 'target/test-suites-ci-plan.json',