From a5304715647814ba43fd97141f94a9ee83e25964 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 31 Jul 2020 13:52:17 -0400 Subject: Automate periodic Rust Nightly upgrades. This allows the project to have a pinned version of Rust, but also ensures we don't fall too far behind on versions so long as someone (cough) reviews the pull requests regularly. This splits the difference between using nightly directly (and having Travis fail sporadically because of missing rustfmt/clippy) and pinning so that Travis works reliably (and having a large version lag). --- .github/workflows/nightly-rust-update.yml | 29 +++++++++++++++++++++++++++++ rust-toolchain | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nightly-rust-update.yml diff --git a/.github/workflows/nightly-rust-update.yml b/.github/workflows/nightly-rust-update.yml new file mode 100644 index 0000000..c7dc962 --- /dev/null +++ b/.github/workflows/nightly-rust-update.yml @@ -0,0 +1,29 @@ +name: Update Rust nightly +on: + workflow_dispatch: + schedule: + # Nothing magic here, I just wanted to avoid the midnight thundering + # herd on the first of each month. + - cron: '0 5 8 * *' + +jobs: + nightly-update: + name: Update Rust nightly + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: date +nightly-%Y-%m-%d > rust-toolchain + - run: rustup install --profile minimal "$(< rust-toolchain)" + - run: rustup component add clippy rustfmt + - run: cargo install cargo-udeps + - run: tools/checks + - uses: peter-evans/create-pull-request@v3 + with: + commit-message: Update Rust nightly version. + branch: rust-nightly-update + title: Update Rust nightly version + body: | + If these changes look good, merge this pull request to + update to the latest Nightly as of today. + + Automatically generated by the nightly-rust-update workflow. diff --git a/rust-toolchain b/rust-toolchain index 4eabcfe..4aec5c6 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-07-26 +nightly-2020-06-10 -- cgit v1.2.3 From f6b35d12a4328acc7a0f85c7e383251c2823143b Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 31 Jul 2020 15:05:30 -0400 Subject: Move tool installation into scripts. Now that it's done in two (well, three, if you count the README) places, it's best if its done consistently. --- .github/workflows/nightly-rust-update.yml | 6 ++---- .travis.yml | 3 +-- README.md | 10 ++-------- tools/install-tool-dependencies | 9 +++++++++ tools/update-nightly | 8 ++++++++ 5 files changed, 22 insertions(+), 14 deletions(-) create mode 100755 tools/install-tool-dependencies create mode 100755 tools/update-nightly diff --git a/.github/workflows/nightly-rust-update.yml b/.github/workflows/nightly-rust-update.yml index c7dc962..00ff6e6 100644 --- a/.github/workflows/nightly-rust-update.yml +++ b/.github/workflows/nightly-rust-update.yml @@ -12,10 +12,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: date +nightly-%Y-%m-%d > rust-toolchain - - run: rustup install --profile minimal "$(< rust-toolchain)" - - run: rustup component add clippy rustfmt - - run: cargo install cargo-udeps + - run: tools/update-nightly + - run: tools/install-tool-dependencies - run: tools/checks - uses: peter-evans/create-pull-request@v3 with: diff --git a/.travis.yml b/.travis.yml index 5e41e58..64c0120 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ rust: cache: cargo install: - - rustup component add clippy rustfmt - - cargo install cargo-udeps + - tools/install-tool-dependencies - cargo build script: diff --git a/README.md b/README.md index 4dc7c75..e8ff197 100644 --- a/README.md +++ b/README.md @@ -45,16 +45,10 @@ you're willing to take that chance. To set this up: -* Install additional Rust components: +* Install additional Rust components and Cargo binaries: ```bash - rustup component add clippy rustfmt - ``` - -* Install `cargo-udeps`: - - ```bash - cargo install cargo-udeps + tools/install-tool-dependencies ``` * Configure Git to use these hooks: diff --git a/tools/install-tool-dependencies b/tools/install-tool-dependencies new file mode 100755 index 0000000..27a9015 --- /dev/null +++ b/tools/install-tool-dependencies @@ -0,0 +1,9 @@ +#!/bin/bash -ex + +# tools/install-tool-dependencies +# +# Install Rust and Cargo components used by tool scripts, which are not part of +# Cargo.toml. + +rustup component add clippy rustfmt +cargo install cargo-udeps \ No newline at end of file diff --git a/tools/update-nightly b/tools/update-nightly new file mode 100755 index 0000000..7567110 --- /dev/null +++ b/tools/update-nightly @@ -0,0 +1,8 @@ +#!/bin/bash -ex + +# tools/update-nightly +# +# Install today's nightly Rust release. + +date "+nightly-%Y-%m-%d" > rust-toolchain +rustup install --profile minimal "$(< rust-toolchain)" -- cgit v1.2.3