From 31e6280b75888efb76fa61f5086b26d67428459b Mon Sep 17 00:00:00 2001 From: Chi Cao Minh Date: Wed, 28 Aug 2019 08:49:30 -0700 Subject: [PATCH] Use Codecov (#8388) * Use Codecov Upload coverage reports to Codecov. For now, having Codecov comment on PRs or enforcing a minimum coverage threshold are both disabled until the Codecov coverage reports look reliable: https://codecov.io/gh/apache/incubator-druid * Split bash and curl into separate lines --- .codecov.yml | 31 ++++++++ .travis.yml | 17 ++++- README.md | 2 +- pom.xml | 3 +- web-console/package-lock.json | 128 ++++++++++++++++++++++++++-------- web-console/package.json | 3 + web-console/pom.xml | 2 +- 7 files changed, 152 insertions(+), 34 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000000..0bff01cd7bb --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Documentation for Codecov yaml: https://docs.codecov.io/docs/codecov-yaml +# +# Validate changes with: +# curl --data-binary @.codecov.yml https://codecov.io/validate + +# Documentation for pull request comments: https://docs.codecov.io/docs/pull-request-comments +# Consider enabling pull request comments after codecov reports look reliable. +comment: off + +coverage: + # Documentation for commit status: https://docs.codecov.io/docs/commit-status + # Consider enabling commit status to enforce minimum coverage thresholds after codecov reports look reliable. + status: + project: off + patch: off diff --git a/.travis.yml b/.travis.yml index 90ceae2cd75..11149d27547 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,6 +115,11 @@ matrix: ${MAVEN_SKIP} -Dremoteresources.skip=true - sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0" - free -m + after_success: &upload_java_unit_test_coverage + - ${MVN} -pl ${MAVEN_PROJECTS} jacoco:report + # retry in case of network error + - travis_retry curl -o codecov.sh -s https://codecov.io/bash + - travis_retry bash codecov.sh -X gcov - name: "processing module test (SQL Compatibility)" env: *processing_env @@ -127,43 +132,53 @@ matrix: ${MAVEN_SKIP} -Dremoteresources.skip=true - sh -c "dmesg | egrep -i '(oom|out of memory|kill process|killed).*' -C 1 || exit 0" - free -m + after_success: *upload_java_unit_test_coverage - name: "indexing modules test" env: &indexing_env - MAVEN_PROJECTS='indexing-hadoop,indexing-service,extensions-core/kafka-indexing-service,extensions-core/kinesis-indexing-service' before_script: *setup_java_test script: *run_java_test + after_success: *upload_java_unit_test_coverage - name: "indexing modules test (SQL Compatibility)" env: *indexing_env before_script: *setup_java_test script: *run_java_sql_compat_test + after_success: *upload_java_unit_test_coverage - name: "server module test" env: &server_env - MAVEN_PROJECTS='server' before_script: *setup_java_test script: *run_java_test + after_success: *upload_java_unit_test_coverage - name: "server module test (SQL Compatibility)" env: *server_env before_script: *setup_java_test script: *run_java_sql_compat_test + after_success: *upload_java_unit_test_coverage - name: "other modules test" env: &other_env - MAVEN_PROJECTS='!processing,!indexing-hadoop,!indexing-service,!extensions-core/kafka-indexing-service,!extensions-core/kinesis-indexing-service,!server,!web-console' before_script: *setup_java_test script: *run_java_test + after_success: *upload_java_unit_test_coverage - name: "other modules test (SQL Compatibility)" env: *other_env before_script: *setup_java_test script: *run_java_sql_compat_test + after_success: *upload_java_unit_test_coverage - name: "web console" install: skip - script: ${MVN} test -pl 'web-console' + script: + - ${MVN} test -pl 'web-console' + after_success: + - (cd web-console && travis_retry npm run codecov) # retry in case of network error - name: "docs" install: (cd website && npm install) diff --git a/README.md b/README.md index a967d6514db..4e660d6199e 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ [![Slack](https://img.shields.io/badge/slack-%23druid-72eff8?logo=slack)](https://druid.apache.org/community/join-slack) [![Build Status](https://travis-ci.org/apache/incubator-druid.svg?branch=master)](https://travis-ci.org/apache/incubator-druid) [![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/apache/incubator-druid.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/apache/incubator-druid/context:java) +[![Coverage Status](https://img.shields.io/codecov/c/gh/apache/incubator-druid)](https://codecov.io/gh/apache/incubator-druid) [![Docker](https://img.shields.io/badge/container-docker-blue.svg)](https://hub.docker.com/r/apache/incubator-druid) - ## Apache Druid (incubating) diff --git a/pom.xml b/pom.xml index ebcbd963d00..14d1feb287c 100644 --- a/pom.xml +++ b/pom.xml @@ -984,7 +984,8 @@ org/apache/druid/data/input/influx/InfluxLineProtocol* - org/apache/druid/**/*Benchmark.* + org/apache/druid/benchmark/**/* + org/apache/druid/**/*Benchmark* org/testng/DruidTestRunnerFactory* org/apache/druid/testing/**/* diff --git a/web-console/package-lock.json b/web-console/package-lock.json index a4ae431dacc..ef9d39d00aa 100644 --- a/web-console/package-lock.json +++ b/web-console/package-lock.json @@ -1960,6 +1960,15 @@ "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", "dev": true }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, "airbnb-prop-types": { "version": "2.14.0", "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.14.0.tgz", @@ -2125,6 +2134,12 @@ "sprintf-js": "~1.0.2" } }, + "argv": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", + "integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=", + "dev": true + }, "aria-query": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz", @@ -3203,6 +3218,19 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, + "codecov": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.5.0.tgz", + "integrity": "sha512-/OsWOfIHaQIr7aeZ4pY0UC1PZT6kimoKFOFYFNb6wxo3iw12nRrh+mNGH72rnXxNsq6SGfesVPizm/6Q3XqcFQ==", + "dev": true, + "requires": { + "argv": "^0.0.2", + "ignore-walk": "^3.0.1", + "js-yaml": "^3.13.1", + "teeny-request": "^3.11.3", + "urlgrey": "^0.4.4" + } + }, "collapse-white-space": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.5.tgz", @@ -4691,6 +4719,21 @@ "is-symbol": "^1.0.2" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -5501,8 +5544,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -5523,14 +5565,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5545,20 +5585,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -5675,8 +5712,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -5688,7 +5724,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5703,7 +5738,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5711,14 +5745,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -5737,7 +5769,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -5818,8 +5849,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -5831,7 +5861,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -5917,8 +5946,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -5954,7 +5982,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5974,7 +6001,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6018,14 +6044,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -6684,6 +6708,16 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "https-proxy-agent": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz", + "integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==", + "dev": true, + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6734,6 +6768,15 @@ "integrity": "sha1-tJ7yJ0va/NikiAqWa/440aC/RnE=", "dev": true }, + "ignore-walk": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "dev": true, + "requires": { + "minimatch": "^3.0.4" + } + }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -13302,6 +13345,25 @@ "inherits": "2" } }, + "teeny-request": { + "version": "3.11.3", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-3.11.3.tgz", + "integrity": "sha512-CKncqSF7sH6p4rzCgkb/z/Pcos5efl0DmolzvlqRQUNcpRIruOhY9+T1FsIlyEbfWd7MsFpodROOwHYh2BaXzw==", + "dev": true, + "requires": { + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.2.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "dev": true + } + } + }, "terser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/terser/-/terser-4.2.0.tgz", @@ -14120,6 +14182,12 @@ "requires-port": "^1.0.0" } }, + "urlgrey": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.4.tgz", + "integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=", + "dev": true + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", diff --git a/web-console/package.json b/web-console/package.json index 553938f52e7..1cb954cdc93 100644 --- a/web-console/package.json +++ b/web-console/package.json @@ -36,6 +36,8 @@ "compile": "./script/build", "pretest": "./script/build", "test": "npm run tslint && npm run sasslint && jest --silent 2>&1", + "test-ci": "npm run tslint && npm run sasslint && jest --coverage", + "codecov": "codecov --disable=gcov -p ..", "coverage": "jest --coverage", "update-snapshots": "jest -u", "tslint": "./node_modules/.bin/tslint -c tslint.json --project tsconfig.json --formatters-dir ./node_modules/awesome-code-style/formatter 'src/**/*.ts?(x)'", @@ -104,6 +106,7 @@ "autoprefixer": "^9.6.1", "awesome-code-style": "^1.4.3", "babel-loader": "^8.0.6", + "codecov": "^3.5.0", "css-loader": "^3.2.0", "enzyme": "^3.10.0", "enzyme-adapter-react-16": "^1.14.0", diff --git a/web-console/pom.xml b/web-console/pom.xml index bad17b8d72a..7046efc75bd 100644 --- a/web-console/pom.xml +++ b/web-console/pom.xml @@ -84,7 +84,7 @@ test - test + run test-ci ${project.build.directory}