From 0773b80d65800b22088066747c65d9b56eb631f4 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 14 Feb 2017 11:22:21 +0100 Subject: [PATCH 1/3] only require rustfmt and update_lints for version bumps --- .travis.yml | 6 ------ PUBLISH.md | 7 +++---- pre_publish.sh | 9 +++++++++ 3 files changed, 12 insertions(+), 10 deletions(-) create mode 100755 pre_publish.sh diff --git a/.travis.yml b/.travis.yml index 8f434f3ef2a..fa39dd4bed6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,17 +23,11 @@ install: - nvm install stable - nvm use stable - npm install remark-cli remark-lint - # || true, because we cache rustfmt and don't want to crash on the next travis run - # due to rustfmt already being installed - - (cargo install rustfmt || true) script: - PATH=$PATH:./node_modules/.bin - remark -f README.md > /dev/null - - python util/update_lints.py -c - set -e - - PATH=$PATH:~/.cargo/bin cargo fmt -- --write-mode=diff - - cd clippy_lints && PATH=$PATH:~/.cargo/bin cargo fmt -- --write-mode=diff && cd .. - cargo build --features debugging - cargo test --features debugging - mkdir -p ~/rust/cargo/bin diff --git a/PUBLISH.md b/PUBLISH.md index b500e5e3f28..228e4b97f49 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -1,15 +1,14 @@ Steps to publish a new clippy version -1. `cargo test`. - Bump `package.version` in `./Cargo.toml` (no need to manually bump `dependencies.clippy_lints.version`). -- Run `./util/update_lints.py`. +- Run `./pre_publish.sh` - Write a changelog entry. -- Commit `./Cargo.toml`, `./clippy_lints/Cargo.toml` and `./CHANGELOG.md`. +- Review and commit all changed files - `git push` - Wait for Travis's approval. - Merge. - `cargo publish` in `./clippy_clints`. - `cargo publish` in the root directory. - `git pull`. -- `git tag -s v0.0.X`. +- `git tag -s v0.0.X -m "v0.0.X"`. - `git push --tags`. diff --git a/pre_publish.sh b/pre_publish.sh new file mode 100755 index 00000000000..960722c8c2a --- /dev/null +++ b/pre_publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +cd clippy_lints && cargo fmt && cd .. +cargo fmt +cargo test +./util/update_lints.py + From 3b8d348fd55f4bfaa59a004b506a1a96bafc473b Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Thu, 16 Feb 2017 09:49:47 +0100 Subject: [PATCH 2/3] create a commit with just changelog and Cargo.toml changes --- .gitignore | 2 ++ pre_publish.sh | 20 +++++++++++++++++--- publish.files | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 publish.files diff --git a/.gitignore b/.gitignore index 33ecb63593c..7b8050a6563 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ util/gh-pages/lints.json # rustfmt backups *.rs.bk + +helper.txt diff --git a/pre_publish.sh b/pre_publish.sh index 960722c8c2a..656ed6eff89 100755 --- a/pre_publish.sh +++ b/pre_publish.sh @@ -2,8 +2,22 @@ set -e -cd clippy_lints && cargo fmt && cd .. -cargo fmt -cargo test ./util/update_lints.py +git status --short | sort | grep -v README.md | grep -v helper.txt > helper.txt + +# abort if the files differ +diff "publish.files" "helper.txt" + +rm helper.txt + +# add all changed files +git add . +git commit -m "version bump" + +set +e + +cd clippy_lints && cargo fmt -- --write-mode=overwrite && cd .. +cargo fmt -- --write-mode=overwrite + +echo "remember to add a git tag and running 'cargo test' before committing the rustfmt changes" diff --git a/publish.files b/publish.files new file mode 100644 index 00000000000..9ee50447f99 --- /dev/null +++ b/publish.files @@ -0,0 +1,3 @@ + M Cargo.toml + M CHANGELOG.md + M clippy_lints/Cargo.toml From 5aa41ffd06fb50228ad61422234a1cda10049065 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 17 Feb 2017 13:27:57 +0100 Subject: [PATCH 3/3] Choose a better commit message --- pre_publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_publish.sh b/pre_publish.sh index 656ed6eff89..ee8e51cda6b 100755 --- a/pre_publish.sh +++ b/pre_publish.sh @@ -13,7 +13,7 @@ rm helper.txt # add all changed files git add . -git commit -m "version bump" +git commit -m "Bump the version" set +e