-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: improve script and travis config
* fix a diff failure on windows See https://travis-ci.com/rust-lang/rust-clippy/jobs/245971932#L1625 for an example. * use cmp instead of diff > /dev/null * clone single branch instead of clone then checking out * do not decrypt key if have no diff change
- Loading branch information
Showing
9 changed files
with
104 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,7 @@ SSH_REPO=${REPO/https:\/\/github.com\//[email protected]:} | |
SHA=$(git rev-parse --verify HEAD) | ||
|
||
# Clone the existing gh-pages for this repo into out/ | ||
( | ||
git clone "$REPO" out | ||
cd out | ||
git checkout $TARGET_BRANCH | ||
) | ||
git clone --quiet --single-branch --branch "$TARGET_BRANCH" "$REPO" out | ||
|
||
echo "Removing the current docs for master" | ||
rm -rf out/master/ || exit 0 | ||
|
@@ -27,35 +23,41 @@ mkdir out/master/ | |
cp util/gh-pages/index.html out/master | ||
python ./util/export.py out/master/lints.json | ||
|
||
if [ -n "$TRAVIS_TAG" ]; then | ||
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 | ||
fi | ||
|
||
# Generate version index that is shown as root index page | ||
( | ||
cp util/gh-pages/versions.html out/index.html | ||
|
||
cd out | ||
python -c '\ | ||
import os, json;\ | ||
print json.dumps([\ | ||
dir for dir in os.listdir(".")\ | ||
if not dir.startswith(".") and os.path.isdir(dir)\ | ||
])' > versions.json | ||
) | ||
cp util/gh-pages/versions.html out/index.html | ||
cat <<-EOF | python - > out/versions.json | ||
import os, json | ||
print json.dumps([ | ||
dir for dir in os.listdir(".") if not dir.startswith(".") and os.path.isdir(dir) | ||
]) | ||
EOF | ||
|
||
# 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 | ||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || [[ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then | ||
# Tags should deploy | ||
if [ -z "$TRAVIS_TAG" ]; then | ||
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 "[email protected]" | ||
|
||
if git diff --exit-code --quiet; then | ||
echo "No changes to the output on this push; exiting." | ||
exit 0 | ||
fi | ||
|
||
# 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" | ||
|
@@ -64,19 +66,9 @@ 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) | ||
eval "$(ssh-agent -s)" | ||
ssh-add .github/deploy_key | ||
|
||
# Now let's go have some fun with the cloned repo | ||
cd out | ||
git config user.name "Travis CI" | ||
git config user.email "[email protected]" | ||
|
||
if [ -z "$(git diff --exit-code)" ]; 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}" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
#!/usr/bin/env bash | ||
set -x | ||
|
||
if [[ -z "${INTEGRATION}" ]]; then | ||
exit 0 | ||
fi | ||
|
||
rm ~/.cargo/bin/cargo-clippy | ||
cargo install --force --path . | ||
|
||
echo "Running integration test for crate ${INTEGRATION}" | ||
|
||
git clone --depth=1 https://github.com/${INTEGRATION}.git checkout | ||
cd checkout | ||
git clone --depth=1 "https://github.com/${INTEGRATION}.git" checkout | ||
cd checkout || exit 1 | ||
|
||
function check() { | ||
# run clippy on a project, try to be verbose and trigger as many warnings as possible for greater coverage | ||
RUST_BACKTRACE=full cargo clippy --all-targets --all-features -- --cap-lints warn -W clippy::pedantic -W clippy::nursery &> clippy_output | ||
cat clippy_output | ||
! cat clippy_output | grep -q "internal compiler error\|query stack during panic\|E0463" | ||
if [[ $? != 0 ]]; then | ||
return 1 | ||
fi | ||
} | ||
RUST_BACKTRACE=full \ | ||
cargo clippy \ | ||
--all-targets \ | ||
--all-features \ | ||
-- \ | ||
--cap-lints warn -W clippy::pedantic -W clippy::nursery \ | ||
> clippy_output 2>&1 | ||
|
||
case ${INTEGRATION} in | ||
*) | ||
check | ||
;; | ||
esac | ||
cat clippy_output | ||
if grep -q "internal compiler error\|query stack during panic\|E0463" clippy_output; then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters