Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] implementing github checks - second attempt (#35757) #35906

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions github_checks_reporter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"appId": 26774,
"envVars": {
"appKey": "KIBANA_CI_REPORTER_KEY"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"@babel/parser": "^7.3.4",
"@babel/types": "^7.3.4",
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/github-checks-reporter": "0.0.11",
"@elastic/makelogs": "^4.4.0",
"@kbn/es": "1.0.0",
"@kbn/eslint-import-resolver-kibana": "2.0.0",
Expand Down
25 changes: 25 additions & 0 deletions src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,28 @@ if [ "$GIT_CHANGES" ]; then
echo -e "$GIT_CHANGES\n"
exit 1
fi

###
### github-checks-reporter kill switch. Remove to disable
###
export CHECKS_REPORTER_ACTIVE=true

### only run on pr jobs
if [[ "$JOB_NAME" != "elastic+kibana+pull-request"* ]] ; then
export CHECKS_REPORTER_ACTIVE=false
fi

###
### Implements github-checks-reporter kill switch when scripts are called from the command line
### $@ - all arguments
###
function checks-reporter-with-killswitch() {
if [ "$CHECKS_REPORTER_ACTIVE" == "true" ] ; then
yarn run github-checks-reporter "$@"
else
arguments=("$@");
"${arguments[@]:1}";
fi
}

export -f checks-reporter-with-killswitch
140 changes: 90 additions & 50 deletions tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,79 +62,101 @@ module.exports = function (grunt) {
'--server.port=5610',
];

const NODE = 'node';
const scriptWithGithubChecks = ({ title, options, cmd, args }) => (
process.env.CHECKS_REPORTER_ACTIVE === 'true' ? {
options,
cmd: 'yarn',
args: ['run', 'github-checks-reporter', title, cmd, ...args],
} : { options, cmd, args });
const gruntTaskWithGithubChecks = (title, task) =>
scriptWithGithubChecks({
title,
cmd: 'yarn',
args: ['run', 'grunt', task]
});

return {
// used by the test and jenkins:unit tasks
// runs the eslint script to check for linting errors
eslint: {
cmd: process.execPath,
eslint: scriptWithGithubChecks({
title: 'eslint',
cmd: NODE,
args: [
require.resolve('../../scripts/eslint'),
'scripts/eslint',
'--no-cache'
]
},
}),

sasslint: {
cmd: process.execPath,
sasslint: scriptWithGithubChecks({
title: 'sasslint',
cmd: NODE,
args: [
require.resolve('../../scripts/sasslint')
'scripts/sasslint'
]
},
}),

// used by the test tasks
// runs the check_file_casing script to ensure filenames use correct casing
checkFileCasing: {
cmd: process.execPath,
checkFileCasing: scriptWithGithubChecks({
title: 'Check file casing',
cmd: NODE,
args: [
require.resolve('../../scripts/check_file_casing'),
'scripts/check_file_casing',
'--quiet' // only log errors, not warnings
]
},
}),

// used by the test tasks
// runs the check_core_api_changes script to ensure API changes are explictily accepted
checkCoreApiChanges: {
cmd: process.execPath,
checkCoreApiChanges: scriptWithGithubChecks({
title: 'Check core API changes',
cmd: NODE,
args: [
require.resolve('../../scripts/check_core_api_changes')
'scripts/check_core_api_changes'
]
},
}),

// used by the test and jenkins:unit tasks
// runs the typecheck script to check for Typescript type errors
typeCheck: {
cmd: process.execPath,
typeCheck: scriptWithGithubChecks({
title: 'Type check',
cmd: NODE,
args: [
require.resolve('../../scripts/type_check')
'scripts/type_check'
]
},
}),

// used by the test and jenkins:unit tasks
// ensures that all typescript files belong to a typescript project
checkTsProjects: {
cmd: process.execPath,
checkTsProjects: scriptWithGithubChecks({
title: 'TypeScript - all files belong to a TypeScript project',
cmd: NODE,
args: [
require.resolve('../../scripts/check_ts_projects')
'scripts/check_ts_projects'
]
},
}),

// used by the test and jenkins:unit tasks
// runs the i18n_check script to check i18n engine usage
i18nCheck: {
cmd: process.execPath,
i18nCheck: scriptWithGithubChecks({
title: 'Internationalization check',
cmd: NODE,
args: [
require.resolve('../../scripts/i18n_check'),
'scripts/i18n_check',
'--ignore-missing',
]
},
}),

// used by the test:server task
// runs all node.js/server mocha tests
mocha: {
cmd: process.execPath,
mocha: scriptWithGithubChecks({
title: 'Mocha tests',
cmd: NODE,
args: [
require.resolve('../../scripts/mocha')
'scripts/mocha'
]
},
}),

// used by the test:browser task
// runs the kibana server to serve the browser test bundle
Expand Down Expand Up @@ -175,29 +197,32 @@ module.exports = function (grunt) {
]
}),

verifyNotice: {
verifyNotice: scriptWithGithubChecks({
title: 'Verify NOTICE.txt',
options: {
wait: true,
},
cmd: process.execPath,
cmd: NODE,
args: [
'scripts/notice',
'--validate'
]
},
}),

apiIntegrationTests: {
cmd: process.execPath,
apiIntegrationTests: scriptWithGithubChecks({
title: 'API integration tests',
cmd: NODE,
args: [
'scripts/functional_tests',
'--config', 'test/api_integration/config.js',
'--bail',
'--debug',
],
},
}),

serverIntegrationTests: {
cmd: process.execPath,
serverIntegrationTests: scriptWithGithubChecks({
title: 'Server integration tests',
cmd: NODE,
args: [
'scripts/functional_tests',
'--config', 'test/server_integration/http/ssl/config.js',
Expand All @@ -206,39 +231,54 @@ module.exports = function (grunt) {
'--debug',
'--kibana-install-dir', KIBANA_INSTALL_DIR,
],
},
}),

interpreterFunctionalTestsRelease: {
cmd: process.execPath,
interpreterFunctionalTestsRelease: scriptWithGithubChecks({
title: 'Interpreter functional tests',
cmd: NODE,
args: [
'scripts/functional_tests',
'--config', 'test/interpreter_functional/config.js',
'--bail',
'--debug',
'--kibana-install-dir', KIBANA_INSTALL_DIR,
],
},
}),

pluginFunctionalTestsRelease: {
cmd: process.execPath,
pluginFunctionalTestsRelease: scriptWithGithubChecks({
title: 'Plugin functional tests',
cmd: NODE,
args: [
'scripts/functional_tests',
'--config', 'test/plugin_functional/config.js',
'--bail',
'--debug',
'--kibana-install-dir', KIBANA_INSTALL_DIR,
],
},
}),

functionalTests: {
cmd: process.execPath,
functionalTests: scriptWithGithubChecks({
title: 'Functional tests',
cmd: NODE,
args: [
'scripts/functional_tests',
'--config', 'test/functional/config.js',
'--bail',
'--debug',
],
},
}),

licenses: gruntTaskWithGithubChecks('Licenses', 'licenses'),
verifyDependencyVersions:
gruntTaskWithGithubChecks('Verify dependency versions', 'verifyDependencyVersions'),
test_server:
gruntTaskWithGithubChecks('Server tests', 'test:server'),
test_jest: gruntTaskWithGithubChecks('Jest tests', 'test:jest'),
test_jest_integration:
gruntTaskWithGithubChecks('Jest integration tests', 'test:jest_integration'),
test_projects: gruntTaskWithGithubChecks('Project tests', 'test:projects'),
test_browser_ci:
gruntTaskWithGithubChecks('Browser tests', 'test:browser-ci'),

...getFunctionalTestGroupRunConfigs({
kibanaInstallDir: KIBANA_INSTALL_DIR
Expand Down
14 changes: 7 additions & 7 deletions tasks/jenkins.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ module.exports = function (grunt) {
'run:typeCheck',
'run:i18nCheck',
'run:checkFileCasing',
'licenses',
'verifyDependencyVersions',
'run:licenses',
'run:verifyDependencyVersions',
'run:verifyNotice',
'test:server',
'test:jest',
'test:jest_integration',
'test:projects',
'test:browser-ci',
'run:test_server',
'run:test_jest',
'run:test_jest_integration',
'run:test_projects',
'run:test_browser_ci',
'run:apiIntegrationTests',
]);
};
8 changes: 4 additions & 4 deletions test/scripts/jenkins_ci_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ node scripts/build --debug --oss;

export TEST_BROWSER_HEADLESS=1

"$(FORCE_COLOR=0 yarn bin)/grunt" "run:functionalTests_ciGroup${CI_GROUP}";
checks-reporter-with-killswitch "Functional tests / Group ${CI_GROUP}" yarn run grunt "run:functionalTests_ciGroup${CI_GROUP}";

if [ "$CI_GROUP" == "1" ]; then
# build kbn_tp_sample_panel_action
cd test/plugin_functional/plugins/kbn_tp_sample_panel_action;
yarn build;
checks-reporter-with-killswitch "Build kbn_tp_sample_panel_action" yarn build;
cd -;
"$(FORCE_COLOR=0 yarn bin)/grunt" run:pluginFunctionalTestsRelease --from=source;
"$(FORCE_COLOR=0 yarn bin)/grunt" run:interpreterFunctionalTestsRelease;
yarn run grunt run:pluginFunctionalTestsRelease --from=source;
yarn run grunt run:interpreterFunctionalTestsRelease;
fi
4 changes: 2 additions & 2 deletions test/scripts/jenkins_xpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export TEST_BROWSER_HEADLESS=1

echo " -> Running mocha tests"
cd "$XPACK_DIR"
yarn test
checks-reporter-with-killswitch "X-Pack Mocha" yarn test
echo ""
echo ""

echo " -> Running jest tests"
cd "$XPACK_DIR"
node scripts/jest --ci --no-cache --verbose
checks-reporter-with-killswitch "X-Pack Jest" node scripts/jest --ci --no-cache --verbose
echo ""
echo ""

Expand Down
2 changes: 1 addition & 1 deletion test/scripts/jenkins_xpack_ci_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ tar -xzf "$linuxBuild" -C "$installDir" --strip=1

echo " -> Running functional and api tests"
cd "$XPACK_DIR"
node scripts/functional_tests --debug --bail --kibana-install-dir "$installDir" --include-tag "ciGroup$CI_GROUP"
checks-reporter-with-killswitch "X-Pack Functional tests / Group ${CI_GROUP}" node scripts/functional_tests --debug --bail --kibana-install-dir "$installDir" --include-tag "ciGroup$CI_GROUP"
echo ""
echo ""
Loading