mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[coverage] fix jest merging (#90915)
* [coverage] fix jest merging * fix path to functional results * revert wrong change * fix ingest script * fix ingest script * [coverage plugin] change id to camelCase Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
6569117b06
commit
2fe0d05375
8 changed files with 27 additions and 16 deletions
10
src/dev/code_coverage/shell_scripts/copy_jest_report.sh
Executable file
10
src/dev/code_coverage/shell_scripts/copy_jest_report.sh
Executable file
|
@ -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/
|
|
@ -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 &
|
||||
|
|
|
@ -32,11 +32,16 @@ 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 jest; do
|
||||
echo "### Ingesting coverage for ${x}"
|
||||
|
||||
COVERAGE_SUMMARY_FILE=target/kibana-coverage/${x}-combined/coverage-summary.json
|
||||
|
||||
if [[ $x == "jest" ]]; then
|
||||
# Need to override COVERAGE_INGESTION_KIBANA_ROOT since json file has original intake worker path
|
||||
export COVERAGE_INGESTION_KIBANA_ROOT=/dev/shm/workspace/kibana
|
||||
fi
|
||||
|
||||
node scripts/ingest_coverage.js --verbose --path ${COVERAGE_SUMMARY_FILE} --vcsInfoPath ./VCS_INFO.txt --teamAssignmentsPath $TEAM_ASSIGN_PATH
|
||||
done
|
||||
|
||||
|
|
4
src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh → src/dev/code_coverage/shell_scripts/merge_functional.sh
Normal file → Executable file
4
src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh → src/dev/code_coverage/shell_scripts/merge_functional.sh
Normal file → Executable file
|
@ -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
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "coverage-fixtures",
|
||||
"id": "coverageFixtures",
|
||||
"version": "kibana",
|
||||
"server": false,
|
||||
"ui": true
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -148,9 +148,10 @@ 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
|
||||
# zip combined reports
|
||||
tar -czf kibana-coverage.tar.gz target/kibana-coverage/**/*
|
||||
. src/dev/code_coverage/shell_scripts/merge_functional.sh
|
||||
. src/dev/code_coverage/shell_scripts/copy_jest_report.sh
|
||||
# zip functional combined report
|
||||
tar -czf kibana-functional-coverage.tar.gz target/kibana-coverage/functional-combined/*
|
||||
""", title)
|
||||
}
|
||||
|
||||
|
@ -162,7 +163,7 @@ def uploadCombinedReports() {
|
|||
|
||||
kibanaPipeline.uploadGcsArtifact(
|
||||
"kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/coverage/combined",
|
||||
'kibana-coverage.tar.gz'
|
||||
'kibana-functional-coverage.tar.gz'
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue