Skip to content

Pin rustfmt and nightly revision used to build it #609

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

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Pin rustfmt and nightly revision used to build it
  • Loading branch information
djc committed Mar 31, 2021
commit 74d35f989524ad722ff9aacbf8b19a88328cc5b0
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: nightly-2021-03-30
override: true
default: true
- name: Check formatting
Expand Down
8 changes: 7 additions & 1 deletion admin/fmt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ set -xe
ADMIN=$(dirname "$0")
PREV=$(pwd)
if [ ! -d $ADMIN/rustfmt ] ; then
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we need to check the actual version of rustfmt stored in $ADMIN/rustfmt to see if it is the version that corresponds to the given commit. In particular, when we update $COMMIT below, this should trigger a re-download and rebuild of the new version of rustfmt.

Copy link
Contributor

@sayrer sayrer Apr 1, 2021

Choose a reason for hiding this comment

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

Apologies in advance for this very annoying comment: Bazel would do this as part of its approach. If we're going this route, it might be better to download Bazel and run this script through it, instead of depending on these shell scripts to get this right.

git clone --depth 1 https://github.com/rust-lang/rustfmt $ADMIN/rustfmt
COMMIT=8829e455b722f1ba8ade915ad2687639a2abb2c3
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment above this about why we're pinning the Rustfmt version: We want to ensure that people submitting PRs and CI agree on what version to use, and we want to limit our exposure to breaking changes in the rust-lang/rustfmt repo.

Further, it seems like we should use a fixed version of Rust Nightly, e.g. +nightly-2021-03-31 to get a consistent build of rustfmt so the script doesn't break when the rust-lang/rust repo is updated.

Further, We need to ensure that that version of Rust Nightly is installed. Note that the runner of this script might not have any version of Rust Nightly installed already, especially if they typically use stable Rust.

cd $ADMIN
git init rustfmt
cd rustfmt
git fetch --depth=1 https://github.com/rust-lang/rustfmt $COMMIT
git checkout $COMMIT
cd ../..
fi

if [ ! -x $ADMIN/rustfmt/target/release/cargo-fmt ] ; then
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy