Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

📌 Pin Clippy to a nightly 📌 #6401

Merged
merged 8 commits into from
Dec 11, 2020
Merged

Conversation

ebroto
Copy link
Member

@ebroto ebroto commented Nov 29, 2020

changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy)

Addresses partially #5561. As proposed there in this comment, this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:

  • When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
  • When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
  • Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for @flip1995 who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
  • I'm not sure if this affects the release process in any way.
  • ???

@rust-lang/clippy thoughts?

r? @flip1995

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 29, 2020
@ebroto ebroto marked this pull request as draft November 29, 2020 17:39
@ebroto
Copy link
Member Author

ebroto commented Nov 29, 2020

(converting to draft as I want to test the changes manually in the rustc repo)

@matthiaskrgr
Copy link
Member

When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released.

Can we specify a commit up to that we sync when pulling from rustc into rust-lang/clippy?
If so, maybe we could have some kind of script which finds out the latest version of rustc nightly (perhaps via rustup check?) and performs a sync up to that rust-nightly commit, and then edits the rust-toolchain file accordingly?

@flip1995
Copy link
Member

  • When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.

I like @matthiaskrgr idea. So the process of a Rustup would be to check the commit of the latest nightly, then checkout this commit in the Rust repo and do the sync from the detached head.

We can build tooling for this later. There is also gitree, which @mominul implemented and is still waiting on my review. I suggest to enhance this tool and use it.

  • When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.

Yeah, we should do it together with (right after) the rustups. Rustup PRs should get p=1 in the rust repo, so that the process is faster. If the process should get painful, we can do those rustups every week, instead of every other week.

  • Who does the rustups now?

I don't mind doing them, it's really not that much work. I'll post on Zulip if I should not get to do them for some reason.

  • I'm not sure if this affects the release process in any way.

I don't think so? 🤔 We'll see, I guess

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to do in depth review and think about this for a bit longer, so that we don't forget about something. Thanks for moving this forward ❤️

CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
setup-toolchain.sh Show resolved Hide resolved
@matthiaskrgr
Copy link
Member

Right now, the rustfmt component is missing from nightly and it seems that when building clippy with a nightly that does not offer a required (in the rust-toolchain file) component, rustup simply skips the component.

info: syncing channel updates for 'nightly-2020-11-29-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-29, rust version 1.50.0-nightly (e37f25aa3 2020-11-28)
warning: Force-skipping unavailable component 'rustfmt-x86_64-unknown-linux-gnu'
info: downloading component 'cargo'
...

This might be something to be aware of, I hope it won't break our neck later at some point....

It also installs clippy from that nightly for some reason which seems a bit excessive? 😄

@ebroto
Copy link
Member Author

ebroto commented Nov 29, 2020

Right now, the rustfmt component is missing from nightly and it seems that when building clippy with a nightly that does not offer a required (in the rust-toolchain file) component, rustup simply skips the component.

If I'm not mistaken the situation should not be different to what we have now as we are using rustfmt from the nightly (without a specific date) toolchain for the tests.

It also installs clippy from that nightly for some reason which seems a bit excessive? smile

Yeah, that was an oversight when adding TOML support for the toolchain file, it installs the components in the current profile in addition to the ones specified. There's rust-lang/rustup#2579 to address it.

In the CI we set the minimal profile before starting the build, so it does not try to install clippy.

doc/basics.md Show resolved Hide resolved
@ebroto
Copy link
Member Author

ebroto commented Nov 30, 2020

After testing this in the in-tree version of Clippy, I think it does not cause additional problems. I ran into the Found multiple rlibs for crate serde error, but I think it's not related to this change.

I've opened a Zulip thread to discuss that problem, but I think it was already present.

@ebroto ebroto marked this pull request as ready for review November 30, 2020 21:33
@Manishearth
Copy link
Member

I am a bit iffy about this: we used to pin to nightlies and dealing with the gap period between master merges and nightlies was really annoying. But now that rustups can happen without us needing to fix things, perhaps this just means we need to run syncs at appropriate times. That seems fine.

@flip1995
Copy link
Member

flip1995 commented Dec 1, 2020

But now that rustups can happen without us needing to fix things, perhaps this just means we need to run syncs at appropriate times. That seems fine.

Yeah, now it should just be git sbtree push and git mergetool. We then have to figure out the right cycle, so that the mergetool won't be overwhelmed.

I'll try to review this over the weekend 👍

@flip1995

This comment has been minimized.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's do this with #6401 (comment) addressed 🚀

Also the sync should be in the order

  1. subtree push to the Clippy repo
  2. subtree pull to the Rust repo

That way we make sure, that both Clippy and Rust pass the complete Clippy test suite after each sync.

Also somewhere should be documented, that you want to sync from Rust to Clippy from the latest nightly commit (rustup check), not the top-of-tree commit.

@ebroto
Copy link
Member Author

ebroto commented Dec 9, 2020

I've addressed the last remark and updated to the latest nightly to be coherent with the latest rustup we did yesterday.

@flip1995
Copy link
Member

flip1995 commented Dec 9, 2020

@bors r+

Let's go, thanks for moving this forward! 🚀

Next steps:

  1. Adapt .rustfmt.toml from rustc
  2. Try to use the same nightly rustfmt as rustc
  3. Let the tidy check in rustc also check Clippy.

@bors
Copy link
Contributor

bors commented Dec 9, 2020

📌 Commit 945536b has been approved by flip1995

bors added a commit that referenced this pull request Dec 9, 2020
📌 Pin Clippy to a nightly 📌

changelog: none

Addresses partially #5561. As proposed there in [this comment](#5561 (comment)), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`
@bors
Copy link
Contributor

bors commented Dec 9, 2020

⌛ Testing commit 945536b with merge e5bb0ab...

@bors
Copy link
Contributor

bors commented Dec 9, 2020

💔 Test failed - checks-action_test

@flip1995
Copy link
Member

flip1995 commented Dec 9, 2020

Off to a good start 😄

I don't think we need the steps, which set the LD_LIBRARY_PATH and equivalents anymore.

@flip1995
Copy link
Member

flip1995 commented Dec 9, 2020

This patch should do the job:

diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml
index 181b3bab4..7a9a2893c 100644
--- a/.github/workflows/clippy.yml
+++ b/.github/workflows/clippy.yml
@@ -38,7 +38,6 @@ jobs:
     - name: rust-toolchain
       uses: actions-rs/toolchain@v1.0.6
       with:
-        toolchain: nightly
         target: x86_64-unknown-linux-gnu
         profile: minimal

@@ -56,12 +55,6 @@ jobs:
         restore-keys: |
           ${{ runner.os }}-x86_64-unknown-linux-gnu

-    # Run
-    - name: Set LD_LIBRARY_PATH (Linux)
-      run: |
-        SYSROOT=$(rustc --print sysroot)
-        echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
-
     - name: Build
       run: cargo build --features deny-warnings

diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml
index f08182365..06fb314d1 100644
--- a/.github/workflows/clippy_bors.yml
+++ b/.github/workflows/clippy_bors.yml
@@ -87,7 +87,6 @@ jobs:
     - name: rust-toolchain
       uses: actions-rs/toolchain@v1.0.6
       with:
-        toolchain: nightly
         target: ${{ matrix.host }}
         profile: minimal

@@ -106,23 +105,6 @@ jobs:
           ${{ runner.os }}-${{ matrix.host }}

     # Run
-    - name: Set LD_LIBRARY_PATH (Linux)
-      if: runner.os == 'Linux'
-      run: |
-        SYSROOT=$(rustc --print sysroot)
-        echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
-    - 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)
-        echo "$SYSROOT/bin" >> $GITHUB_PATH
-
     - name: Build with internal lints
       run: cargo build --features deny-warnings,internal-lints

@@ -169,7 +151,6 @@ jobs:
     - name: rust-toolchain
       uses: actions-rs/toolchain@v1.0.6
       with:
-        toolchain: nightly
         target: x86_64-unknown-linux-gnu
         profile: minimal

@@ -247,7 +228,6 @@ jobs:
     - name: rust-toolchain
       uses: actions-rs/toolchain@v1.0.6
       with:
-        toolchain: nightly
         target: x86_64-unknown-linux-gnu
         profile: minimal

diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml
index 5ee157cf2..8ca6a8c0c 100644
--- a/.github/workflows/clippy_dev.yml
+++ b/.github/workflows/clippy_dev.yml
@@ -25,10 +25,8 @@ jobs:
     - name: rust-toolchain
       uses: actions-rs/toolchain@v1.0.6
       with:
-        toolchain: nightly
         target: x86_64-unknown-linux-gnu
         profile: minimal
-        components: rustfmt

     - name: Checkout
       uses: actions/checkout@v2.3.3

@flip1995
Copy link
Member

flip1995 commented Dec 9, 2020

^We also have to remove the toolchain: nightly, because otherwise it installs the latest nightly and on cargo build it will install the specified nightly, according to the actions-rs/toolchain documentation.

@ebroto
Copy link
Member Author

ebroto commented Dec 9, 2020

^We also have to remove the toolchain: nightly, because otherwise it installs the latest nightly and on cargo build it will install the specified nightly, according to the actions-rs/toolchain documentation.

Hmm don't we need nightly for the fmt tests?

EDIT: I thought we wanted to keep that behavior in case rustfmt is missing in a particular nightly, since nightly itself can be changed to point to another one.

@ebroto
Copy link
Member Author

ebroto commented Dec 9, 2020

@bors try

@bors
Copy link
Contributor

bors commented Dec 9, 2020

⌛ Trying commit 8f95ae4 with merge ff3c4b1...

bors added a commit that referenced this pull request Dec 10, 2020
📌 Pin Clippy to a nightly 📌

changelog: none

Addresses partially #5561. As proposed there in [this comment](#5561 (comment)), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`
@bors
Copy link
Contributor

bors commented Dec 10, 2020

⌛ Trying commit dd30c42 with merge b4f396c...

@flip1995
Copy link
Member

@bors try

Let's try to enable all of our integration tests again

@bors
Copy link
Contributor

bors commented Dec 10, 2020

⌛ Trying commit 279721c with merge 7579123...

bors added a commit that referenced this pull request Dec 10, 2020
📌 Pin Clippy to a nightly 📌

changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy)

Addresses partially #5561. As proposed there in [this comment](#5561 (comment)), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`
@flip1995
Copy link
Member

Uhm some changes in this PR make our integration test silently fail/not run at all. I'll investigate.

@bors
Copy link
Contributor

bors commented Dec 10, 2020

☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Build commit: 7579123 (7579123a654f4a5d9428a433d6f877fa806b58fb)

The only thing we now cache is cargo-cache, which we only use for cache.
That's a catch-22 if I ever seen one. And for Clippy itself we always
want to do a clean build and not cache anything.
@flip1995
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Dec 10, 2020

⌛ Trying commit d3b0a65 with merge ad89934...

bors added a commit that referenced this pull request Dec 10, 2020
📌 Pin Clippy to a nightly 📌

changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy)

Addresses partially #5561. As proposed there in [this comment](#5561 (comment)), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`
@bors
Copy link
Contributor

bors commented Dec 10, 2020

💔 Test failed - checks-action_test

@flip1995
Copy link
Member

@bors try (please work)

bors added a commit that referenced this pull request Dec 10, 2020
📌 Pin Clippy to a nightly 📌

changelog: Pin Clippy to a specific nightly version (No more master/custom toolchain required to compile Clippy)

Addresses partially #5561. As proposed there in [this comment](#5561 (comment)), this kicks off the process, to help us get acquainted with how the syncs should work, before working on improving the tooling.

Open questions:
* When performing a rustup, we will need to exclude the commits that were merged that same day, or else wait until that nightly is released. I did not update the documentation about this part, mainly because I'm not sure about how to do that.
* When should we perform the rustups now? My first idea is to do it at the same time we do the clippyups, to have a clear cadence and to avoid the two copies of the repo to diverge enough to make the process painful.
* Who does the rustups now? If we follow my previous idea and do both rustup and clippyup at the same time, it would be more work for `@flip1995` who currently does the clippyups. I would prefer to establish some kind of rotation to spead the work. Other ideas?
* I'm not sure if this affects the release process in any way.
* ???

`@rust-lang/clippy` thoughts?

r? `@flip1995`
@bors
Copy link
Contributor

bors commented Dec 10, 2020

⌛ Trying commit 836325e with merge 092ff67...

@bors
Copy link
Contributor

bors commented Dec 10, 2020

☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Build commit: 092ff67 (092ff6714c7df737212f96ca57d7ffd8be556613)

Copy link
Member Author

@ebroto ebroto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general (github won't let me auto-approve the PR 😄)

I just left a doubt.

- name: Run cargo update
run: cargo update
- name: Install toolchain
run: rustup show active-toolchain
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove the rust-toolchain step, from where does the rustup used in this command come from?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GHA ships with stable rust+rustup already installed. See GHA documentation about the pre-installed software

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's convenient :)

BTW thanks for the work on this, you saved me another night fighting the CI 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP, I like CI pain 😄

So can we merge this? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I was hesitant about approving a PR I opened 😄

@ebroto
Copy link
Member Author

ebroto commented Dec 11, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Dec 11, 2020

📌 Commit 836325e has been approved by ebroto

@bors
Copy link
Contributor

bors commented Dec 11, 2020

⌛ Testing commit 836325e with merge baf5f2d...

@bors
Copy link
Contributor

bors commented Dec 11, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: ebroto
Pushing baf5f2d to master...

@bors bors merged commit baf5f2d into rust-lang:master Dec 11, 2020
@ebroto ebroto deleted the pin_to_a_nightly branch December 11, 2020 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants