Add handy scripts (#30)

* Extract test.sh and doc.sh from .travis.yml

* check.sh
This commit is contained in:
Sergey Pepyakin 2018-01-31 22:13:50 +03:00 committed by Nikolay Volf
parent 551c992730
commit 3ad9f07e93
4 changed files with 38 additions and 6 deletions

View File

@ -17,16 +17,12 @@ install:
script: script:
- export CC=/usr/bin/gcc-6 - export CC=/usr/bin/gcc-6
- export CXX=/usr/bin/g++-6 - export CXX=/usr/bin/g++-6
- cargo test --verbose - ./test.sh
- cargo test --manifest-path=spec/Cargo.toml - ./doc.sh
# cargo-deadlinks will check any links in docs generated by `cargo doc`.
# This is useful as rustdoc uses raw links which is error prone.
- cargo doc && cargo deadlinks
after_success: | after_success: |
# Build documentation and deploy it to github pages. # Build documentation and deploy it to github pages.
[ $TRAVIS_BRANCH = master ] && [ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] && [ $TRAVIS_PULL_REQUEST = false ] &&
cargo doc &&
echo "<meta http-equiv=refresh content=0;url=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 2`/index.html>" > target/doc/index.html && echo "<meta http-equiv=refresh content=0;url=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 2`/index.html>" > target/doc/index.html &&
sudo pip install ghp-import && sudo pip install ghp-import &&
ghp-import -n target/doc && ghp-import -n target/doc &&

12
check.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eux
cd $(dirname $0)
cargo check --tests
cargo check \
--manifest-path=spec/Cargo.toml \
--tests
cd -

14
doc.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -eux
cd $(dirname $0)
cargo doc
# cargo-deadlinks will check any links in docs generated by `cargo doc`.
# This is useful as rustdoc uses raw links which are error prone.
command -v cargo-deadlinks &> /dev/null &&
cargo deadlinks
cd -

10
test.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -eux
cd $(dirname $0)
time cargo test
time cargo test --manifest-path=spec/Cargo.toml
cd -