diff --git a/.travis.yml b/.travis.yml index 739b701de..c1dd80614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,39 +14,46 @@ cache: - ".eslintcache" stages: - - basic - - advanced - - versions + - basic + - advanced + - versions matrix: include: - os: linux node_js: "10" - env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic + env: + NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic stage: basic - os: linux node_js: "10" - env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lint-unit + env: + NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lint-unit stage: advanced - os: linux node_js: "10" - env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + env: + NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration stage: advanced - os: linux node_js: "10" - env: NO_WATCH_TESTS=1 ALTERNATIVE_SORT=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + env: + NO_WATCH_TESTS=1 ALTERNATIVE_SORT=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration stage: versions - os: osx node_js: "10" - env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + env: + NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration stage: versions - os: linux node_js: "8" - env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + env: + NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration stage: versions - os: linux node_js: "6" - env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration + env: + NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration stage: versions fast_finish: true allow_failures: @@ -66,4 +73,5 @@ after_success: notifications: slack: - secure: JduSdKWwbnLCwo7Z4E59SGE+Uw832UwnXzQiKEpg1BV45MYDPRiGltly1tRHmPh9OGjvGx3XSkC2tNGOBLtL4UL2SCkf012x0t7jDutKRfcv/njynl8jk8l+UhPmaWiHXDQAgGiiKdL4RfzPLW3HeVHCOWm0LKMzcarTa8tw+rE= + secure: + JduSdKWwbnLCwo7Z4E59SGE+Uw832UwnXzQiKEpg1BV45MYDPRiGltly1tRHmPh9OGjvGx3XSkC2tNGOBLtL4UL2SCkf012x0t7jDutKRfcv/njynl8jk8l+UhPmaWiHXDQAgGiiKdL4RfzPLW3HeVHCOWm0LKMzcarTa8tw+rE= diff --git a/appveyor.yml b/appveyor.yml index 94ecae79a..c6a300e73 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,4 +32,5 @@ test_script: - cmd: yarn istanbul report --report lcovonly - cmd: yarn unlink webpack - cmd: yarn global add codecov && codecov -F %job_part% --disable=gcov - - cmd: del /F /Q .jest-cache\\haste-map* .jest-cache\\perf-cache* 2> null || Ver > null + - cmd: + del /F /Q .jest-cache\\haste-map* .jest-cache\\perf-cache* 2> null || Ver > null diff --git a/codecov.yml b/codecov.yml index 0ce74197d..75cab9bf7 100644 --- a/codecov.yml +++ b/codecov.yml @@ -18,8 +18,8 @@ coverage: target: 0% patch: default: off - integration: - flags: integration + basic: + flags: basic target: 90% base: pr integration: diff --git a/open-bot.yaml b/open-bot.yaml index 775f2aa98..765328ac9 100644 --- a/open-bot.yaml +++ b/open-bot.yaml @@ -1,656 +1,625 @@ bot: "webpack-bot" rules: - -# Add ci-ok, ci-not-ok labels depending on travis status -# comment to point the user to the results -# comment in case of success -- filters: - open: true - pull_request: - mergeable: true - status_1: - context: "continuous-integration/travis-ci/pr" - status_2: - context: "continuous-integration/appveyor/pr" - ensure_1: - value: "{{status_1.state}}" - equals: "success" - ensure_2: - value: "{{status_2.state}}" - equals: "success" - actions: - label: - add: "PR: CI-ok" - remove: "PR: CI-not-ok" - comment: - identifier: "ci-result" - message: |- - Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. -- filters: - open: true - pull_request: - mergeable: true - status_1: - context: "continuous-integration/travis-ci/pr" - status_2: - context: "continuous-integration/appveyor/pr" - any: + # Add ci-ok, ci-not-ok labels depending on travis status + # comment to point the user to the results + # comment in case of success + - filters: + open: true + pull_request: + mergeable: true + status_1: + context: "continuous-integration/travis-ci/pr" + status_2: + context: "continuous-integration/appveyor/pr" ensure_1: value: "{{status_1.state}}" - equals: "failure" + equals: "success" ensure_2: value: "{{status_2.state}}" - equals: "failure" - not: - any: - ensure_3: - value: "{{status_1.state}}" - equals: "pending" - ensure_4: - value: "{{status_2.state}}" - equals: "pending" - actions: - label: - add: "PR: CI-not-ok" - remove: "PR: CI-ok" - set: - id: report_ci - value: yep - - - -# Report specific error message if jest for basic tests fails -- filters: - ensure: - value: "{{report_ci}}" - equals: yep - commit: true - status: - context: "continuous-integration/travis-ci/pr" - travis_job: - state: "failed" - allow_failure: false - config: - env: JOB_PART=basic - fetch: travis_job.log - string_cleanup: - id: logResult - value: "{{{fetch}}}" - remove: - - ".\\[2K.\\[1G|.\\[999D.\\[K" - - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" - - "\\$ node --max-old-space-size=4096.*\n" - - ".+rimraf coverage" - - "yarn run.+\n" - - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" - - "\\$ yarn (cover|test):.+\n" - - "Ran all test suites.\n[\\s\\S]*" - - "error Command failed with exit code \\d+.\n" - - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" - - "Force exiting Jest\n\nHave you considered.+" - - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" - - " *PASS *test/.*\n" - - "^\\s+\n|\\s+$" - string_cleanup_1: - id: firstError - value: "{{{logResult}}}" - remove: - - "\n\n( ●| FAIL)[\\s\\S]*" - - "Test Suites:[\\s\\S]*" - - "\\s+$" - string_cleanup_2: - id: remainingErrors - value: "{{{logResult}}}" - remove: - - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)" - - "^\n+" - - "Test Suites:[\\s\\S]*" - - "\\s+$" - string_cleanup_3: - id: summary - value: "{{{logResult}}}" - remove: - - "^[\\s\\S]+?(?=Test Suites:)" - - "\\s+$" - actions: - comment: - identifier: "ci-result" - message: |- - The basic integration tests failed. - - @{{commit.author.login}} Please review the following output log for errors: - - ```text - {{{firstError}}} - ``` - {{#if remainingErrors}} -
- Show remaining errors - - ```text - {{{remainingErrors}}} - ``` -
- {{/if}} - - ```text - {{{summary}}} - ``` - - See [complete report here]({{status.target_url}}). - set: - id: report_ci - value: nope - - - -# Report specific error message if jest for integration tests fails -- filters: - ensure: - value: "{{report_ci}}" - equals: yep - commit: true - status: - context: "continuous-integration/travis-ci/pr" - travis_job: - state: "failed" - allow_failure: false - config: - env: JOB_PART=integration - fetch: travis_job.log - string_cleanup: - id: logResult - value: "{{{fetch}}}" - remove: - - ".\\[2K.\\[1G|.\\[999D.\\[K" - - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" - - "\\$ node --max-old-space-size=4096.*\n" - - ".+rimraf coverage" - - "yarn run.+\n" - - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" - - "\\$ yarn (cover|test):.+\n" - - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*" - - "Ran all test suites.+\n" - - "error Command failed with exit code \\d+.\n" - - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" - - "Force exiting Jest\n\nHave you considered.+" - - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" - - " *PASS *test/.*\n" - - "^\\s+\n|\\s+$" - string_cleanup_1: - id: firstError - value: "{{{logResult}}}" - remove: - - "\n\n( ●| FAIL)[\\s\\S]*" - - "Test Suites:[\\s\\S]*" - - "\\s+$" - string_cleanup_2: - id: remainingErrors - value: "{{{logResult}}}" - remove: - - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)" - - "^\n+" - - "Test Suites:[\\s\\S]*" - - "\\s+$" - string_cleanup_3: - id: summary - value: "{{{logResult}}}" - remove: - - "^[\\s\\S]+?(?=Test Suites:)" - - "\\s+$" - actions: - comment: - identifier: "ci-result" - message: |- - The basic integration tests succeeded, but the full suite failed. - - @{{commit.author.login}} Please review the following output log for errors: - - ```text - {{{firstError}}} - ``` - {{#if remainingErrors}} -
- Show remaining errors - - ```text - {{{remainingErrors}}} - ``` -
- {{/if}} - - ```text - {{{summary}}} - ``` - - See [complete report here]({{status.target_url}}). - set: - id: report_ci - value: nope - - - -# Report specific error message if jest for unit tests or liniting fails -- filters: - ensure: - value: "{{report_ci}}" - equals: yep - commit: true - status: - context: "continuous-integration/travis-ci/pr" - travis_job: - state: "failed" - allow_failure: false - config: - env: JOB_PART=lint-unit - fetch: travis_job.log - string_cleanup: - id: logResult - value: "{{{fetch}}}" - remove: - - ".\\[2K.\\[1G|.\\[999D.\\[K" - - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" - - "\\$ node --max-old-space-size=4096.*\n" - - ".+rimraf coverage" - - "yarn run.+\n" - - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" - - "\\$ yarn (unit|lint).+\n" - - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*" - - "Ran all test suites.+\n" - - "error Command failed with exit code \\d+.\n" - - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" - - "Force exiting Jest\n\nHave you considered.+" - - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" - - " *PASS *test/.*\n" - - "^\\s+\n|\\s+$" - actions: - comment: - identifier: "ci-result" - message: |- - The integration tests look fine, but there are code style issues or unit test failures in the Pull Request. - - @{{commit.author.login}} Please review the following output log for errors: - - ``` text - {{{logResult}}} - ``` - - If the unit tests are outdated, you can choose to delete them and add integration tests instead. That would be great. - - See [complete report here]({{status.target_url}}). - set: - id: report_ci - value: nope - - - - -# Report a general error message -- filters: - ensure: - value: "{{report_ci}}" - equals: yep - commit: true - status_1: - context: "continuous-integration/travis-ci/pr" - status_2: - context: "continuous-integration/appveyor/pr" - actions: - comment: - identifier: "ci-result" - message: |- - @{{commit.author.login}} The most important CI builds failed. This way your PR can't be merged. - - Please take a look at the CI results from [travis]({{status_1.target_url}}) ({{status_1.state}}) and [appveyor]({{status_2.target_url}}) ({{status_2.state}}) and fix these issues. - - - - -# Add tests-needed label depending on codecov status -# comment to point the user writing test cases -# comment in case of success -- filters: - open: true - pull_request: - mergeable: true - status: - context: "codecov/patch/integration" - ensure: - value: "{{status.state}}" - equals: "success" - label: "PR: tests-needed" - actions: - label: - remove: "PR: tests-needed" - comment: - identifier: "tests-result" - message: |- - The minimum test ratio has been reached. Thanks! -- filters: - open: true - pull_request: - mergeable: true - status: - context: "codecov/patch/integration" - ensure: - value: "{{status.state}}" - equals: "failure" - actions: - label: - add: "PR: tests-needed" -- filters: - open: true - pull_request: - mergeable: true - status: - context: "codecov/patch/integration" - ensure: - value: "{{status.state}}" - equals: "failure" - age: - value: "{{status.created_at}}" - minimum: 1h - permission: "read|none" - actions: - comment: - identifier: "tests-result" - message: |- - It looks like this Pull Request doesn't include [enough test cases]({{status.target_url}}) (based on Code Coverage analysis of the PR diff). - - A PR need to be covered by tests if you add a new feature (we want to make sure that your feature is working) or if you fix a bug (we want to make sure that we don't run into a regression in future). - - @{{issue.user.login}} Please check if this is appliable to your PR and if you can add more test cases. - - Read the [test readme](https://github.com/webpack/webpack/blob/master/test/README.md) for details how to write test cases. - - - -# add conflict label to pull requests with conflict -# on conflict all result labels are removed -- filters: - open: true - pull_request: - mergeable: false - actions: - label: - add: "PR: conflict" - remove: - - "PR: tests-needed" - - "PR: CI-ok" - - "PR: CI-not-ok" -- filters: - open: true - pull_request: - mergeable: true - actions: - label: - remove: "PR: conflict" - - - -# add unreviewed, reviewed, review-outdated labels -# comment to ping reviewer -# comment on new PR -- filters: - open: true - in_order: - commit: true - review: - state: APPROVED|CHANGES_REQUESTED - ensure: - value: "{{review.state}}" - equals: APPROVED - permission: - user: "{{review.user.login}}" - actions: - label: - add: "PR: reviewed-approved" - remove: - - "PR: review-outdated" - - "PR: unreviewed" - - "PR: reviewed" -- filters: - open: true - in_order: - commit: true - review: - state: APPROVED|CHANGES_REQUESTED - permission: - user: "{{review.user.login}}" - ensure: - value: "{{review.state}}" - equals: CHANGES_REQUESTED - actions: - label: - add: "PR: reviewed-changes-requested" - remove: - - "PR: review-outdated" - - "PR: unreviewed" - - "PR: reviewed" -- filters: - open: true - in_order: - review: - state: APPROVED|CHANGES_REQUESTED - commit: true - permission: - user: "{{review.user.login}}" - not: - label: "review-outdated" - ensure: - value: "{{commit.author.login}}" - notEquals: "{{review.user.login}}" - actions: - label: - add: "PR: review-outdated" - remove: - - "PR: reviewed-approved" - - "PR: reviewed-changes-requested" - - "PR: unreviewed" - - "PR: reviewed" - comment: - identifier: "review-outdated" - message: |- - @{{commit.author.login}} Thanks for your update. - - I labeled the Pull Request so reviewers will review it again. - - @{{review.user.login}} Please review the new changes. -- filters: - open: true - commit: true - not: - review: - state: APPROVED|CHANGES_REQUESTED - actions: - label: "PR: unreviewed" - - - -# add non-master and next label to pull request to other branch -- filters: - pull_request: - base_ref: "^master$" - actions: - label: - remove: "PR: non-master" -- filters: - pull_request: - base_ref: "^next$" - actions: - label: - add: "PR: next" - remove: "PR: non-master" -- filters: - pull_request: - base_ref: "^(?!master$)(?!next$)" - actions: - label: - add: "PR: non-master" - remove: "PR: next" - - - -# add non-master label to pull request to other branch -- filters: - open: true - age: - minimum: 1d - maximum: 1w - pull_request: - head_ref: "^master$" - permission: "read|none" - actions: - comment: - identifier: "head-master" - edit: true - message: |- - Hi @{{pull_request.user.login}}. - - Just a little hint from a friendly bot about the best practice when submitting pull requests: - - > Don't submit pull request from your own `master` branch. It's recommended to create a feature branch for the PR. - - *You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.* - - - -# add "Send a PR" label when somebody with write permission say it -- filters: - open: true - comment: "[Ss]end a [Pp][Rr]" - permission: - user: "{{comment.actor.login}}" - actions: - label: "Send a PR" - - - -# Move issue task -- filters: - open: true - comment: "\\s*@webpack-bot\\s+move\\s+(?:to\\s+)?([a-z0-9_\\-\\.]+/[a-z0-9_\\-\\.]+)\\s*([\\s\\S]*)$" - not: - comment_1: - matching: "moved\\-by\\-bot" - author: "." - permission: - user: "{{comment.actor.login}}" - actions: - new_issue: - target: "{{{comment_match.[1]}}}" - body: |- - {{{issue.body}}} - - --- - - This issue was moved from {{owner}}/{{repo}}#{{issue.number}} by @{{comment.actor.login}}. Original issue was by @{{issue.user.login}}. - - {{{comment_match.[2]}}} - comment: - identifier: moved-by-bot - message: |- - I've moved it to {{comment_match.[1]}}. - close: true - - - -# mark inactive issues with inactive label -# close them when no activity after warning -- filters: - issue: true - open: true - not: - label: inactive - ensure: - value: "{{issue.reactions.[+1]}}" - range: "< 10" - last_action_age: 26w # half a year - actions: - comment: - identifer: inactive-warning - message: |- - **This issue had no activity for at least half a year.** - - It's subject to automatic issue closing if there is no activity in the next 15 days. - label: inactive -- filters: - open: true - label: inactive - last_action_age: - maximum: 26w # half a year - actions: - label: - remove: - - inactive -- filters: - open: true - label: inactive - last_action_age: - minimum: 15d - includeBotActions: true - actions: - close: true - comment: - identifer: inactive-close - message: |- - Issue was closed because of inactivity. - - If you think this is still a valid issue, please file a new issue with additional information. - - -# Add action actions box to each pull request -- filters: - pull_request: true - open: true - not: + equals: "success" + actions: + label: + add: "PR: CI-ok" + remove: "PR: CI-not-ok" + comment: + identifier: "ci-result" + message: |- + Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. + - filters: + open: true + pull_request: + mergeable: true + status_1: + context: "continuous-integration/travis-ci/pr" + status_2: + context: "continuous-integration/appveyor/pr" + any: + ensure_1: + value: "{{status_1.state}}" + equals: "failure" + ensure_2: + value: "{{status_2.state}}" + equals: "failure" + not: + any: + ensure_3: + value: "{{status_1.state}}" + equals: "pending" + ensure_4: + value: "{{status_2.state}}" + equals: "pending" + actions: + label: + add: "PR: CI-not-ok" + remove: "PR: CI-ok" + set: + id: report_ci + value: yep + + # Report specific error message if jest for basic tests fails + - filters: + ensure: + value: "{{report_ci}}" + equals: yep + commit: true + status: + context: "continuous-integration/travis-ci/pr" + travis_job: + state: "failed" + allow_failure: false + config: + env: JOB_PART=basic + fetch: travis_job.log + string_cleanup: + id: logResult + value: "{{{fetch}}}" + remove: + - ".\\[2K.\\[1G|.\\[999D.\\[K" + - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" + - "\\$ node --max-old-space-size=4096.*\n" + - ".+rimraf coverage" + - "yarn run.+\n" + - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" + - "\\$ yarn (cover|test):.+\n" + - "Ran all test suites.\n[\\s\\S]*" + - "error Command failed with exit code \\d+.\n" + - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" + - "Force exiting Jest\n\nHave you considered.+" + - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" + - " *PASS *test/.*\n" + - "^\\s+\n|\\s+$" + string_cleanup_1: + id: firstError + value: "{{{logResult}}}" + remove: + - "\n\n( ●| FAIL)[\\s\\S]*" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_2: + id: remainingErrors + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)" + - "^\n+" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_3: + id: summary + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=Test Suites:)" + - "\\s+$" + actions: + comment: + identifier: "ci-result" + message: |- + The basic integration tests failed. + + @{{commit.author.login}} Please review the following output log for errors: + + ```text + {{{firstError}}} + ``` + {{#if remainingErrors}} +
+ Show remaining errors + + ```text + {{{remainingErrors}}} + ``` +
+ {{/if}} + + ```text + {{{summary}}} + ``` + + See [complete report here]({{status.target_url}}). + set: + id: report_ci + value: nope + + # Report specific error message if jest for integration tests fails + - filters: + ensure: + value: "{{report_ci}}" + equals: yep + commit: true + status: + context: "continuous-integration/travis-ci/pr" + travis_job: + state: "failed" + allow_failure: false + config: + env: JOB_PART=integration + fetch: travis_job.log + string_cleanup: + id: logResult + value: "{{{fetch}}}" + remove: + - ".\\[2K.\\[1G|.\\[999D.\\[K" + - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" + - "\\$ node --max-old-space-size=4096.*\n" + - ".+rimraf coverage" + - "yarn run.+\n" + - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" + - "\\$ yarn (cover|test):.+\n" + - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*" + - "Ran all test suites.+\n" + - "error Command failed with exit code \\d+.\n" + - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" + - "Force exiting Jest\n\nHave you considered.+" + - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" + - " *PASS *test/.*\n" + - "^\\s+\n|\\s+$" + string_cleanup_1: + id: firstError + value: "{{{logResult}}}" + remove: + - "\n\n( ●| FAIL)[\\s\\S]*" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_2: + id: remainingErrors + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)" + - "^\n+" + - "Test Suites:[\\s\\S]*" + - "\\s+$" + string_cleanup_3: + id: summary + value: "{{{logResult}}}" + remove: + - "^[\\s\\S]+?(?=Test Suites:)" + - "\\s+$" + actions: + comment: + identifier: "ci-result" + message: |- + The basic integration tests succeeded, but the full suite failed. + + @{{commit.author.login}} Please review the following output log for errors: + + ```text + {{{firstError}}} + ``` + {{#if remainingErrors}} +
+ Show remaining errors + + ```text + {{{remainingErrors}}} + ``` +
+ {{/if}} + + ```text + {{{summary}}} + ``` + + See [complete report here]({{status.target_url}}). + set: + id: report_ci + value: nope + + # Report specific error message if jest for unit tests or liniting fails + - filters: + ensure: + value: "{{report_ci}}" + equals: yep + commit: true + status: + context: "continuous-integration/travis-ci/pr" + travis_job: + state: "failed" + allow_failure: false + config: + env: JOB_PART=lint-unit + fetch: travis_job.log + string_cleanup: + id: logResult + value: "{{{fetch}}}" + remove: + - ".\\[2K.\\[1G|.\\[999D.\\[K" + - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n" + - "\\$ node --max-old-space-size=4096.*\n" + - ".+rimraf coverage" + - "yarn run.+\n" + - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n" + - "\\$ yarn (unit|lint).+\n" + - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*" + - "Ran all test suites.+\n" + - "error Command failed with exit code \\d+.\n" + - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n" + - "Force exiting Jest\n\nHave you considered.+" + - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================" + - " *PASS *test/.*\n" + - "^\\s+\n|\\s+$" + actions: + comment: + identifier: "ci-result" + message: |- + The integration tests look fine, but there are code style issues or unit test failures in the Pull Request. + + @{{commit.author.login}} Please review the following output log for errors: + + ``` text + {{{logResult}}} + ``` + + If the unit tests are outdated, you can choose to delete them and add integration tests instead. That would be great. + + See [complete report here]({{status.target_url}}). + set: + id: report_ci + value: nope + + # Report a general error message + - filters: + ensure: + value: "{{report_ci}}" + equals: yep + commit: true + status_1: + context: "continuous-integration/travis-ci/pr" + status_2: + context: "continuous-integration/appveyor/pr" + actions: + comment: + identifier: "ci-result" + message: |- + @{{commit.author.login}} The most important CI builds failed. This way your PR can't be merged. + + Please take a look at the CI results from [travis]({{status_1.target_url}}) ({{status_1.state}}) and [appveyor]({{status_2.target_url}}) ({{status_2.state}}) and fix these issues. + + # Add tests-needed label depending on codecov status + # comment to point the user writing test cases + # comment in case of success + - filters: + open: true + pull_request: + mergeable: true + status: + context: "codecov/patch/integration" + ensure: + value: "{{status.state}}" + equals: "success" + label: "PR: tests-needed" + actions: + label: + remove: "PR: tests-needed" + comment: + identifier: "tests-result" + message: |- + The minimum test ratio has been reached. Thanks! + - filters: + open: true + pull_request: + mergeable: true + status: + context: "codecov/patch/integration" + ensure: + value: "{{status.state}}" + equals: "failure" + actions: + label: + add: "PR: tests-needed" + - filters: + open: true + pull_request: + mergeable: true + status: + context: "codecov/patch/integration" + ensure: + value: "{{status.state}}" + equals: "failure" + age: + value: "{{status.created_at}}" + minimum: 1h + permission: "read|none" + actions: + comment: + identifier: "tests-result" + message: |- + It looks like this Pull Request doesn't include [enough test cases]({{status.target_url}}) (based on Code Coverage analysis of the PR diff). + + A PR need to be covered by tests if you add a new feature (we want to make sure that your feature is working) or if you fix a bug (we want to make sure that we don't run into a regression in future). + + @{{issue.user.login}} Please check if this is appliable to your PR and if you can add more test cases. + + Read the [test readme](https://github.com/webpack/webpack/blob/master/test/README.md) for details how to write test cases. + + # add conflict label to pull requests with conflict + # on conflict all result labels are removed + - filters: + open: true + pull_request: + mergeable: false + actions: + label: + add: "PR: conflict" + remove: + - "PR: tests-needed" + - "PR: CI-ok" + - "PR: CI-not-ok" + - filters: + open: true + pull_request: + mergeable: true + actions: + label: + remove: "PR: conflict" + + # add unreviewed, reviewed, review-outdated labels + # comment to ping reviewer + # comment on new PR + - filters: + open: true + in_order: + commit: true + review: + state: APPROVED|CHANGES_REQUESTED + ensure: + value: "{{review.state}}" + equals: APPROVED + permission: + user: "{{review.user.login}}" + actions: + label: + add: "PR: reviewed-approved" + remove: + - "PR: review-outdated" + - "PR: unreviewed" + - "PR: reviewed" + - filters: + open: true + in_order: + commit: true + review: + state: APPROVED|CHANGES_REQUESTED + permission: + user: "{{review.user.login}}" + ensure: + value: "{{review.state}}" + equals: CHANGES_REQUESTED + actions: + label: + add: "PR: reviewed-changes-requested" + remove: + - "PR: review-outdated" + - "PR: unreviewed" + - "PR: reviewed" + - filters: + open: true + in_order: + review: + state: APPROVED|CHANGES_REQUESTED + commit: true + permission: + user: "{{review.user.login}}" + not: + label: "review-outdated" + ensure: + value: "{{commit.author.login}}" + notEquals: "{{review.user.login}}" + actions: + label: + add: "PR: review-outdated" + remove: + - "PR: reviewed-approved" + - "PR: reviewed-changes-requested" + - "PR: unreviewed" + - "PR: reviewed" + comment: + identifier: "review-outdated" + message: |- + @{{commit.author.login}} Thanks for your update. + + I labeled the Pull Request so reviewers will review it again. + + @{{review.user.login}} Please review the new changes. + - filters: + open: true + commit: true + not: + review: + state: APPROVED|CHANGES_REQUESTED + actions: + label: "PR: unreviewed" + + # add non-master and next label to pull request to other branch + - filters: + pull_request: + base_ref: "^master$" + actions: + label: + remove: "PR: non-master" + - filters: + pull_request: + base_ref: "^next$" + actions: + label: + add: "PR: next" + remove: "PR: non-master" + - filters: + pull_request: + base_ref: "^(?!master$)(?!next$)" + actions: + label: + add: "PR: non-master" + remove: "PR: next" + + # add non-master label to pull request to other branch + - filters: + open: true + age: + minimum: 1d + maximum: 1w + pull_request: + head_ref: "^master$" + permission: "read|none" + actions: + comment: + identifier: "head-master" + edit: true + message: |- + Hi @{{pull_request.user.login}}. + + Just a little hint from a friendly bot about the best practice when submitting pull requests: + + > Don't submit pull request from your own `master` branch. It's recommended to create a feature branch for the PR. + + *You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.* + + # add "Send a PR" label when somebody with write permission say it + - filters: + open: true + comment: "[Ss]end a [Pp][Rr]" + permission: + user: "{{comment.actor.login}}" + actions: + label: "Send a PR" + + # Move issue task + - filters: + open: true + comment: + "\\s*@webpack-bot\\s+move\\s+(?:to\\s+)?([a-z0-9_\\-\\.]+/[a-z0-9_\\-\\.]+)\\s*([\\s\\S]*)$" + not: + comment_1: + matching: "moved\\-by\\-bot" + author: "." + permission: + user: "{{comment.actor.login}}" + actions: + new_issue: + target: "{{{comment_match.[1]}}}" + body: |- + {{{issue.body}}} + + --- + + This issue was moved from {{owner}}/{{repo}}#{{issue.number}} by @{{comment.actor.login}}. Original issue was by @{{issue.user.login}}. + + {{{comment_match.[2]}}} + comment: + identifier: moved-by-bot + message: |- + I've moved it to {{comment_match.[1]}}. + close: true + + # mark inactive issues with inactive label + # close them when no activity after warning + - filters: + issue: true + open: true + not: + label: inactive + ensure: + value: "{{issue.reactions.[+1]}}" + range: "< 10" + last_action_age: 26w # half a year + actions: + comment: + identifer: inactive-warning + message: |- + **This issue had no activity for at least half a year.** + + It's subject to automatic issue closing if there is no activity in the next 15 days. + label: inactive + - filters: + open: true + label: inactive + last_action_age: + maximum: 26w # half a year + actions: + label: + remove: + - inactive + - filters: + open: true + label: inactive + last_action_age: + minimum: 15d + includeBotActions: true + actions: + close: true + comment: + identifer: inactive-close + message: |- + Issue was closed because of inactivity. + + If you think this is still a valid issue, please file a new issue with additional information. + + # Add action actions box to each pull request + - filters: + pull_request: true + open: true + not: + comment: + matching: admin-actions + author: webpack-bot + actions: + comment: + identifier: admin-actions + message: |- + *For maintainers only:* + + * [ ] This need to be documented (issue in webpack/webpack.js.org will be filed when merged) + + # When a pull request need to be documented, create an issue in webpack/webpack.js.org when merged + - filters: + pull_request: + merged: true comment: - matching: admin-actions author: webpack-bot - actions: - comment: - identifier: admin-actions - message: |- - *For maintainers only:* + matching: "\\* \\[x\\] " + not: + comment_1: + author: webpack-bot + matching: admin-action-document-executed + actions: + new_issue: + target: webpack/webpack.js.org + title: "Document webpack change: {{{pull_request.title}}}" + body: |- + - * [ ] This need to be documented (issue in webpack/webpack.js.org will be filed when merged) + *A pull request by @{{pull_request.user.login}} was merged and maintainers requested a documentation change.* + See pull request: {{{pull_request.html_url}}} -# When a pull request need to be documented, create an issue in webpack/webpack.js.org when merged -- filters: - pull_request: - merged: true - comment: - author: webpack-bot - matching: "\\* \\[x\\] " - not: - comment_1: - author: webpack-bot - matching: admin-action-document-executed - actions: - new_issue: - target: webpack/webpack.js.org - title: "Document webpack change: {{{pull_request.title}}}" - body: |- - + --- - *A pull request by @{{pull_request.user.login}} was merged and maintainers requested a documentation change.* + {{{pull_request.body}}} + comment: + identifier: admin-action-document-executed + message: |- + I've created an issue to document this in webpack/webpack.js.org. - See pull request: {{{pull_request.html_url}}} - - --- - - {{{pull_request.body}}} - comment: - identifier: admin-action-document-executed - message: |- - I've created an issue to document this in webpack/webpack.js.org. - - - - -# Check open issues and pull requests every day -- filters: - open: true - actions: - schedule: 1d + # Check open issues and pull requests every day + - filters: + open: true + actions: + schedule: 1d diff --git a/package.json b/package.json index 6234a25c9..a2bd78178 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "special-lint": "node tooling/inherit-types && node tooling/format-schemas && node tooling/compile-to-definitions", "special-lint-fix": "node tooling/inherit-types --write --override && node tooling/format-schemas --write && node tooling/compile-to-definitions --write", "fix": "yarn code-lint --fix && yarn special-lint-fix", - "pretty": "prettier --loglevel warn --write \"*.{ts,js,json}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"", + "pretty": "prettier --loglevel warn --write \"*.{ts,js,json,yml,yaml}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"", "schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"/test/*.lint.js\" --no-verbose", "benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.benchmark.js\" --runInBand", "cover": "yarn cover:init && yarn cover:all && yarn cover:report",