From 2f8ef89a8bf362b9ff61cdb34b6000a939dafe98 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Mon, 20 Jan 2020 16:03:26 +0100 Subject: [PATCH 01/30] Add integration test GitHub action --- .github/workflows/integration.yml | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 000000000000..fc05ee9b9210 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,69 @@ +name: Integration + +on: + push: + branches: + - auto + - try + # Don't run integration tests, when only textfiles were modified + paths-ignore: + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + +env: + RUST_BACKTRACE: 1 + +jobs: + integration: + strategy: + fail-fast: false + matrix: + integration: + - 'rust-lang/rls' + - 'rust-lang/cargo' + - 'rust-lang/chalk' + - 'Geal/nom' + - 'rust-lang/rustfmt' + - 'hyperium/hyper' + - 'rust-itertools/itertools' + - 'serde-rs/serde' + - 'rust-lang/stdarch' + - 'rust-random/rand' + - 'rust-lang/futures-rs' + - 'Marwes/combine' + - 'rust-lang-nursery/failure' + - 'rust-lang/log' + - 'chronotope/chrono' + runs-on: ubuntu-latest + + steps: + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.3 + with: + toolchain: nightly + target: x86_64-unknown-linux-gnu + profile: minimal + - name: Cache cargo dir + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Master Toolchain Setup + run: bash setup-toolchain.sh + + - name: Build + run: cargo build --features integration + - name: Test ${{ matrix.integration }} + run: cargo test --test integration --features integration + env: + INTEGRATION: ${{ matrix.integration }} + + - name: Run cargo-cache --autoclean + run: | + cargo install cargo-cache --debug + find ~/.cargo/bin ! -type d -exec strip {} \; + cargo cache --autoclean From 1158c18ae74a2754329ad9192312c10b80293981 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 13:46:53 +0100 Subject: [PATCH 02/30] Add clippy_dev checks to GitHub Actions --- .github/workflows/clippy_dev.yml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/clippy_dev.yml diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml new file mode 100644 index 000000000000..d054b6ba750c --- /dev/null +++ b/.github/workflows/clippy_dev.yml @@ -0,0 +1,44 @@ +name: Clippy Dev Test + +on: + # Only run on paths, that get checked by the clippy_dev tool + push: + paths: + - 'CAHNGELOG.md' + - 'README.md' + - '**.stderr' + - '**.rs' + pull_request: + paths: + - 'CAHNGELOG.md' + - 'README.md' + - '**.stderr' + - '**.rs' + +env: + RUST_BACKTRACE: 1 + +jobs: + clippy_dev: + runs-on: ubuntu-latest + + steps: + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.3 + with: + toolchain: nightly + target: x86_64-unknown-linux-gnu + profile: minimal + components: rustfmt + - name: Checkout + uses: actions/checkout@v2.0.0 + + - name: Build + run: cargo build --features deny-warnings + working-directory: clippy_dev + - name: Test limit-stderr-length + run: cargo dev --limit-stderr-length + - name: Test update_lints + run: cargo dev update_lints --check + - name: Test fmt + run: cargo dev fmt --check From 20c3319961e77e8dfcbf102a0616de500bd0cac1 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 15:29:54 +0100 Subject: [PATCH 03/30] Add remark check to GHA --- .github/workflows/remark.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/remark.yml diff --git a/.github/workflows/remark.yml b/.github/workflows/remark.yml new file mode 100644 index 000000000000..8e311c75df08 --- /dev/null +++ b/.github/workflows/remark.yml @@ -0,0 +1,24 @@ +name: Remark + +on: + push: + paths: + - '**.md' + pull_request: + paths: + - '**.md' + +jobs: + remark: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Setup Node.js + uses: actions/setup-node@v1.1.0 + - name: Install remark + run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended + + - name: Check *.md files + run: git ls-files -z '*.md' | xargs -0 -n 1 -I {} ./node_modules/.bin/remark {} -u lint -f > /dev/null From 2a7a3aa94647c14fd1e046b3dc183784de42af98 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 16:32:25 +0100 Subject: [PATCH 04/30] Rename .remarkrc.json -> .remarkrc and fix file --- .remarkrc | 12 ++++++++++++ .remarkrc.json | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 .remarkrc delete mode 100644 .remarkrc.json diff --git a/.remarkrc b/.remarkrc new file mode 100644 index 000000000000..0ede7ac75cb6 --- /dev/null +++ b/.remarkrc @@ -0,0 +1,12 @@ +{ + "plugins": [ + "remark-preset-lint-recommended", + ["remark-lint-list-item-indent", false], + ["remark-lint-no-literal-urls", false], + ["remark-lint-no-shortcut-reference-link", false], + ["remark-lint-maximum-line-length", 120] + ], + "settings": { + "commonmark": true + } +} diff --git a/.remarkrc.json b/.remarkrc.json deleted file mode 100644 index 22bae13ccf88..000000000000 --- a/.remarkrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "plugins": { - "lint": { - "table-pipes": false, - "table-pipe-alignment": false, - "maximum-line-length": 120 - } - }, - "settings": { - "commonmark": true - } -} From 757bbf7feb2e9ed1e4d8cc547390608654e8191e Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 16:39:58 +0100 Subject: [PATCH 05/30] Fix markdown Files Rendered: [CHANGELOG.md](https://github.com/flip1995/rust-clippy/blob/gha/CHANGELOG.md) [CODE_OF_CONDUCT.md](https://github.com/flip1995/rust-clippy/blob/gha/CODE_OF_CONDUCT.md) [CONTRIBUTING.md](https://github.com/flip1995/rust-clippy/blob/gha/CONTRIBUTING.md) [README.md](https://github.com/flip1995/rust-clippy/blob/gha/README.md) [clippy_dummy/PUBLISH.md](https://github.com/flip1995/rust-clippy/blob/gha/clippy_dummy/PUBLISH.md) [doc/adding_lints.md](https://github.com/flip1995/rust-clippy/blob/gha/doc/adding_lints.md) [etc/relicense/RELICENSE_DOCUMENTATION.md](https://github.com/flip1995/rust-clippy/blob/gha/etc/relicense/RELICENSE_DOCUMENTATION.md) --- CHANGELOG.md | 105 ++++++++++++----------- CODE_OF_CONDUCT.md | 60 +++++++++---- CONTRIBUTING.md | 64 ++++++++------ README.md | 16 ++-- clippy_dummy/PUBLISH.md | 8 +- doc/adding_lints.md | 11 ++- etc/relicense/RELICENSE_DOCUMENTATION.md | 75 +++++++++++----- 7 files changed, 213 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3658df88d40d..2f527a407db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -203,29 +203,29 @@ Released 2019-07-04 [eb9f9b1...082cfa7](https://github.com/rust-lang/rust-clippy/compare/eb9f9b1...082cfa7) - * New lints: [`find_map`], [`filter_map_next`] [#4039](https://github.com/rust-lang/rust-clippy/pull/4039) - * New lint: [`path_buf_push_overwrite`] [#3954](https://github.com/rust-lang/rust-clippy/pull/3954) - * Move `path_buf_push_overwrite` to the nursery [#4013](https://github.com/rust-lang/rust-clippy/pull/4013) - * Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101) - * Allow allowing of [`toplevel_ref_arg`] lint [#4007](https://github.com/rust-lang/rust-clippy/pull/4007) - * Fix false negative in [`or_fun_call`] pertaining to nested constructors [#4084](https://github.com/rust-lang/rust-clippy/pull/4084) - * Fix false positive in [`or_fn_call`] pertaining to enum variant constructors [#4018](https://github.com/rust-lang/rust-clippy/pull/4018) - * Fix false positive in [`useless_let_if_seq`] pertaining to interior mutability [#4035](https://github.com/rust-lang/rust-clippy/pull/4035) - * Fix false positive in [`redundant_closure`] pertaining to non-function types [#4008](https://github.com/rust-lang/rust-clippy/pull/4008) - * Fix false positive in [`let_and_return`] pertaining to attributes on `let`s [#4024](https://github.com/rust-lang/rust-clippy/pull/4024) - * Fix false positive in [`module_name_repetitions`] lint pertaining to attributes [#4006](https://github.com/rust-lang/rust-clippy/pull/4006) - * Fix false positive on [`assertions_on_constants`] pertaining to `debug_assert!` [#3989](https://github.com/rust-lang/rust-clippy/pull/3989) - * Improve suggestion in [`map_clone`] to suggest `.copied()` where applicable [#3970](https://github.com/rust-lang/rust-clippy/pull/3970) [#4043](https://github.com/rust-lang/rust-clippy/pull/4043) - * Improve suggestion for [`search_is_some`] [#4049](https://github.com/rust-lang/rust-clippy/pull/4049) - * Improve suggestion applicability for [`naive_bytecount`] [#3984](https://github.com/rust-lang/rust-clippy/pull/3984) - * Improve suggestion applicability for [`while_let_loop`] [#3975](https://github.com/rust-lang/rust-clippy/pull/3975) - * Improve diagnostics for [`too_many_arguments`] [#4053](https://github.com/rust-lang/rust-clippy/pull/4053) - * Improve diagnostics for [`cast_lossless`] [#4021](https://github.com/rust-lang/rust-clippy/pull/4021) - * Deal with macro checks in desugarings better [#4082](https://github.com/rust-lang/rust-clippy/pull/4082) - * Add macro check for [`unnecessary_cast`] [#4026](https://github.com/rust-lang/rust-clippy/pull/4026) - * Remove [`approx_constant`]'s documentation's "Known problems" section. [#4027](https://github.com/rust-lang/rust-clippy/pull/4027) - * Fix ICE in [`suspicious_else_formatting`] [#3960](https://github.com/rust-lang/rust-clippy/pull/3960) - * Fix ICE in [`decimal_literal_representation`] [#3931](https://github.com/rust-lang/rust-clippy/pull/3931) +* New lints: [`find_map`], [`filter_map_next`] [#4039](https://github.com/rust-lang/rust-clippy/pull/4039) +* New lint: [`path_buf_push_overwrite`] [#3954](https://github.com/rust-lang/rust-clippy/pull/3954) +* Move `path_buf_push_overwrite` to the nursery [#4013](https://github.com/rust-lang/rust-clippy/pull/4013) +* Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101) +* Allow allowing of [`toplevel_ref_arg`] lint [#4007](https://github.com/rust-lang/rust-clippy/pull/4007) +* Fix false negative in [`or_fun_call`] pertaining to nested constructors [#4084](https://github.com/rust-lang/rust-clippy/pull/4084) +* Fix false positive in [`or_fun_call`] pertaining to enum variant constructors [#4018](https://github.com/rust-lang/rust-clippy/pull/4018) +* Fix false positive in [`useless_let_if_seq`] pertaining to interior mutability [#4035](https://github.com/rust-lang/rust-clippy/pull/4035) +* Fix false positive in [`redundant_closure`] pertaining to non-function types [#4008](https://github.com/rust-lang/rust-clippy/pull/4008) +* Fix false positive in [`let_and_return`] pertaining to attributes on `let`s [#4024](https://github.com/rust-lang/rust-clippy/pull/4024) +* Fix false positive in [`module_name_repetitions`] lint pertaining to attributes [#4006](https://github.com/rust-lang/rust-clippy/pull/4006) +* Fix false positive on [`assertions_on_constants`] pertaining to `debug_assert!` [#3989](https://github.com/rust-lang/rust-clippy/pull/3989) +* Improve suggestion in [`map_clone`] to suggest `.copied()` where applicable [#3970](https://github.com/rust-lang/rust-clippy/pull/3970) [#4043](https://github.com/rust-lang/rust-clippy/pull/4043) +* Improve suggestion for [`search_is_some`] [#4049](https://github.com/rust-lang/rust-clippy/pull/4049) +* Improve suggestion applicability for [`naive_bytecount`] [#3984](https://github.com/rust-lang/rust-clippy/pull/3984) +* Improve suggestion applicability for [`while_let_loop`] [#3975](https://github.com/rust-lang/rust-clippy/pull/3975) +* Improve diagnostics for [`too_many_arguments`] [#4053](https://github.com/rust-lang/rust-clippy/pull/4053) +* Improve diagnostics for [`cast_lossless`] [#4021](https://github.com/rust-lang/rust-clippy/pull/4021) +* Deal with macro checks in desugarings better [#4082](https://github.com/rust-lang/rust-clippy/pull/4082) +* Add macro check for [`unnecessary_cast`] [#4026](https://github.com/rust-lang/rust-clippy/pull/4026) +* Remove [`approx_constant`]'s documentation's "Known problems" section. [#4027](https://github.com/rust-lang/rust-clippy/pull/4027) +* Fix ICE in [`suspicious_else_formatting`] [#3960](https://github.com/rust-lang/rust-clippy/pull/3960) +* Fix ICE in [`decimal_literal_representation`] [#3931](https://github.com/rust-lang/rust-clippy/pull/3931) ## Rust 1.35 @@ -234,27 +234,27 @@ Released 2019-05-20 [1fac380..37f5c1e](https://github.com/rust-lang/rust-clippy/compare/1fac380...37f5c1e) - * New lint: [`drop_bounds`] to detect `T: Drop` bounds - * Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101) - * Rename `cyclomatic_complexity` to [`cognitive_complexity`], start work on making lint more practical for Rust code - * Move [`get_unwrap`] to the restriction category - * Improve suggestions for [`iter_cloned_collect`] - * Improve suggestions for [`cast_lossless`] to suggest suffixed literals - * Fix false positives in [`print_with_newline`] and [`write_with_newline`] pertaining to raw strings - * Fix false positive in [`needless_range_loop`] pertaining to structs without a `.iter()` - * Fix false positive in [`bool_comparison`] pertaining to non-bool types - * Fix false positive in [`redundant_closure`] pertaining to differences in borrows - * Fix false positive in [`option_map_unwrap_or`] on non-copy types - * Fix false positives in [`missing_const_for_fn`] pertaining to macros and trait method impls - * Fix false positive in [`needless_pass_by_value`] pertaining to procedural macros - * Fix false positive in [`needless_continue`] pertaining to loop labels - * Fix false positive for [`boxed_local`] pertaining to arguments moved into closures - * Fix false positive for [`use_self`] in nested functions - * Fix suggestion for [`expect_fun_call`] (https://github.com/rust-lang/rust-clippy/pull/3846) - * Fix suggestion for [`explicit_counter_loop`] to deal with parenthesizing range variables - * Fix suggestion for [`single_char_pattern`] to correctly escape single quotes - * Avoid triggering [`redundant_closure`] in macros - * ICE fixes: [#3805](https://github.com/rust-lang/rust-clippy/pull/3805), [#3772](https://github.com/rust-lang/rust-clippy/pull/3772), [#3741](https://github.com/rust-lang/rust-clippy/pull/3741) +* New lint: [`drop_bounds`] to detect `T: Drop` bounds +* Split [`redundant_closure`] into [`redundant_closure`] and [`redundant_closure_for_method_calls`] [#4110](https://github.com/rust-lang/rust-clippy/pull/4101) +* Rename `cyclomatic_complexity` to [`cognitive_complexity`], start work on making lint more practical for Rust code +* Move [`get_unwrap`] to the restriction category +* Improve suggestions for [`iter_cloned_collect`] +* Improve suggestions for [`cast_lossless`] to suggest suffixed literals +* Fix false positives in [`print_with_newline`] and [`write_with_newline`] pertaining to raw strings +* Fix false positive in [`needless_range_loop`] pertaining to structs without a `.iter()` +* Fix false positive in [`bool_comparison`] pertaining to non-bool types +* Fix false positive in [`redundant_closure`] pertaining to differences in borrows +* Fix false positive in [`option_map_unwrap_or`] on non-copy types +* Fix false positives in [`missing_const_for_fn`] pertaining to macros and trait method impls +* Fix false positive in [`needless_pass_by_value`] pertaining to procedural macros +* Fix false positive in [`needless_continue`] pertaining to loop labels +* Fix false positive for [`boxed_local`] pertaining to arguments moved into closures +* Fix false positive for [`use_self`] in nested functions +* Fix suggestion for [`expect_fun_call`] (https://github.com/rust-lang/rust-clippy/pull/3846) +* Fix suggestion for [`explicit_counter_loop`] to deal with parenthesizing range variables +* Fix suggestion for [`single_char_pattern`] to correctly escape single quotes +* Avoid triggering [`redundant_closure`] in macros +* ICE fixes: [#3805](https://github.com/rust-lang/rust-clippy/pull/3805), [#3772](https://github.com/rust-lang/rust-clippy/pull/3772), [#3741](https://github.com/rust-lang/rust-clippy/pull/3741) ## Rust 1.34 @@ -551,7 +551,7 @@ Released 2018-09-13 ## 0.0.181 * Rustup to *rustc 1.25.0-nightly (97520ccb1 2018-01-21)* * New lints: [`else_if_without_else`], [`option_option`], [`unit_arg`], [`unnecessary_fold`] -* Removed [`unit_expr`] +* Removed `unit_expr` * Various false positive fixes for [`needless_pass_by_value`] ## 0.0.180 @@ -597,11 +597,13 @@ Released 2018-09-13 ## 0.0.167 * Rustup to *rustc 1.23.0-nightly (90ef3372e 2017-10-29)* -* New lints: [`const_static_lifetime`], [`erasing_op`], [`fallible_impl_from`], [`println_empty_string`], [`useless_asref`] +* New lints: `const_static_lifetime`, [`erasing_op`], [`fallible_impl_from`], [`println_empty_string`], [`useless_asref`] ## 0.0.166 * Rustup to *rustc 1.22.0-nightly (b7960878b 2017-10-18)* -* New lints: [`explicit_write`], [`identity_conversion`], [`implicit_hasher`], [`invalid_ref`], [`option_map_or_none`], [`range_minus_one`], [`range_plus_one`], [`transmute_int_to_bool`], [`transmute_int_to_char`], [`transmute_int_to_float`] +* New lints: [`explicit_write`], [`identity_conversion`], [`implicit_hasher`], [`invalid_ref`], [`option_map_or_none`], + [`range_minus_one`], [`range_plus_one`], [`transmute_int_to_bool`], [`transmute_int_to_char`], + [`transmute_int_to_float`] ## 0.0.165 * Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27) @@ -636,7 +638,7 @@ Released 2018-09-13 ## 0.0.157 - 2017-09-04 * Update to *rustc 1.22.0-nightly (981ce7d8d 2017-09-03)* -* New lint: [`unit_expr`] +* New lint: `unit_expr` ## 0.0.156 - 2017-09-03 * Update to *rustc 1.22.0-nightly (744dd6c1d 2017-09-02)* @@ -884,7 +886,7 @@ Released 2018-09-13 lint groups: [`filter_next`], [`for_loop_over_option`], [`for_loop_over_result`] and [`match_overlapping_arm`]. You should now be able to `#[allow/deny]` them individually and they are available directly - through [`cargo clippy`]. + through `cargo clippy`. ## 0.0.87 — 2016-08-31 * Rustup to *rustc 1.13.0-nightly (eac41469d 2016-08-30)* @@ -897,7 +899,7 @@ Released 2018-09-13 ## 0.0.85 — 2016-08-19 * Fix ICE with [`useless_attribute`] -* [`useless_attribute`] ignores [`unused_imports`] on `use` statements +* [`useless_attribute`] ignores `unused_imports` on `use` statements ## 0.0.84 — 2016-08-18 * Rustup to *rustc 1.13.0-nightly (aef6971ca 2016-08-17)* @@ -936,7 +938,7 @@ Released 2018-09-13 ## 0.0.77 — 2016-06-21 * Rustup to *rustc 1.11.0-nightly (5522e678b 2016-06-20)* -* New lints: [`stutter`] and [`iter_nth`] +* New lints: `stutter` and [`iter_nth`] ## 0.0.76 — 2016-06-10 * Rustup to *rustc 1.11.0-nightly (7d2f75a95 2016-06-09)* @@ -1056,6 +1058,7 @@ Released 2018-09-13 [pull3665]: https://github.com/rust-lang/rust-clippy/pull/3665 [adding_lints]: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md + [`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons [`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d70b2b52aca1..dec13e44a17f 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -6,35 +6,65 @@ A version of this document [can be found online](https://www.rust-lang.org/condu **Contact**: [rust-mods@rust-lang.org](mailto:rust-mods@rust-lang.org) -* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic. -* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all. +* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, + gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, + religion, nationality, or other similar characteristic. +* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and + welcoming environment for all. * Please be kind and courteous. There's no need to be mean or rude. -* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer. -* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works. -* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the Citizen Code of Conduct; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups. -* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back. +* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and + numerous costs. There is seldom a right answer. +* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and + see how it works. +* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We + interpret the term "harassment" as including the definition in the Citizen + Code of Conduct; if you have any lack of clarity about what might be included in that concept, please read their + definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups. +* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or + made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation + team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a + safe place for you and we've got your back. * Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome. ## Moderation -These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, please contact the [Rust moderation team][mod_team]. +These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, +please contact the [Rust moderation team][mod_team]. -1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.) +1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, + are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.) 2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed. 3. Moderators will first respond to such remarks with a warning. 4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off. 5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded. -6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology. -7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed. -8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others. +6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended + party a genuine apology. +7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a + different moderator, **in private**. Complaints about bans in-channel are not allowed. +8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate + situation, they should expect less leeway than others. -In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely. +In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically +unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly +if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can +drive people away from the community entirely. -And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust. +And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was +they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good +there was something you could've communicated better — remember that it's your responsibility to make your fellow +Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about +cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their +trust. -The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. +The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, +#rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); +GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org +(users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the +maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider +explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. -*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* +*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the +[Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* [mod_team]: https://www.rust-lang.org/team.html#Moderation-team diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68eb64c94b6d..4777f2fabeb2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,12 +2,14 @@ Hello fellow Rustacean! Great to see your interest in compiler internals and lints! -**First**: if you're unsure or afraid of _anything_, just ask or submit the issue or pull request anyway. You won't be yelled at for giving it your best effort. The worst that can happen is that you'll be politely asked to change something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that. +**First**: if you're unsure or afraid of _anything_, just ask or submit the issue or pull request anyway. You won't be +yelled at for giving it your best effort. The worst that can happen is that you'll be politely asked to change +something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that. -Clippy welcomes contributions from everyone. There are many ways to contribute to Clippy and the following document explains how -you can contribute and how to get started. -If you have any questions about contributing or need help with anything, feel free to ask questions on issues or -visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in `#clippy` on [Discord](https://discord.gg/rust-lang). +Clippy welcomes contributions from everyone. There are many ways to contribute to Clippy and the following document +explains how you can contribute and how to get started. If you have any questions about contributing or need help with +anything, feel free to ask questions on issues or visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in +`#clippy` on [Discord](https://discord.gg/rust-lang). All contributors are expected to follow the [Rust Code of Conduct](http://www.rust-lang.org/conduct.html). @@ -49,12 +51,12 @@ matching of the syntax tree structure, and are generally easier than [`T-middle`](https://github.com/rust-lang/rust-clippy/labels/T-middle) issues, which involve types and resolved paths. -[`T-AST`](https://github.com/rust-lang/rust-clippy/labels/T-AST) issues will generally need you to match against a predefined syntax structure. To figure out -how this syntax structure is encoded in the AST, it is recommended to run `rustc -Z ast-json` on an -example of the structure and compare with the -[nodes in the AST docs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast). Usually -the lint will end up to be a nested series of matches and ifs, -[like so](https://github.com/rust-lang/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34). +[`T-AST`](https://github.com/rust-lang/rust-clippy/labels/T-AST) issues will generally need you to match against a +predefined syntax structure. To figure out how this syntax structure is encoded in the AST, it is recommended to run +`rustc -Z ast-json` on an example of the structure and compare with the [nodes in the AST +docs](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/ast). Usually the lint will end up to be a nested series of +matches and ifs, [like +so](https://github.com/rust-lang/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34). [`E-medium`](https://github.com/rust-lang/rust-clippy/labels/E-medium) issues are generally pretty easy too, though it's recommended you work on an E-easy issue first. They are mostly classified @@ -68,9 +70,9 @@ an AST expression). `match_def_path()` in Clippy's `utils` module can also be us ## Writing code -Have a look at the [docs for writing lints](doc/adding_lints.md) for more details. [Llogiq's blog post on lints](https://llogiq.github.io/2015/06/04/workflows.html) is also a nice primer -to lint-writing, though it does get into advanced stuff and may be a bit -outdated. +Have a look at the [docs for writing lints](doc/adding_lints.md) for more details. [Llogiq's blog post on +lints](https://llogiq.github.io/2015/06/04/workflows.html) is also a nice primer to lint-writing, though it does get +into advanced stuff and may be a bit outdated. If you want to add a new lint or change existing ones apart from bugfixing, it's also a good idea to give the [stability guarantees][rfc_stability] and @@ -79,9 +81,11 @@ quick read. ## How Clippy works -Clippy is a [rustc compiler plugin][compiler_plugin]. The main entry point is at [`src/lib.rs`][main_entry]. In there, the lint registration is delegated to the [`clippy_lints`][lint_crate] crate. +Clippy is a [rustc compiler plugin][compiler_plugin]. The main entry point is at [`src/lib.rs`][main_entry]. In there, +the lint registration is delegated to the [`clippy_lints`][lint_crate] crate. -[`clippy_lints/src/lib.rs`][lint_crate_entry] imports all the different lint modules and registers them with the rustc plugin registry. For example, the [`else_if_without_else`][else_if_without_else] lint is registered like this: +[`clippy_lints/src/lib.rs`][lint_crate_entry] imports all the different lint modules and registers them with the rustc +plugin registry. For example, the [`else_if_without_else`][else_if_without_else] lint is registered like this: ```rust // ./clippy_lints/src/lib.rs @@ -103,9 +107,12 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry) { } ``` -The [`plugin::PluginRegistry`][plugin_registry] provides two methods to register lints: [register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass]. -Both take an object that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in every single lint. -It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerated by `cargo dev update_lints` and you don't have to add anything by hand. When you are writing your own lint, you can use that script to save you some time. +The [`plugin::PluginRegistry`][plugin_registry] provides two methods to register lints: +[register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass]. Both take an object +that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in +every single lint. It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerated by `cargo dev +update_lints` and you don't have to add anything by hand. When you are writing your own lint, you can use that script to +save you some time. ```rust // ./clippy_lints/src/else_if_without_else.rs @@ -123,18 +130,25 @@ impl EarlyLintPass for ElseIfWithoutElse { } ``` -The difference between `EarlyLintPass` and `LateLintPass` is that the methods of the `EarlyLintPass` trait only provide AST information. The methods of the `LateLintPass` trait are executed after type checking and contain type information via the `LateContext` parameter. +The difference between `EarlyLintPass` and `LateLintPass` is that the methods of the `EarlyLintPass` trait only provide +AST information. The methods of the `LateLintPass` trait are executed after type checking and contain type information +via the `LateContext` parameter. -That's why the `else_if_without_else` example uses the `register_early_lint_pass` function. Because the [actual lint logic][else_if_without_else] does not depend on any type information. +That's why the `else_if_without_else` example uses the `register_early_lint_pass` function. Because the [actual lint +logic][else_if_without_else] does not depend on any type information. ## Fixing build failures caused by Rust -Clippy will sometimes fail to build from source because building it depends on unstable internal Rust features. Most of the times we have to adapt to the changes and only very rarely there's an actual bug in Rust. Fixing build failures caused by Rust updates, can be a good way to learn about Rust internals. +Clippy will sometimes fail to build from source because building it depends on unstable internal Rust features. Most of +the times we have to adapt to the changes and only very rarely there's an actual bug in Rust. Fixing build failures +caused by Rust updates, can be a good way to learn about Rust internals. -In order to find out why Clippy does not work properly with a new Rust commit, you can use the [rust-toolstate commit history][toolstate_commit_history]. -You will then have to look for the last commit that contains `test-pass -> build-fail` or `test-pass` -> `test-fail` for the `clippy-driver` component. [Here][toolstate_commit] is an example. +In order to find out why Clippy does not work properly with a new Rust commit, you can use the [rust-toolstate commit +history][toolstate_commit_history]. You will then have to look for the last commit that contains `test-pass -> +build-fail` or `test-pass` -> `test-fail` for the `clippy-driver` component. [Here][toolstate_commit] is an example. -The commit message contains a link to the PR. The PRs are usually small enough to discover the breaking API change and if they are bigger, they likely include some discussion that may help you to fix Clippy. +The commit message contains a link to the PR. The PRs are usually small enough to discover the breaking API change and +if they are bigger, they likely include some discussion that may help you to fix Clippy. To check if Clippy is available for a specific target platform, you can check the [rustup component history][rustup_component_history]. diff --git a/README.md b/README.md index fd7f33f91d51..af2331fa5331 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ Only the following of those categories are enabled by default: Other categories need to be enabled in order for their lints to be executed. -The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also contains "restriction lints", which are for things which are usually not considered "bad", but may be useful to turn on in specific cases. These should be used very selectively, if at all. +The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also contains "restriction lints", which are +for things which are usually not considered "bad", but may be useful to turn on in specific cases. These should be used +very selectively, if at all. Table of contents: @@ -140,15 +142,16 @@ line. (You can swap `clippy::all` with the specific lint category you are target ## Configuration -Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a basic `variable = value` mapping eg. +Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a basic `variable = +value` mapping eg. ```toml blacklisted-names = ["toto", "tata", "titi"] cognitive-complexity-threshold = 30 ``` -See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which lints can be configured and the -meaning of the variables. +See the [list of lints](https://rust-lang.github.io/rust-clippy/master/index.html) for more information about which +lints can be configured and the meaning of the variables. To deactivate the “for further information visit *lint-link*” message you can define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable. @@ -169,7 +172,10 @@ You can add options to your code to `allow`/`warn`/`deny` Clippy lints: Note: `deny` produces errors instead of warnings. -If you do not want to include your lint levels in your code, you can globally enable/disable lints by passing extra flags to Clippy during the run: `cargo clippy -- -A clippy::lint_name` will run Clippy with `lint_name` disabled and `cargo clippy -- -W clippy::lint_name` will run it with that enabled. This also works with lint groups. For example you can run Clippy with warnings for all lints enabled: `cargo clippy -- -W clippy::pedantic` +If you do not want to include your lint levels in your code, you can globally enable/disable lints by passing extra +flags to Clippy during the run: `cargo clippy -- -A clippy::lint_name` will run Clippy with `lint_name` disabled and +`cargo clippy -- -W clippy::lint_name` will run it with that enabled. This also works with lint groups. For example you +can run Clippy with warnings for all lints enabled: `cargo clippy -- -W clippy::pedantic` ## Contributing diff --git a/clippy_dummy/PUBLISH.md b/clippy_dummy/PUBLISH.md index 535f11bd2ee4..8e420ec959a2 100644 --- a/clippy_dummy/PUBLISH.md +++ b/clippy_dummy/PUBLISH.md @@ -1,4 +1,6 @@ -This is a dummy crate to publish to crates.io. It primarily exists to ensure that folks trying to install clippy from crates.io get redirected to the `rustup` technique. +This is a dummy crate to publish to crates.io. It primarily exists to ensure +that folks trying to install clippy from crates.io get redirected to the +`rustup` technique. -Before publishing, be sure to rename `clippy_dummy` to `clippy` in `Cargo.toml`, it has a different name to avoid workspace issues. - \ No newline at end of file +Before publishing, be sure to rename `clippy_dummy` to `clippy` in `Cargo.toml`, +it has a different name to avoid workspace issues. diff --git a/doc/adding_lints.md b/doc/adding_lints.md index e1f4ce016c5c..cc4b5f7d1623 100644 --- a/doc/adding_lints.md +++ b/doc/adding_lints.md @@ -167,12 +167,12 @@ declare_clippy_lint! { ``` * The section of lines prefixed with `///` constitutes the lint documentation -section. This is the default documentation style and will be displayed at -https://rust-lang.github.io/rust-clippy/master/index.html. + section. This is the default documentation style and will be displayed at + https://rust-lang.github.io/rust-clippy/master/index.html. * `FOO_FUNCTIONS` is the name of our lint. Be sure to follow the [lint naming -guidelines][lint_naming] here when naming your lint. In short, the name should -state the thing that is being checked for and read well when used with -`allow`/`warn`/`deny`. + guidelines][lint_naming] here when naming your lint. In short, the name should + state the thing that is being checked for and read well when used with + `allow`/`warn`/`deny`. * `pedantic` sets the lint level to `Allow`. The exact mapping can be found [here][category_level_mapping] * The last part should be a text that explains what exactly is wrong with the @@ -443,7 +443,6 @@ don't hesitate to ask on Discord, IRC or in the issue/PR. [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints [category_level_mapping]: https://github.com/rust-lang/rust-clippy/blob/bd23cb89ec0ea63403a17d3fc5e50c88e38dd54f/clippy_lints/src/lib.rs#L43 [declare_clippy_lint]: https://github.com/rust-lang/rust-clippy/blob/a71acac1da7eaf667ab90a1d65d10e5cc4b80191/clippy_lints/src/lib.rs#L39 -[compilation_stages]: https://rust-lang.github.io/rustc-guide/high-level-overview.html#the-main-stages-of-compilation [check_fn]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.EarlyLintPass.html#method.check_fn [early_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.EarlyLintPass.html [late_lint_pass]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/trait.LateLintPass.html diff --git a/etc/relicense/RELICENSE_DOCUMENTATION.md b/etc/relicense/RELICENSE_DOCUMENTATION.md index 847e66e65e35..fcd7abbf3f16 100644 --- a/etc/relicense/RELICENSE_DOCUMENTATION.md +++ b/etc/relicense/RELICENSE_DOCUMENTATION.md @@ -1,36 +1,69 @@ -This repository was previously licensed under MPL-2.0, however in #3093 ([archive](http://web.archive.org/web/20181005185227/https://github.com/rust-lang-nursery/rust-clippy/issues/3093), [screenshot](https://user-images.githubusercontent.com/1617736/46573505-5b856880-c94b-11e8-9a14-981c889b4981.png)) we relicensed it to the Rust license (dual licensed as Apache v2 / MIT) +This repository was previously licensed under MPL-2.0, however in #3093 +([archive](http://web.archive.org/web/20181005185227/https://github.com/rust-lang-nursery/rust-clippy/issues/3093), +[screenshot](https://user-images.githubusercontent.com/1617736/46573505-5b856880-c94b-11e8-9a14-981c889b4981.png)) we +relicensed it to the Rust license (dual licensed as Apache v2 / MIT) At the time, the contributors were those listed in contributors.txt. -We opened a bunch of issues asking for an explicit relicensing approval. Screenshots of all these issues at the time of relicensing are archived on GitHub. We also have saved Wayback Machine copies of these: +We opened a bunch of issues asking for an explicit relicensing approval. Screenshots of all these issues at the time of +relicensing are archived on GitHub. We also have saved Wayback Machine copies of these: - - #3094 ([archive](http://web.archive.org/web/20181005191247/https://github.com/rust-lang-nursery/rust-clippy/issues/3094), [screenshot](https://user-images.githubusercontent.com/1617736/46573506-5b856880-c94b-11e8-8a44-51cb40bc16ee.png)) - - #3095 ([archive](http://web.archive.org/web/20181005184416/https://github.com/rust-lang-nursery/rust-clippy/issues/3095), [screenshot](https://user-images.githubusercontent.com/1617736/46573507-5c1dff00-c94b-11e8-912a-4bd6b5f838f5.png)) - - #3096 ([archive](http://web.archive.org/web/20181005184802/https://github.com/rust-lang-nursery/rust-clippy/issues/3096), [screenshot](https://user-images.githubusercontent.com/1617736/46573508-5c1dff00-c94b-11e8-9425-2464f7260ff0.png)) - - #3097 ([archive](http://web.archive.org/web/20181005184821/https://github.com/rust-lang-nursery/rust-clippy/issues/3097), [screenshot](https://user-images.githubusercontent.com/1617736/46573509-5c1dff00-c94b-11e8-8ba2-53f687984fe7.png)) - - #3098 ([archive](http://web.archive.org/web/20181005184900/https://github.com/rust-lang-nursery/rust-clippy/issues/3098), [screenshot](https://user-images.githubusercontent.com/1617736/46573510-5c1dff00-c94b-11e8-8f64-371698401c60.png)) - - #3099 ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3099), [screenshot](https://user-images.githubusercontent.com/1617736/46573511-5c1dff00-c94b-11e8-8e20-7d0eeb392b95.png)) - - #3100 ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3100), [screenshot](https://user-images.githubusercontent.com/1617736/46573512-5c1dff00-c94b-11e8-8a13-7d758ed3563d.png)) - - #3230 ([archive](http://web.archive.org/web/20181005184903/https://github.com/rust-lang-nursery/rust-clippy/issues/3230), [screenshot](https://user-images.githubusercontent.com/1617736/46573513-5cb69580-c94b-11e8-86b1-14ce82741e5c.png)) +- #3094 + ([archive](http://web.archive.org/web/20181005191247/https://github.com/rust-lang-nursery/rust-clippy/issues/3094), + [screenshot](https://user-images.githubusercontent.com/1617736/46573506-5b856880-c94b-11e8-8a44-51cb40bc16ee.png)) +- #3095 + ([archive](http://web.archive.org/web/20181005184416/https://github.com/rust-lang-nursery/rust-clippy/issues/3095), + [screenshot](https://user-images.githubusercontent.com/1617736/46573507-5c1dff00-c94b-11e8-912a-4bd6b5f838f5.png)) +- #3096 + ([archive](http://web.archive.org/web/20181005184802/https://github.com/rust-lang-nursery/rust-clippy/issues/3096), + [screenshot](https://user-images.githubusercontent.com/1617736/46573508-5c1dff00-c94b-11e8-9425-2464f7260ff0.png)) +- #3097 + ([archive](http://web.archive.org/web/20181005184821/https://github.com/rust-lang-nursery/rust-clippy/issues/3097), + [screenshot](https://user-images.githubusercontent.com/1617736/46573509-5c1dff00-c94b-11e8-8ba2-53f687984fe7.png)) +- #3098 + ([archive](http://web.archive.org/web/20181005184900/https://github.com/rust-lang-nursery/rust-clippy/issues/3098), + [screenshot](https://user-images.githubusercontent.com/1617736/46573510-5c1dff00-c94b-11e8-8f64-371698401c60.png)) +- #3099 + ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3099), + [screenshot](https://user-images.githubusercontent.com/1617736/46573511-5c1dff00-c94b-11e8-8e20-7d0eeb392b95.png)) +- #3100 + ([archive](http://web.archive.org/web/20181005184901/https://github.com/rust-lang-nursery/rust-clippy/issues/3100), + [screenshot](https://user-images.githubusercontent.com/1617736/46573512-5c1dff00-c94b-11e8-8a13-7d758ed3563d.png)) +- #3230 + ([archive](http://web.archive.org/web/20181005184903/https://github.com/rust-lang-nursery/rust-clippy/issues/3230), + [screenshot](https://user-images.githubusercontent.com/1617736/46573513-5cb69580-c94b-11e8-86b1-14ce82741e5c.png)) The usernames of commenters on these issues can be found in relicense_comments.txt There are a couple people in relicense_comments.txt who are not found in contributors.txt: - - @EpocSquadron has [made minor text contributions to the README](https://github.com/rust-lang/rust-clippy/commits?author=EpocSquadron) which have since been overwritten, and doesn't count - - @JayKickliter [agreed to the relicense on their pull request](https://github.com/rust-lang/rust-clippy/pull/3195#issuecomment-423781016) ([archive](https://web.archive.org/web/20181005190730/https://github.com/rust-lang/rust-clippy/pull/3195), [screenshot](https://user-images.githubusercontent.com/1617736/46573514-5cb69580-c94b-11e8-8ffb-05a5bd02e2cc.png) -) - - @sanmai-NL's [contribution](https://github.com/rust-lang/rust-clippy/commits?author=sanmai-NL) is a minor one-word addition which doesn't count for copyright assignment - - @zmt00's [contributions](https://github.com/rust-lang/rust-clippy/commits?author=zmt00) are minor typo fixes and don't count - - @VKlayd has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=VKlayd) which we rewrote (see below) - - @wartman4404 has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=wartman4404) which we rewrote (see below) +- @EpocSquadron has [made minor text contributions to the + README](https://github.com/rust-lang/rust-clippy/commits?author=EpocSquadron) which have since been overwritten, and + doesn't count +- @JayKickliter [agreed to the relicense on their pull + request](https://github.com/rust-lang/rust-clippy/pull/3195#issuecomment-423781016) + ([archive](https://web.archive.org/web/20181005190730/https://github.com/rust-lang/rust-clippy/pull/3195), + [screenshot](https://user-images.githubusercontent.com/1617736/46573514-5cb69580-c94b-11e8-8ffb-05a5bd02e2cc.png) +- @sanmai-NL's [contribution](https://github.com/rust-lang/rust-clippy/commits?author=sanmai-NL) is a minor one-word + addition which doesn't count for copyright assignment +- @zmt00's [contributions](https://github.com/rust-lang/rust-clippy/commits?author=zmt00) are minor typo fixes and don't + count +- @VKlayd has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=VKlayd) which we rewrote + (see below) +- @wartman4404 has [nonminor contributions](https://github.com/rust-lang/rust-clippy/commits?author=wartman4404) which + we rewrote (see below) -Two of these contributors had nonminor contributions (#2184, #427) requiring a rewrite, carried out in #3251 ([archive](http://web.archive.org/web/20181005192411/https://github.com/rust-lang-nursery/rust-clippy/pull/3251), [screenshot](https://user-images.githubusercontent.com/1617736/46573515-5cb69580-c94b-11e8-86e5-b456452121b2.png) -) -First, I (Manishearth) removed the lints they had added. I then documented at a high level what the lints did in #3251, asking for co-maintainers who had not seen the code for the lints to rewrite them. #2814 was rewritten by @phansch, and #427 was rewritten by @oli-obk, who did not recall having previously seen the code they were rewriting. +Two of these contributors had nonminor contributions (#2184, #427) requiring a rewrite, carried out in #3251 +([archive](http://web.archive.org/web/20181005192411/https://github.com/rust-lang-nursery/rust-clippy/pull/3251), +[screenshot](https://user-images.githubusercontent.com/1617736/46573515-5cb69580-c94b-11e8-86e5-b456452121b2.png)) + +First, I (Manishearth) removed the lints they had added. I then documented at a high level what the lints did in #3251, +asking for co-maintainers who had not seen the code for the lints to rewrite them. #2814 was rewritten by @phansch, and +#427 was rewritten by @oli-obk, who did not recall having previously seen the code they were rewriting. ------ -Since this document was written, @JayKickliter and @sanmai-ML added their consent in #3230 ([archive](http://web.archive.org/web/20181006171926/https://github.com/rust-lang-nursery/rust-clippy/issues/3230)) +Since this document was written, @JayKickliter and @sanmai-ML added their consent in #3230 +([archive](http://web.archive.org/web/20181006171926/https://github.com/rust-lang-nursery/rust-clippy/issues/3230)) From d14ee8a4b1f41121d799c3f5b868d916ac0f24bd Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 18:43:57 +0100 Subject: [PATCH 06/30] Add Clippy Test (bors) to GHA --- .github/workflows/clippy_bors.yml | 146 ++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 .github/workflows/clippy_bors.yml diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml new file mode 100644 index 000000000000..6a6d58410f95 --- /dev/null +++ b/.github/workflows/clippy_bors.yml @@ -0,0 +1,146 @@ +name: Clippy Test (bors) + +on: + push: + branches: [auto, try] + # Don't run Clippy tests, when only textfiles were modified + paths-ignore: + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + +env: + RUST_BACKTRACE: 1 + CARGO_TARGET_DIR: '${{ github.workspace }}/target' + GHA_CI: 1 + +jobs: + base: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + host: [x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc] + exclude: + - os: ubuntu-latest + host: x86_64-apple-darwin + - os: ubuntu-latest + host: x86_64-pc-windows-msvc + - os: macos-latest + host: x86_64-unknown-linux-gnu + - os: macos-latest + host: i686-unknown-linux-gnu + - os: macos-latest + host: x86_64-pc-windows-msvc + - os: windows-latest + host: x86_64-unknown-linux-gnu + - os: windows-latest + host: i686-unknown-linux-gnu + - os: windows-latest + host: x86_64-apple-darwin + + runs-on: ${{ matrix.os }} + + steps: + - name: Install dependencies (Linux-i686) + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386 + if: matrix.host == 'i686-unknown-linux-gnu' + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.3 + with: + toolchain: nightly + target: ${{ matrix.host }} + profile: minimal + - name: Cache cargo dir + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-${{ matrix.host }} + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Master Toolchain Setup + run: bash setup-toolchain.sh + env: + HOST_TOOLCHAIN: ${{ matrix.host }} + shell: bash + + - name: Set LD_LIBRARY_PATH (Linux) + if: runner.os == 'Linux' + run: | + SYSROOT=$(rustc --print sysroot) + echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" + - name: Link rustc dylib (MacOS) + if: runner.os == 'macOS' + run: | + SYSROOT=$(rustc --print sysroot) + sudo mkdir -p /usr/local/lib + sudo find "${SYSROOT}/lib" -maxdepth 1 -name '*dylib' -exec ln -s {} /usr/local/lib \; + - name: Set PATH (Windows) + if: runner.os == 'Windows' + run: | + $sysroot = rustc --print sysroot + $env:PATH += ';' + $sysroot + '\bin' + echo "::set-env name=PATH::$env:PATH" + - name: Build + run: cargo build --features deny-warnings + shell: bash + - name: Test + run: cargo test --features deny-warnings + shell: bash + - name: Test clippy_lints + run: cargo test --features deny-warnings + shell: bash + working-directory: clippy_lints + - name: Test rustc_tools_util + run: cargo test --features deny-warnings + shell: bash + working-directory: rustc_tools_util + - name: Test clippy_dev + run: cargo test --features deny-warnings + shell: bash + working-directory: clippy_dev + - name: Test cargo-clippy + run: ../target/debug/cargo-clippy + shell: bash + working-directory: clippy_workspace_tests + - name: Test clippy-driver + run: | + ( + set -ex + # Check sysroot handling + sysroot=$(./target/debug/clippy-driver --print sysroot) + test "$sysroot" = "$(rustc --print sysroot)" + + if [[ ${{ runner.os }} == "Windows" ]]; then + desired_sysroot=C:/tmp + else + desired_sysroot=/tmp + fi + sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) + test "$sysroot" = $desired_sysroot + + sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) + test "$sysroot" = $desired_sysroot + + # Make sure this isn't set - clippy-driver should cope without it + unset CARGO_MANIFEST_DIR + + # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 + # FIXME: How to match the clippy invocation in compile-test.rs? + ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1 + sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr + diff normalized.stderr tests/ui/cstring.stderr + + # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR + ) + shell: bash + + - name: Run cargo-cache --autoclean + run: | + cargo install cargo-cache --debug + /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \; + cargo cache --autoclean + shell: bash From 1717a6f7d5784275337600bc534e35243471c1c5 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 18:44:30 +0100 Subject: [PATCH 07/30] Ignore fmt test in GHA CI This is already checked by clippy_dev.yml GHA --- tests/fmt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fmt.rs b/tests/fmt.rs index 2e33c3ed5e5b..e2675fa09683 100644 --- a/tests/fmt.rs +++ b/tests/fmt.rs @@ -3,7 +3,7 @@ use std::process::Command; #[test] fn fmt() { - if option_env!("RUSTC_TEST_SUITE").is_some() { + if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("GHA_CI").is_some() { return; } From ff8336b0a04237f3c151dd59cd915ad8eedfa093 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 21 Jan 2020 21:40:40 +0100 Subject: [PATCH 08/30] Check if changelog exists --- .github/workflows/clippy_bors.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 6a6d58410f95..2267b46f9fc1 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -16,7 +16,30 @@ env: GHA_CI: 1 jobs: + changelog: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + with: + ref: ${{ github.ref }} + - name: Check Changelog + run: | + MESSAGE=$(git log --format=%B -n 1) + PR=$(echo "$MESSAGE" | grep -o "#[0-9]*" | head -1 | sed -e 's/^#//') + output=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR" | \ + python -c "import sys, json; print(json.load(sys.stdin)['body'])" | \ + grep "^changelog: " | \ + sed "s/changelog: //g") + if [[ -z "$output" ]]; then + echo "ERROR: PR body must contain 'changelog: ...'" + exit 1 + elif [[ "$output" = "none" ]]; then + echo "WARNING: changelog is 'none'" + fi base: + needs: changelog strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] From f5db351a1d502cb65f8807ec2c84f44756099ef3 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Wed, 22 Jan 2020 14:56:08 +0100 Subject: [PATCH 09/30] Get {RUSTUP,MULTIRUST}_{HOME,TOOLCHAIN} from runtime environment Keep the fallback to compile-time environment --- src/driver.rs | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/driver.rs b/src/driver.rs index 087c8c67b4a0..097b796e785b 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -281,6 +281,17 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) { } } +fn toolchain_path(home: Option, toolchain: Option) -> Option { + home.and_then(|home| { + toolchain.map(|toolchain| { + let mut path = PathBuf::from(home); + path.push("toolchains"); + path.push(toolchain); + path + }) + }) +} + pub fn main() { rustc_driver::init_rustc_env_logger(); lazy_static::initialize(&ICE_HOOK); @@ -301,22 +312,21 @@ pub fn main() { // - RUSTUP_HOME, MULTIRUST_HOME, RUSTUP_TOOLCHAIN, MULTIRUST_TOOLCHAIN // - sysroot from rustc in the path // - compile-time environment + // - SYSROOT + // - RUSTUP_HOME, MULTIRUST_HOME, RUSTUP_TOOLCHAIN, MULTIRUST_TOOLCHAIN let sys_root_arg = arg_value(&orig_args, "--sysroot", |_| true); let have_sys_root_arg = sys_root_arg.is_some(); let sys_root = sys_root_arg .map(PathBuf::from) .or_else(|| std::env::var("SYSROOT").ok().map(PathBuf::from)) .or_else(|| { - let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); - let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); - home.and_then(|home| { - toolchain.map(|toolchain| { - let mut path = PathBuf::from(home); - path.push("toolchains"); - path.push(toolchain); - path - }) - }) + let home = std::env::var("RUSTUP_HOME") + .or_else(|_| std::env::var("MULTIRUST_HOME")) + .ok(); + let toolchain = std::env::var("RUSTUP_TOOLCHAIN") + .or_else(|_| std::env::var("MULTIRUST_TOOLCHAIN")) + .ok(); + toolchain_path(home, toolchain) }) .or_else(|| { Command::new("rustc") @@ -328,6 +338,15 @@ pub fn main() { .map(|s| PathBuf::from(s.trim())) }) .or_else(|| option_env!("SYSROOT").map(PathBuf::from)) + .or_else(|| { + let home = option_env!("RUSTUP_HOME") + .or(option_env!("MULTIRUST_HOME")) + .map(ToString::to_string); + let toolchain = option_env!("RUSTUP_TOOLCHAIN") + .or(option_env!("MULTIRUST_TOOLCHAIN")) + .map(ToString::to_string); + toolchain_path(home, toolchain) + }) .map(|pb| pb.to_string_lossy().to_string()) .expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust"); From 66b5e2212ddc33c437c3dc130ffe081c81d5b551 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Wed, 22 Jan 2020 17:06:13 +0100 Subject: [PATCH 10/30] Add Clippy Test to GHA --- .github/workflows/clippy.yml | 98 ++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/clippy.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 000000000000..ae1148e96cb9 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,98 @@ +name: Clippy Test + +on: + push: + # Ignore bors branches, since they are covered by `clippy_bors.yml` + branches-ignore: [auto, try] + # Don't run Clippy tests, when only textfiles were modified + paths-ignore: + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + pull_request: + # Don't run Clippy tests, when only textfiles were modified + paths-ignore: + - 'COPYRIGHT' + - 'LICENSE-*' + - '**.md' + - '**.txt' + +env: + RUST_BACKTRACE: 1 + CARGO_TARGET_DIR: '${{ github.workspace }}/target' + GHA_CI: 1 + +jobs: + base: + runs-on: ubuntu-latest + + steps: + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.3 + with: + toolchain: nightly + target: x86_64-unknown-linux-gnu + profile: minimal + - name: Cache cargo dir + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Master Toolchain Setup + run: bash setup-toolchain.sh + + - name: Set LD_LIBRARY_PATH (Linux) + run: | + SYSROOT=$(rustc --print sysroot) + echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" + - name: Build + run: cargo build --features deny-warnings + - name: Test + run: cargo test --features deny-warnings + - name: Test clippy_lints + run: cargo test --features deny-warnings + working-directory: clippy_lints + - name: Test rustc_tools_util + run: cargo test --features deny-warnings + working-directory: rustc_tools_util + - name: Test clippy_dev + run: cargo test --features deny-warnings + working-directory: clippy_dev + - name: Test cargo-clippy + run: ../target/debug/cargo-clippy + working-directory: clippy_workspace_tests + - name: Test clippy-driver + run: | + ( + set -ex + # Check sysroot handling + sysroot=$(./target/debug/clippy-driver --print sysroot) + test "$sysroot" = "$(rustc --print sysroot)" + + desired_sysroot=/tmp + sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) + test "$sysroot" = $desired_sysroot + + sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) + test "$sysroot" = $desired_sysroot + + # Make sure this isn't set - clippy-driver should cope without it + unset CARGO_MANIFEST_DIR + + # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 + # FIXME: How to match the clippy invocation in compile-test.rs? + ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1 + sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr + diff normalized.stderr tests/ui/cstring.stderr + + # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR + ) + + - name: Run cargo-cache --autoclean + run: | + cargo install cargo-cache --debug + find ~/.cargo/bin ! -type d -exec strip {} \; + cargo cache --autoclean From 92811675ce14d717d04d5d9e8dd89172cbcb0b57 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Wed, 22 Jan 2020 20:00:41 +0100 Subject: [PATCH 11/30] Move integration tests in clippy_bors.yml Some call it the integration integration --- .github/workflows/clippy_bors.yml | 55 +++++++++++++++++++++++- .github/workflows/integration.yml | 69 ------------------------------- 2 files changed, 54 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/integration.yml diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 2267b46f9fc1..99e2cdfa8e29 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -3,7 +3,7 @@ name: Clippy Test (bors) on: push: branches: [auto, try] - # Don't run Clippy tests, when only textfiles were modified + # Don't run tests, when only textfiles were modified paths-ignore: - 'COPYRIGHT' - 'LICENSE-*' @@ -167,3 +167,56 @@ jobs: /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean shell: bash + integration: + needs: changelog + strategy: + fail-fast: false + matrix: + integration: + - 'rust-lang/cargo' + - 'rust-lang/rls' + - 'rust-lang/chalk' + - 'rust-lang/rustfmt' + - 'Marwes/combine' + - 'Geal/nom' + - 'rust-lang/stdarch' + - 'serde-rs/serde' + - 'chronotope/chrono' + - 'hyperium/hyper' + - 'rust-random/rand' + - 'rust-lang/futures-rs' + - 'rust-itertools/itertools' + - 'rust-lang-nursery/failure' + - 'rust-lang/log' + + runs-on: ubuntu-latest + + steps: + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.3 + with: + toolchain: nightly + target: x86_64-unknown-linux-gnu + profile: minimal + - name: Cache cargo dir + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Master Toolchain Setup + run: bash setup-toolchain.sh + + - name: Build + run: cargo build --features integration + - name: Test ${{ matrix.integration }} + run: cargo test --test integration --features integration + env: + INTEGRATION: ${{ matrix.integration }} + + - name: Run cargo-cache --autoclean + run: | + cargo install cargo-cache --debug + find ~/.cargo/bin ! -type d -exec strip {} \; + cargo cache --autoclean diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml deleted file mode 100644 index fc05ee9b9210..000000000000 --- a/.github/workflows/integration.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Integration - -on: - push: - branches: - - auto - - try - # Don't run integration tests, when only textfiles were modified - paths-ignore: - - 'COPYRIGHT' - - 'LICENSE-*' - - '**.md' - - '**.txt' - -env: - RUST_BACKTRACE: 1 - -jobs: - integration: - strategy: - fail-fast: false - matrix: - integration: - - 'rust-lang/rls' - - 'rust-lang/cargo' - - 'rust-lang/chalk' - - 'Geal/nom' - - 'rust-lang/rustfmt' - - 'hyperium/hyper' - - 'rust-itertools/itertools' - - 'serde-rs/serde' - - 'rust-lang/stdarch' - - 'rust-random/rand' - - 'rust-lang/futures-rs' - - 'Marwes/combine' - - 'rust-lang-nursery/failure' - - 'rust-lang/log' - - 'chronotope/chrono' - runs-on: ubuntu-latest - - steps: - - name: rust-toolchain - uses: actions-rs/toolchain@v1.0.3 - with: - toolchain: nightly - target: x86_64-unknown-linux-gnu - profile: minimal - - name: Cache cargo dir - uses: actions/cache@v1 - with: - path: ~/.cargo - key: ${{ runner.os }}-x86_64-unknown-linux-gnu - - name: Checkout - uses: actions/checkout@v2.0.0 - - name: Master Toolchain Setup - run: bash setup-toolchain.sh - - - name: Build - run: cargo build --features integration - - name: Test ${{ matrix.integration }} - run: cargo test --test integration --features integration - env: - INTEGRATION: ${{ matrix.integration }} - - - name: Run cargo-cache --autoclean - run: | - cargo install cargo-cache --debug - find ~/.cargo/bin ! -type d -exec strip {} \; - cargo cache --autoclean From 893e261a99f74b3b925ab66ccfef45acb8b2d82b Mon Sep 17 00:00:00 2001 From: flip1995 Date: Wed, 22 Jan 2020 21:00:31 +0100 Subject: [PATCH 12/30] Add deployment to GHA --- .github/workflows/deploy.yml | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000000..100adbadd5ab --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,72 @@ +name: Deploy + +on: + push: + branches: master + release: + types: [created] + +env: + TARGET_BRANCH: 'gh-pages' + SHA: '${{ github.sha }}' + SSH_REPO: 'git@github.com:${{ github.repository }}.git' + TAG_NAME: '${{ github.event.release.GITHUB_REF }}' + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Checkout + uses: actions/checkout@v2.0.0 + with: + ref: ${{ env.TARGET_BRANCH }} + path: 'out' + - name: Deploy + run: | + set -ex + + echo "Removing the current docs for master" + rm -rf out/master/ || exit 0 + + echo "Making the docs for master" + mkdir out/master/ + cp util/gh-pages/index.html out/master + python ./util/export.py out/master/lints.json + + if [[ -n $TAG_NAME ]]; then + echo "Save the doc for the current tag ($TAG_NAME) and point current/ to it" + cp -r out/master "out/$TAG_NAME" + rm -f out/current + ln -s "$TAG_NAME" out/current + fi + + # Generate version index that is shown as root index page + cp util/gh-pages/versions.html out/index.html + + cd out + cat <<-EOF | python - > versions.json + import os, json + print json.dumps([ + dir for dir in os.listdir(".") if not dir.startswith(".") and os.path.isdir(dir) + ]) + EOF + + # Now let's go have some fun with the cloned repo + git config user.name "GHA CI" + git config user.email "gha@ci.invalid" + + if git diff --exit-code --quiet; then + echo "No changes to the output on this push; exiting." + exit 0 + fi + + git add . + git commit -m "Automatic deploy to GitHub Pages: ${SHA}" + + eval "$(ssh-agent -s)" + ssh-add - <<< "${{ secrets.DEPLOY_KEY }}" + + git push "$SSH_REPO" "$TARGET_BRANCH" From 8f45387490eecf46a8f7934bd48116b6be727261 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Thu, 23 Jan 2020 10:36:51 +0100 Subject: [PATCH 13/30] Small change to comment in .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f1f4fa4e242a..adf5e8feddf4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Used by Travis to be able to push: +# Used by CI to be able to push: /.github/deploy_key out From d7620a3e62a0097c990a4abda917c8e2a5115765 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Thu, 23 Jan 2020 10:22:02 +0100 Subject: [PATCH 14/30] Add GHA badge to README.md Add a FIXME to Cargo.toml --- Cargo.toml | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 84b96a329140..aefbcec15f51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ publish = false [badges] travis-ci = { repository = "rust-lang/rust-clippy" } appveyor = { repository = "rust-lang/rust-clippy" } +# FIXME(flip1995): Add GHA badge once rust-lang/crates.io#1838 is merged [[bin]] name = "cargo-clippy" diff --git a/README.md b/README.md index af2331fa5331..fe62dadfcbf0 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://travis-ci.com/rust-lang/rust-clippy.svg?branch=master)](https://travis-ci.com/rust-lang/rust-clippy) [![Windows Build status](https://ci.appveyor.com/api/projects/status/id677xpw1dguo7iw?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/rust-clippy) +[![Clippy Test](https://github.com/rust-lang/rust-clippy/workflows/Clippy%20Test/badge.svg?branch=master&event=push)](https://github.com/rust-lang/rust-clippy/actions?query=workflow%3A%22Clippy+Test%22+event%3Apush+branch%3Amaster) [![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license) A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code. From b9580fcef7a564fedf93e8f2237a089cd9b36fee Mon Sep 17 00:00:00 2001 From: flip1995 Date: Thu, 23 Jan 2020 14:40:37 +0100 Subject: [PATCH 15/30] Cancle builds on new commits --- .github/workflows/clippy.yml | 3 +++ .github/workflows/clippy_bors.yml | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index ae1148e96cb9..7997344aabd0 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -28,6 +28,9 @@ jobs: runs-on: ubuntu-latest steps: + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 99e2cdfa8e29..85cd7cbecb9e 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -20,6 +20,9 @@ jobs: runs-on: ubuntu-latest steps: + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" - name: Checkout uses: actions/checkout@v2.0.0 with: @@ -65,6 +68,9 @@ jobs: runs-on: ${{ matrix.os }} steps: + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" - name: Install dependencies (Linux-i686) run: | sudo dpkg --add-architecture i386 @@ -192,6 +198,9 @@ jobs: runs-on: ubuntu-latest steps: + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: From e59361f723ac048a8328f4974ed61e963825413a Mon Sep 17 00:00:00 2001 From: flip1995 Date: Thu, 23 Jan 2020 15:47:11 +0100 Subject: [PATCH 16/30] Limit parallel jobs on try/r+ runs Rate limit of 60 applies org wide, let's not spam. Thanks pietroalbini for the hint --- .github/workflows/clippy_bors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 85cd7cbecb9e..cb2041e49905 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -177,6 +177,7 @@ jobs: needs: changelog strategy: fail-fast: false + max-parallel: 6 matrix: integration: - 'rust-lang/cargo' From 935b94d80b4456c0c9e50526af2c9f441b846949 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 24 Jan 2020 14:34:25 +0100 Subject: [PATCH 17/30] Sort output of export.py script --- util/export.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/export.py b/util/export.py index e8fc4d84ea4f..5d1bd60acf3d 100755 --- a/util/export.py +++ b/util/export.py @@ -71,7 +71,9 @@ def main(): outfile = sys.argv[1] if len(sys.argv) > 1 else "util/gh-pages/lints.json" with open(outfile, "w") as fp: - json.dump(list(lints.values()), fp, indent=2) + lints = list(lints.values()) + lints.sort(key=lambda x: x['id']) + json.dump(lints, fp, indent=2) log.info("wrote JSON for great justice") From ea780a69f3d1d47eaacd2811ab7d742c1627b3d5 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sun, 26 Jan 2020 15:13:14 +0100 Subject: [PATCH 18/30] Extract driver test --- .github/driver.sh | 29 ++++++++++++++++++++++++++++ .github/workflows/clippy.yml | 28 +++------------------------ .github/workflows/clippy_bors.yml | 32 +++---------------------------- 3 files changed, 35 insertions(+), 54 deletions(-) create mode 100644 .github/driver.sh diff --git a/.github/driver.sh b/.github/driver.sh new file mode 100644 index 000000000000..eb81e45a64ea --- /dev/null +++ b/.github/driver.sh @@ -0,0 +1,29 @@ +#! /bin/bash + +set -ex + +# Check sysroot handling +sysroot=$(./target/debug/clippy-driver --print sysroot) +test "$sysroot" = "$(rustc --print sysroot)" + +if [[ ${OS} == "Windows" ]]; then + desired_sysroot=C:/tmp +else + desired_sysroot=/tmp +fi +sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) +test "$sysroot" = $desired_sysroot + +sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) +test "$sysroot" = $desired_sysroot + +# Make sure this isn't set - clippy-driver should cope without it +unset CARGO_MANIFEST_DIR + +# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 +# FIXME: How to match the clippy invocation in compile-test.rs? +./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1 +sed -e "s,tests/ui,\$DIR," -e "/= help/d" cstring.stderr > normalized.stderr +diff normalized.stderr tests/ui/cstring.stderr + +# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 7997344aabd0..9661f826abd3 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -68,31 +68,9 @@ jobs: run: ../target/debug/cargo-clippy working-directory: clippy_workspace_tests - name: Test clippy-driver - run: | - ( - set -ex - # Check sysroot handling - sysroot=$(./target/debug/clippy-driver --print sysroot) - test "$sysroot" = "$(rustc --print sysroot)" - - desired_sysroot=/tmp - sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) - test "$sysroot" = $desired_sysroot - - sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) - test "$sysroot" = $desired_sysroot - - # Make sure this isn't set - clippy-driver should cope without it - unset CARGO_MANIFEST_DIR - - # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 - # FIXME: How to match the clippy invocation in compile-test.rs? - ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1 - sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr - diff normalized.stderr tests/ui/cstring.stderr - - # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR - ) + run: bash .github/driver.sh + env: + OS: ${{ runner.os }} - name: Run cargo-cache --autoclean run: | diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index cb2041e49905..49e4251f9dae 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -136,36 +136,10 @@ jobs: shell: bash working-directory: clippy_workspace_tests - name: Test clippy-driver - run: | - ( - set -ex - # Check sysroot handling - sysroot=$(./target/debug/clippy-driver --print sysroot) - test "$sysroot" = "$(rustc --print sysroot)" - - if [[ ${{ runner.os }} == "Windows" ]]; then - desired_sysroot=C:/tmp - else - desired_sysroot=/tmp - fi - sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) - test "$sysroot" = $desired_sysroot - - sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) - test "$sysroot" = $desired_sysroot - - # Make sure this isn't set - clippy-driver should cope without it - unset CARGO_MANIFEST_DIR - - # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 - # FIXME: How to match the clippy invocation in compile-test.rs? - ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1 - sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr - diff normalized.stderr tests/ui/cstring.stderr - - # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR - ) + run: bash .github/driver.sh shell: bash + env: + OS: ${{ runner.os }} - name: Run cargo-cache --autoclean run: | From dfdea56e99e864d43206643b85190cb15127cfb9 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sun, 26 Jan 2020 15:40:53 +0100 Subject: [PATCH 19/30] Extract deployment --- .github/deploy.sh | 60 +++++++----------------------------- .github/workflows/deploy.yml | 43 +------------------------- 2 files changed, 12 insertions(+), 91 deletions(-) mode change 100755 => 100644 .github/deploy.sh diff --git a/.github/deploy.sh b/.github/deploy.sh old mode 100755 new mode 100644 index 19dc4017166c..d96c69392a1e --- a/.github/deploy.sh +++ b/.github/deploy.sh @@ -1,20 +1,7 @@ -#!/bin/bash - -# Automatically deploy on gh-pages +#! /bin/bash set -ex -SOURCE_BRANCH="master" -TARGET_BRANCH="gh-pages" - -# Save some useful information -REPO=$(git config remote.origin.url) -SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} -SHA=$(git rev-parse --verify HEAD) - -# Clone the existing gh-pages for this repo into out/ -git clone --quiet --single-branch --branch "$TARGET_BRANCH" "$REPO" out - echo "Removing the current docs for master" rm -rf out/master/ || exit 0 @@ -23,59 +10,34 @@ mkdir out/master/ cp util/gh-pages/index.html out/master python ./util/export.py out/master/lints.json -if [[ -n "$TRAVIS_TAG" ]]; then - echo "Save the doc for the current tag ($TRAVIS_TAG) and point current/ to it" - cp -r out/master "out/$TRAVIS_TAG" - rm -f out/current - ln -s "$TRAVIS_TAG" out/current +if [[ -n $TAG_NAME ]]; then + echo "Save the doc for the current tag ($TAG_NAME) and point current/ to it" + cp -r out/master "out/$TAG_NAME" + rm -f out/current + ln -s "$TAG_NAME" out/current fi # Generate version index that is shown as root index page cp util/gh-pages/versions.html out/index.html -pushd out +cd out cat <<-EOF | python - > versions.json import os, json print json.dumps([ dir for dir in os.listdir(".") if not dir.startswith(".") and os.path.isdir(dir) ]) EOF -popd - -# Pull requests and commits to other branches shouldn't try to deploy, just build to verify -if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || [[ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then - # Tags should deploy - if [[ -z "$TRAVIS_TAG" ]]; then - echo "Generated, won't push" - exit 0 - fi -fi # Now let's go have some fun with the cloned repo -cd out -git config user.name "Travis CI" -git config user.email "travis@ci.invalid" +git config user.name "GHA CI" +git config user.email "gha@ci.invalid" if git diff --exit-code --quiet; then - echo "No changes to the output on this push; exiting." - exit 0 + echo "No changes to the output on this push; exiting." + exit 0 fi -cd - -# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc -ENCRYPTION_LABEL=e3a2d77100be -ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" -ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" -ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} -ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} -openssl aes-256-cbc -K "$ENCRYPTED_KEY" -iv "$ENCRYPTED_IV" -in .github/deploy_key.enc -out .github/deploy_key -d -chmod 600 .github/deploy_key -eval "$(ssh-agent -s)" -ssh-add .github/deploy_key - -cd out git add . git commit -m "Automatic deploy to GitHub Pages: ${SHA}" -# Now that we're all set up, we can push. git push "$SSH_REPO" "$TARGET_BRANCH" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 100adbadd5ab..a3c9b1784a18 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,47 +26,6 @@ jobs: path: 'out' - name: Deploy run: | - set -ex - - echo "Removing the current docs for master" - rm -rf out/master/ || exit 0 - - echo "Making the docs for master" - mkdir out/master/ - cp util/gh-pages/index.html out/master - python ./util/export.py out/master/lints.json - - if [[ -n $TAG_NAME ]]; then - echo "Save the doc for the current tag ($TAG_NAME) and point current/ to it" - cp -r out/master "out/$TAG_NAME" - rm -f out/current - ln -s "$TAG_NAME" out/current - fi - - # Generate version index that is shown as root index page - cp util/gh-pages/versions.html out/index.html - - cd out - cat <<-EOF | python - > versions.json - import os, json - print json.dumps([ - dir for dir in os.listdir(".") if not dir.startswith(".") and os.path.isdir(dir) - ]) - EOF - - # Now let's go have some fun with the cloned repo - git config user.name "GHA CI" - git config user.email "gha@ci.invalid" - - if git diff --exit-code --quiet; then - echo "No changes to the output on this push; exiting." - exit 0 - fi - - git add . - git commit -m "Automatic deploy to GitHub Pages: ${SHA}" - eval "$(ssh-agent -s)" ssh-add - <<< "${{ secrets.DEPLOY_KEY }}" - - git push "$SSH_REPO" "$TARGET_BRANCH" + bash .github/deploy.sh From ab43951d418301cf20f6ff97b8023b80730730c7 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Thu, 30 Jan 2020 17:03:45 +0100 Subject: [PATCH 20/30] Allow non-ascii characters in changelog check --- .github/workflows/clippy_bors.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 49e4251f9dae..15ef44aa1f26 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -41,6 +41,8 @@ jobs: elif [[ "$output" = "none" ]]; then echo "WARNING: changelog is 'none'" fi + env: + PYTHONIOENCODING: 'utf-8' base: needs: changelog strategy: From 1ceeb13e0ad12d044d7bcc0c4ca03c8414dd5ee9 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 31 Jan 2020 14:42:44 +0100 Subject: [PATCH 21/30] Build Clippy before running integration tests --- .github/workflows/clippy_bors.yml | 56 ++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 15ef44aa1f26..e84e3baec625 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -149,8 +149,50 @@ jobs: /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean shell: bash - integration: + integration_build: needs: changelog + runs-on: ubuntu-latest + + steps: + - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master + with: + github_token: "${{ secrets.github_token }}" + - name: rust-toolchain + uses: actions-rs/toolchain@v1.0.3 + with: + toolchain: nightly + target: x86_64-unknown-linux-gnu + profile: minimal + - name: Cache cargo dir + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Master Toolchain Setup + run: bash setup-toolchain.sh + + - name: Build Integration Test + run: cargo test --test integration --features integration --no-run + - name: Extract Binaries + run: | + DIR=$CARGO_TARGET_DIR/debug + find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf + mv $DIR/integration-* $DIR/integration + - name: Upload Binaries + uses: actions/upload-artifact@v1 + with: + name: target + path: target + + - name: Run cargo-cache --autoclean + run: | + cargo install cargo-cache --debug + find ~/.cargo/bin ! -type d -exec strip {} \; + cargo cache --autoclean + integration: + needs: integration_build strategy: fail-fast: false max-parallel: 6 @@ -194,12 +236,18 @@ jobs: - name: Master Toolchain Setup run: bash setup-toolchain.sh - - name: Build - run: cargo build --features integration + - name: Download target dir + uses: actions/download-artifact@v1 + with: + name: target + path: target + - name: Make Binaries Executable + run: chmod +x $CARGO_TARGET_DIR/debug/* - name: Test ${{ matrix.integration }} - run: cargo test --test integration --features integration + run: $CARGO_TARGET_DIR/debug/integration env: INTEGRATION: ${{ matrix.integration }} + RUSTUP_TOOLCHAIN: master - name: Run cargo-cache --autoclean run: | From 095287dbc86c7264d221aafc08ac1961140b0db4 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 31 Jan 2020 14:43:02 +0100 Subject: [PATCH 22/30] Add two more error causes to integration test --- tests/integration.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index d14ced8ad4e7..74f9a854dc1f 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -59,6 +59,10 @@ fn integration_test() { panic!("query stack during panic in the output"); } else if stderr.contains("E0463") { panic!("error: E0463"); + } else if stderr.contains("E0514") { + panic!("incompatible crate versions"); + } else if stderr.contains("failed to run `rustc` to learn about target-specific information") { + panic!("couldn't find librustc_driver, consider setting `LD_LIBRARY_PATH`"); } match output.status.code() { From 813d3192bb0267ba2971ab85c115d52119848ff5 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 31 Jan 2020 14:44:55 +0100 Subject: [PATCH 23/30] Use hash of Cargo.lock file in cache name --- .github/workflows/clippy.yml | 10 +++++++--- .github/workflows/clippy_bors.yml | 30 +++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 9661f826abd3..b4bd9f540bd1 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -37,13 +37,17 @@ jobs: toolchain: nightly target: x86_64-unknown-linux-gnu profile: minimal + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Run cargo update + run: cargo update - name: Cache cargo dir uses: actions/cache@v1 with: path: ~/.cargo - key: ${{ runner.os }}-x86_64-unknown-linux-gnu - - name: Checkout - uses: actions/checkout@v2.0.0 + key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-x86_64-unknown-linux-gnu - name: Master Toolchain Setup run: bash setup-toolchain.sh diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index e84e3baec625..498b109f7803 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -85,13 +85,17 @@ jobs: toolchain: nightly target: ${{ matrix.host }} profile: minimal + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Run cargo update + run: cargo update - name: Cache cargo dir uses: actions/cache@v1 with: path: ~/.cargo - key: ${{ runner.os }}-${{ matrix.host }} - - name: Checkout - uses: actions/checkout@v2.0.0 + key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.host }} - name: Master Toolchain Setup run: bash setup-toolchain.sh env: @@ -163,13 +167,17 @@ jobs: toolchain: nightly target: x86_64-unknown-linux-gnu profile: minimal + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Run cargo update + run: cargo update - name: Cache cargo dir uses: actions/cache@v1 with: path: ~/.cargo - key: ${{ runner.os }}-x86_64-unknown-linux-gnu - - name: Checkout - uses: actions/checkout@v2.0.0 + key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-x86_64-unknown-linux-gnu - name: Master Toolchain Setup run: bash setup-toolchain.sh @@ -226,13 +234,17 @@ jobs: toolchain: nightly target: x86_64-unknown-linux-gnu profile: minimal + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Run cargo update + run: cargo update - name: Cache cargo dir uses: actions/cache@v1 with: path: ~/.cargo - key: ${{ runner.os }}-x86_64-unknown-linux-gnu - - name: Checkout - uses: actions/checkout@v2.0.0 + key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-x86_64-unknown-linux-gnu - name: Master Toolchain Setup run: bash setup-toolchain.sh From b8b47ab6fe4e1c18db2685c406a508fe145c7de9 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 4 Feb 2020 17:33:50 +0100 Subject: [PATCH 24/30] Add bors dummy jobs --- .github/workflows/clippy_bors.yml | 26 ++++++++++++++++++++++++++ .github/workflows/clippy_dev.yml | 26 ++++++++++++++++++++++++++ .github/workflows/remark.yml | 26 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 498b109f7803..c06d44185e49 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -266,3 +266,29 @@ jobs: cargo install cargo-cache --debug find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean + + # These jobs doesn't actually test anything, but they're only used to tell + # bors the build completed, as there is no practical way to detect when a + # workflow is successful listening to webhooks only. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + + end-success: + name: bors test finished + if: github.event.pusher.name == 'bors' && success() + runs-on: ubuntu-latest + needs: [base, integration] + + steps: + - name: Mark the job as successful + run: exit 0 + + end-failure: + name: bors test finished + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) + runs-on: ubuntu-latest + needs: [base, integration] + + steps: + - name: Mark the job as a failure + run: exit 1 diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml index d054b6ba750c..e4409ee80a5b 100644 --- a/.github/workflows/clippy_dev.yml +++ b/.github/workflows/clippy_dev.yml @@ -42,3 +42,29 @@ jobs: run: cargo dev update_lints --check - name: Test fmt run: cargo dev fmt --check + + # These jobs doesn't actually test anything, but they're only used to tell + # bors the build completed, as there is no practical way to detect when a + # workflow is successful listening to webhooks only. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + + end-success: + name: bors dev test finished + if: github.event.pusher.name == 'bors' && success() + runs-on: ubuntu-latest + needs: [clippy_dev] + + steps: + - name: Mark the job as successful + run: exit 0 + + end-failure: + name: bors dev test finished + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) + runs-on: ubuntu-latest + needs: [clippy_dev] + + steps: + - name: Mark the job as a failure + run: exit 1 diff --git a/.github/workflows/remark.yml b/.github/workflows/remark.yml index 8e311c75df08..5256c538e371 100644 --- a/.github/workflows/remark.yml +++ b/.github/workflows/remark.yml @@ -22,3 +22,29 @@ jobs: - name: Check *.md files run: git ls-files -z '*.md' | xargs -0 -n 1 -I {} ./node_modules/.bin/remark {} -u lint -f > /dev/null + + # These jobs doesn't actually test anything, but they're only used to tell + # bors the build completed, as there is no practical way to detect when a + # workflow is successful listening to webhooks only. + # + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! + + end-success: + name: bors remark test finished + if: github.event.pusher.name == 'bors' && success() + runs-on: ubuntu-latest + needs: [remark] + + steps: + - name: Mark the job as successful + run: exit 0 + + end-failure: + name: bors remark test finished + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) + runs-on: ubuntu-latest + needs: [remark] + + steps: + - name: Mark the job as a failure + run: exit 1 From abb095ddedd3c918d7c55d028d7f134bf4a507d3 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 4 Feb 2020 18:42:45 +0100 Subject: [PATCH 25/30] Run bors checks unconditionally This is important, since bors doesn't know optional jobs. Otherwise bors would time out, when a check doesn't get run. --- .github/workflows/clippy_bors.yml | 6 ------ .github/workflows/clippy_dev.yml | 8 ++------ .github/workflows/remark.yml | 3 +-- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index c06d44185e49..b1b207416a1e 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -3,12 +3,6 @@ name: Clippy Test (bors) on: push: branches: [auto, try] - # Don't run tests, when only textfiles were modified - paths-ignore: - - 'COPYRIGHT' - - 'LICENSE-*' - - '**.md' - - '**.txt' env: RUST_BACKTRACE: 1 diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml index e4409ee80a5b..f9e5d73a3458 100644 --- a/.github/workflows/clippy_dev.yml +++ b/.github/workflows/clippy_dev.yml @@ -1,14 +1,10 @@ name: Clippy Dev Test on: - # Only run on paths, that get checked by the clippy_dev tool push: - paths: - - 'CAHNGELOG.md' - - 'README.md' - - '**.stderr' - - '**.rs' + branches: [auto, try] pull_request: + # Only run on paths, that get checked by the clippy_dev tool paths: - 'CAHNGELOG.md' - 'README.md' diff --git a/.github/workflows/remark.yml b/.github/workflows/remark.yml index 5256c538e371..8059dbf433bc 100644 --- a/.github/workflows/remark.yml +++ b/.github/workflows/remark.yml @@ -2,8 +2,7 @@ name: Remark on: push: - paths: - - '**.md' + branches: [auto, try] pull_request: paths: - '**.md' From b47dada167dea3d889abd77b7ff584afdaaf0a86 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 7 Feb 2020 22:24:41 +0100 Subject: [PATCH 26/30] Apply review comments --- .github/deploy.sh | 2 +- .github/driver.sh | 2 +- .github/workflows/clippy.yml | 17 ++++++++++++- .github/workflows/clippy_bors.yml | 42 ++++++++++++++++++++++++++++++- .github/workflows/clippy_dev.yml | 6 +++++ .github/workflows/deploy.yml | 4 +++ .github/workflows/remark.yml | 4 +++ tests/fmt.rs | 2 +- 8 files changed, 74 insertions(+), 5 deletions(-) diff --git a/.github/deploy.sh b/.github/deploy.sh index d96c69392a1e..4fcff830aa6f 100644 --- a/.github/deploy.sh +++ b/.github/deploy.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash set -ex diff --git a/.github/driver.sh b/.github/driver.sh index eb81e45a64ea..a2e87f5eb374 100644 --- a/.github/driver.sh +++ b/.github/driver.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash set -ex diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index b4bd9f540bd1..fb945060980d 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -21,26 +21,31 @@ on: env: RUST_BACKTRACE: 1 CARGO_TARGET_DIR: '${{ github.workspace }}/target' - GHA_CI: 1 + NO_FMT_TEST: 1 jobs: base: runs-on: ubuntu-latest steps: + # Setup - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master with: github_token: "${{ secrets.github_token }}" + - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: toolchain: nightly target: x86_64-unknown-linux-gnu profile: minimal + - name: Checkout uses: actions/checkout@v2.0.0 + - name: Run cargo update run: cargo update + - name: Cache cargo dir uses: actions/cache@v1 with: @@ -48,34 +53,44 @@ jobs: key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Master Toolchain Setup run: bash setup-toolchain.sh + # Run - name: Set LD_LIBRARY_PATH (Linux) run: | SYSROOT=$(rustc --print sysroot) echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" + - name: Build run: cargo build --features deny-warnings + - name: Test run: cargo test --features deny-warnings + - name: Test clippy_lints run: cargo test --features deny-warnings working-directory: clippy_lints + - name: Test rustc_tools_util run: cargo test --features deny-warnings working-directory: rustc_tools_util + - name: Test clippy_dev run: cargo test --features deny-warnings working-directory: clippy_dev + - name: Test cargo-clippy run: ../target/debug/cargo-clippy working-directory: clippy_workspace_tests + - name: Test clippy-driver run: bash .github/driver.sh env: OS: ${{ runner.os }} + # Cleanup - name: Run cargo-cache --autoclean run: | cargo install cargo-cache --debug diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index b1b207416a1e..a690573180f0 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -7,7 +7,7 @@ on: env: RUST_BACKTRACE: 1 CARGO_TARGET_DIR: '${{ github.workspace }}/target' - GHA_CI: 1 + NO_FMT_TEST: 1 jobs: changelog: @@ -21,6 +21,8 @@ jobs: uses: actions/checkout@v2.0.0 with: ref: ${{ github.ref }} + + # Run - name: Check Changelog run: | MESSAGE=$(git log --format=%B -n 1) @@ -64,25 +66,31 @@ jobs: runs-on: ${{ matrix.os }} steps: + # Setup - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master with: github_token: "${{ secrets.github_token }}" + - name: Install dependencies (Linux-i686) run: | sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install gcc-multilib libssl-dev:i386 libgit2-dev:i386 if: matrix.host == 'i686-unknown-linux-gnu' + - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: toolchain: nightly target: ${{ matrix.host }} profile: minimal + - name: Checkout uses: actions/checkout@v2.0.0 + - name: Run cargo update run: cargo update + - name: Cache cargo dir uses: actions/cache@v1 with: @@ -90,12 +98,14 @@ jobs: key: ${{ runner.os }}-${{ matrix.host }}-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ runner.os }}-${{ matrix.host }} + - name: Master Toolchain Setup run: bash setup-toolchain.sh env: HOST_TOOLCHAIN: ${{ matrix.host }} shell: bash + # Run - name: Set LD_LIBRARY_PATH (Linux) if: runner.os == 'Linux' run: | @@ -113,34 +123,42 @@ jobs: $sysroot = rustc --print sysroot $env:PATH += ';' + $sysroot + '\bin' echo "::set-env name=PATH::$env:PATH" + - name: Build run: cargo build --features deny-warnings shell: bash + - name: Test run: cargo test --features deny-warnings shell: bash + - name: Test clippy_lints run: cargo test --features deny-warnings shell: bash working-directory: clippy_lints + - name: Test rustc_tools_util run: cargo test --features deny-warnings shell: bash working-directory: rustc_tools_util + - name: Test clippy_dev run: cargo test --features deny-warnings shell: bash working-directory: clippy_dev + - name: Test cargo-clippy run: ../target/debug/cargo-clippy shell: bash working-directory: clippy_workspace_tests + - name: Test clippy-driver run: bash .github/driver.sh shell: bash env: OS: ${{ runner.os }} + # Cleanup - name: Run cargo-cache --autoclean run: | cargo install cargo-cache --debug @@ -152,19 +170,24 @@ jobs: runs-on: ubuntu-latest steps: + # Setup - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master with: github_token: "${{ secrets.github_token }}" + - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: toolchain: nightly target: x86_64-unknown-linux-gnu profile: minimal + - name: Checkout uses: actions/checkout@v2.0.0 + - name: Run cargo update run: cargo update + - name: Cache cargo dir uses: actions/cache@v1 with: @@ -172,22 +195,28 @@ jobs: key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Master Toolchain Setup run: bash setup-toolchain.sh + # Run - name: Build Integration Test run: cargo test --test integration --features integration --no-run + + # Upload - name: Extract Binaries run: | DIR=$CARGO_TARGET_DIR/debug find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf mv $DIR/integration-* $DIR/integration + - name: Upload Binaries uses: actions/upload-artifact@v1 with: name: target path: target + # Cleanup - name: Run cargo-cache --autoclean run: | cargo install cargo-cache --debug @@ -219,19 +248,24 @@ jobs: runs-on: ubuntu-latest steps: + # Setup - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master with: github_token: "${{ secrets.github_token }}" + - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: toolchain: nightly target: x86_64-unknown-linux-gnu profile: minimal + - name: Checkout uses: actions/checkout@v2.0.0 + - name: Run cargo update run: cargo update + - name: Cache cargo dir uses: actions/cache@v1 with: @@ -239,22 +273,28 @@ jobs: key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ runner.os }}-x86_64-unknown-linux-gnu + - name: Master Toolchain Setup run: bash setup-toolchain.sh + # Download - name: Download target dir uses: actions/download-artifact@v1 with: name: target path: target + - name: Make Binaries Executable run: chmod +x $CARGO_TARGET_DIR/debug/* + + # Run - name: Test ${{ matrix.integration }} run: $CARGO_TARGET_DIR/debug/integration env: INTEGRATION: ${{ matrix.integration }} RUSTUP_TOOLCHAIN: master + # Cleanup - name: Run cargo-cache --autoclean run: | cargo install cargo-cache --debug diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml index f9e5d73a3458..d6f5db014a43 100644 --- a/.github/workflows/clippy_dev.yml +++ b/.github/workflows/clippy_dev.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-latest steps: + # Setup - name: rust-toolchain uses: actions-rs/toolchain@v1.0.3 with: @@ -26,16 +27,21 @@ jobs: target: x86_64-unknown-linux-gnu profile: minimal components: rustfmt + - name: Checkout uses: actions/checkout@v2.0.0 + # Run - name: Build run: cargo build --features deny-warnings working-directory: clippy_dev + - name: Test limit-stderr-length run: cargo dev --limit-stderr-length + - name: Test update_lints run: cargo dev update_lints --check + - name: Test fmt run: cargo dev fmt --check diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a3c9b1784a18..6f79891358eb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,13 +17,17 @@ jobs: runs-on: ubuntu-latest steps: + # Setup - name: Checkout uses: actions/checkout@v2.0.0 + - name: Checkout uses: actions/checkout@v2.0.0 with: ref: ${{ env.TARGET_BRANCH }} path: 'out' + + # Run - name: Deploy run: | eval "$(ssh-agent -s)" diff --git a/.github/workflows/remark.yml b/.github/workflows/remark.yml index 8059dbf433bc..3544053d399a 100644 --- a/.github/workflows/remark.yml +++ b/.github/workflows/remark.yml @@ -12,13 +12,17 @@ jobs: runs-on: ubuntu-latest steps: + # Setup - name: Checkout uses: actions/checkout@v2.0.0 + - name: Setup Node.js uses: actions/setup-node@v1.1.0 + - name: Install remark run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended + # Run - name: Check *.md files run: git ls-files -z '*.md' | xargs -0 -n 1 -I {} ./node_modules/.bin/remark {} -u lint -f > /dev/null diff --git a/tests/fmt.rs b/tests/fmt.rs index e2675fa09683..3aff8741f605 100644 --- a/tests/fmt.rs +++ b/tests/fmt.rs @@ -3,7 +3,7 @@ use std::process::Command; #[test] fn fmt() { - if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("GHA_CI").is_some() { + if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() { return; } From 622ece3153c7e0cf4144ee468d45d1ed4de19bd0 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 7 Feb 2020 22:27:14 +0100 Subject: [PATCH 27/30] Remove deployment from travis --- .travis.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd3003d45977..653966784ffe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -152,15 +152,3 @@ script: else ./ci/base-tests.sh && sleep 5 fi - -after_success: - - | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - set -e - if [[ -z ${INTEGRATION} ]]; then - ./.github/deploy.sh - else - echo "Not deploying, because we're in an integration test run" - fi - set +e - fi From 27453463f2615920fa964625f104d6822c105b32 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Fri, 7 Feb 2020 22:33:05 +0100 Subject: [PATCH 28/30] Install all required remark packages in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 653966784ffe..fa02f5334017 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ install: . $HOME/.nvm/nvm.sh nvm install stable nvm use stable - npm install remark-cli remark-lint + npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install windows-sdk-10.1 fi From a0a21a8752b3e1616d183c9e407e5d78de39bd1e Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sun, 9 Feb 2020 16:29:03 +0100 Subject: [PATCH 29/30] Use nightly cargo to install cargo-cache Stable cargo install still errors when packages exists, instead of updating it --- .github/workflows/clippy.yml | 2 +- .github/workflows/clippy_bors.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index fb945060980d..0d7d2929000b 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -93,6 +93,6 @@ jobs: # Cleanup - name: Run cargo-cache --autoclean run: | - cargo install cargo-cache --debug + cargo +nightly install cargo-cache --debug find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index a690573180f0..0f97e5165e6c 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -161,7 +161,7 @@ jobs: # Cleanup - name: Run cargo-cache --autoclean run: | - cargo install cargo-cache --debug + cargo +nightly install cargo-cache --debug /usr/bin/find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean shell: bash @@ -219,7 +219,7 @@ jobs: # Cleanup - name: Run cargo-cache --autoclean run: | - cargo install cargo-cache --debug + cargo +nightly install cargo-cache --debug find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean integration: @@ -297,7 +297,7 @@ jobs: # Cleanup - name: Run cargo-cache --autoclean run: | - cargo install cargo-cache --debug + cargo +nightly install cargo-cache --debug find ~/.cargo/bin ! -type d -exec strip {} \; cargo cache --autoclean From 3fac289c3d7f9caea256ce6cc65b54e214aa776e Mon Sep 17 00:00:00 2001 From: flip1995 Date: Wed, 12 Feb 2020 10:01:19 +0100 Subject: [PATCH 30/30] Don't upload target/release in integration_build This dir was generated by compiling RTIM, when no cache is available --- .github/workflows/clippy_bors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index 0f97e5165e6c..d147e0790a0a 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -209,6 +209,7 @@ jobs: DIR=$CARGO_TARGET_DIR/debug find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf mv $DIR/integration-* $DIR/integration + rm -rf $CARGO_TARGET_DIR/release - name: Upload Binaries uses: actions/upload-artifact@v1