ci: Print eslint results to stdout as well
The eslint jobs report their results as artifacts in junit format, so that gitlab can present them in its UI. However many people miss that, and unsuccessfully check the logs instead. Account for that by also printing the results to stdout. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2829>
This commit is contained in:
parent
d52b1576ac
commit
3a086c43ae
@ -142,7 +142,7 @@ eslint:
|
|||||||
stage: review
|
stage: review
|
||||||
script:
|
script:
|
||||||
- export NODE_PATH=$(npm root -g)
|
- export NODE_PATH=$(npm root -g)
|
||||||
- ./.gitlab-ci/run-eslint --output-file ${LINT_LOG} --format junit
|
- ./.gitlab-ci/run-eslint --output-file ${LINT_LOG} --format junit --stdout
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
junit: ${LINT_LOG}
|
junit: ${LINT_LOG}
|
||||||
@ -155,7 +155,7 @@ eslint_mr:
|
|||||||
stage: review
|
stage: review
|
||||||
script:
|
script:
|
||||||
- export NODE_PATH=$(npm root -g)
|
- export NODE_PATH=$(npm root -g)
|
||||||
- ./.gitlab-ci/run-eslint --output-file ${LINT_MR_LOG} --format junit
|
- ./.gitlab-ci/run-eslint --output-file ${LINT_MR_LOG} --format junit --stdout
|
||||||
--remote ${CI_MERGE_REQUEST_PROJECT_URL}.git
|
--remote ${CI_MERGE_REQUEST_PROJECT_URL}.git
|
||||||
--branch ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
|
--branch ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
|
||||||
only:
|
only:
|
||||||
|
@ -81,6 +81,10 @@ async function getMergeRequestChanges(remote, branch) {
|
|||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasOption(...names) {
|
||||||
|
return process.argv.some(arg => names.includes(arg));
|
||||||
|
}
|
||||||
|
|
||||||
function getOption(...names) {
|
function getOption(...names) {
|
||||||
const optIndex =
|
const optIndex =
|
||||||
process.argv.findIndex(arg => names.includes(arg)) + 1;
|
process.argv.findIndex(arg => names.includes(arg)) + 1;
|
||||||
@ -120,6 +124,11 @@ function getOption(...names) {
|
|||||||
if (outputPath) {
|
if (outputPath) {
|
||||||
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
||||||
fs.writeFileSync(outputPath, resultText);
|
fs.writeFileSync(outputPath, resultText);
|
||||||
|
|
||||||
|
if (hasOption('--stdout')) {
|
||||||
|
const consoleFormatter = await regular.loadFormatter();
|
||||||
|
console.log(consoleFormatter.format(commonResults));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(resultText);
|
console.log(resultText);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user