From 9eeafecd76e2f9ee74172a7b9e4c86435cbc5d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 18:17:54 +0200 Subject: [PATCH 01/11] Build & Scripts optimization --- .travis.yml | 101 ++++++++++++++----------------------------------- add_license.sh | 6 --- cov.sh | 43 --------------------- doc.sh | 14 ------- fmt.sh | 16 -------- hook.sh | 12 ------ test.sh | 27 +++++++------ 7 files changed, 44 insertions(+), 175 deletions(-) delete mode 100755 add_license.sh delete mode 100755 cov.sh delete mode 100755 doc.sh delete mode 100755 fmt.sh delete mode 100755 hook.sh diff --git a/.travis.yml b/.travis.yml index d051971bc..91a5dd5b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: required dist: trusty language: rust branches: @@ -8,45 +7,33 @@ branches: - /^stable-.*$/ - /^beta$/ - /^stable$/ + git: depth: 3 + matrix: - fast_finish: true - allow_failures: - - rust: nightly include: - rust: stable env: FEATURES="--features travis-beta" RUN_TESTS="true" - # - rust: beta - # env: FEATURES="--features travis-beta" RUN_TESTS="true" - - rust: stable - env: FEATURES="--features travis-beta" RUN_BUILD="true" - rust: beta - env: FEATURES="--features travis-beta" RUN_BUILD="true" - - rust: stable env: FEATURES="--features travis-beta" RUN_COVERAGE="true" - # - rust: nightly - # env: FEATURES="--features travis-nightly" RUN_BENCHES="true" - - rust: nightly - env: FEATURES="--features travis-nightly" RUN_TESTS="true" + env: global: - # GH_TOKEN - - secure: bumJASbZSU8bxJ0EyPUJmu16AiV9EXOpyOj86Jlq/Ty9CfwGqsSXt96uDyE+OUJf34RUFQMsw0nk37/zC4lcn6kqk2wpuH3N/o85Zo/cVZY/NusBWLQqtT5VbYWsV+u2Ua4Tmmsw8yVYQhYwU2ZOejNpflL+Cs9XGgORp1L+/gMRMC2y5Se6ZhwnKPQlRJ8LGsG1dzjQULxzADIt3/zuspNBS8a2urJwlHfGMkvHDoUWCviP/GXoSqw3TZR7FmKyxE19I8n9+iSvm9+oZZquvcgfUxMHn8Gq/b44UbPvjtFOg2yam4xdWXF/RyWCHdc/R9EHorSABeCbefIsm+zcUF3/YQxwpSxM4IZEeH2rTiC7dcrsKw3XsO16xFQz5YI5Bay+CT/wTdMmJd7DdYz7Dyf+pOvcM9WOf/zorxYWSBOMYy0uzbusU2iyIghQ82s7E/Ahg+WARtPgkuTLSB5aL1oCTBKHqQscMr7lo5Ti6RpWLxEdTQMBznc+bMr+6dEtkEcG9zqc6cE9XX+ox3wTU6+HVMfQ1ltCntJ4UKcw3A6INEbw9wgocQa812CIASQ2fE+SCAbz6JxBjIAlFUnD1lUB7S8PdMPwn9plfQgKQ2A5YZqg6FnBdf0rQXIJYxQWKHXj/rBHSUCT0tHACDlzTA+EwWggvkP5AGIxRxm8jhw= - - TARGETS="-p ethkey -p ethstore -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethjson -p ethcore-dapps -p ethcore-signer -p bigint" - - ARCHIVE_SUFFIX="-${TRAVIS_OS_NAME}-${TRAVIS_TAG}" - - KCOV_FEATURES="" - - KCOV_CMD="./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /usr/,/.cargo,/root/.multirust,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests target/kcov" + - RUST_BACKTRACE="1" - RUN_TESTS="false" - RUN_COVERAGE="false" - - RUN_BUILD="false" - - RUN_BENCHES="false" - - RUST_BACKTRACE="1" + # GH_TOKEN for documentation + - secure: bumJASbZSU8bxJ0EyPUJmu16AiV9EXOpyOj86Jlq/Ty9CfwGqsSXt96uDyE+OUJf34RUFQMsw0nk37/zC4lcn6kqk2wpuH3N/o85Zo/cVZY/NusBWLQqtT5VbYWsV+u2Ua4Tmmsw8yVYQhYwU2ZOejNpflL+Cs9XGgORp1L+/gMRMC2y5Se6ZhwnKPQlRJ8LGsG1dzjQULxzADIt3/zuspNBS8a2urJwlHfGMkvHDoUWCviP/GXoSqw3TZR7FmKyxE19I8n9+iSvm9+oZZquvcgfUxMHn8Gq/b44UbPvjtFOg2yam4xdWXF/RyWCHdc/R9EHorSABeCbefIsm+zcUF3/YQxwpSxM4IZEeH2rTiC7dcrsKw3XsO16xFQz5YI5Bay+CT/wTdMmJd7DdYz7Dyf+pOvcM9WOf/zorxYWSBOMYy0uzbusU2iyIghQ82s7E/Ahg+WARtPgkuTLSB5aL1oCTBKHqQscMr7lo5Ti6RpWLxEdTQMBznc+bMr+6dEtkEcG9zqc6cE9XX+ox3wTU6+HVMfQ1ltCntJ4UKcw3A6INEbw9wgocQa812CIASQ2fE+SCAbz6JxBjIAlFUnD1lUB7S8PdMPwn9plfQgKQ2A5YZqg6FnBdf0rQXIJYxQWKHXj/rBHSUCT0tHACDlzTA+EwWggvkP5AGIxRxm8jhw= + - KCOV_CMD="./kcov-master/tmp/usr/local/bin/kcov" + cache: apt: true directories: - $TRAVIS_BUILD_DIR/target + - $TRAVIS_BUILD_DIR/kcov-master - $HOME/.cargo + addons: apt: packages: @@ -55,54 +42,24 @@ addons: - libdw-dev script: - - if [ "$RUN_TESTS" = "true" ]; then cargo test --release --verbose ${FEATURES} ${TARGETS}; fi - - if [ "$RUN_BENCHES" = "true" ]; then cargo bench --no-run ${FEATURES} ${TARGETS}; fi - - if [ "$RUN_BUILD" = "true" ]; then cargo build --release --verbose ${FEATURES}; fi - - if [ "$RUN_BUILD" = "true" ]; then tar cvzf parity${ARCHIVE_SUFFIX}.tar.gz -C target/release parity; fi + - if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi -after_success: | - [ "$RUN_COVERAGE" = "true" ] && - wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && - tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && cd ../.. && - cargo test --no-run ${KCOV_FEATURES} ${TARGETS} && - $KCOV_CMD target/debug/deps/ethkey-* && - $KCOV_CMD target/debug/deps/ethstore-* && - $KCOV_CMD target/debug/deps/ethcore_util-* && - $KCOV_CMD target/debug/deps/ethash-* && - $KCOV_CMD target/debug/deps/ethcore-* && - $KCOV_CMD target/debug/deps/ethsync-* && - $KCOV_CMD target/debug/deps/ethcore_rpc-* && - $KCOV_CMD target/debug/deps/ethcore_dapps-* && - $KCOV_CMD target/debug/deps/ethcore_signer-* && - $KCOV_CMD target/debug/deps/ethjson-* && - $KCOV_CMD target/debug/parity-* && - [ $TRAVIS_BRANCH = master ] && - [ $TRAVIS_PULL_REQUEST = false ] && - [ $TRAVIS_RUST_VERSION = stable ] && - cargo doc --no-deps --verbose ${KCOV_FEATURES} ${TARGETS} && - echo '' > target/doc/index.html && - pip install --user ghp-import && - /home/travis/.local/bin/ghp-import -n target/doc && - git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages +install: + - [ "$RUN_COVERAGE" = "true" ] && + wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && + tar xzf master.tar.gz && + mkdir kcov-master/build && + cd kcov-master/build && + cmake .. && + make && make install DESTDIR=../tmp && + cd ../.. -deploy: - provider: releases - api_key: - secure: "t+oGT/4lsy7IScw5s86Dpntl5Nyck4qG6nhHwMScc6FYzwLldgwgJaafL8Ej+HG+b7nFLriN+Snoa4YQ5o74X5ZlSWubVREOYQlL/fq7vcPB0DwAZ0Jufq1QW2R1M+3SwwF1eAwTv2W3G7A2K7dxjCVvENcy/gdxnZ36NeUPsqaCC9UcI2Yc7+4jyQwvx6ZfBvQeu+HbKENA0eUNs2ZQOID/1IPy0LJBvSyxAQYsysXdjTzGdNu4+Iba20E8uWYe4fAbgz+gwGarXg1L6D6gKyMlWkViqWjvXWBuDJJqMQZ3rw41AwZOoh3mKd2Lc0l6l4oZcEqPuob0yKTNjz1tuJy9xKTC2F2bDzsvUgk1IRfMK5ukXXXS09ZCZWuA9/GtnsqJ1xGTiwX+DhQzpVBHaBiseSNlYE1YN/3jNyGY+iSts1qut+1BwE7swmcTLsAPoAy8Ue+f7ErNoCg1lm71vq7VO2DLn7x2NqHyHUEuJ+7olDHSdE84G7d9otDRu/+TfMOw7GXwTaha6yJRInuNsnj4CFMLNVvYACzCC2idB7f7nUZoSFi9jf18S9fCMPVmazMrFj4g95HWrVHkjpV5zRTeUdTWw6DJl6pC9HFqORHdCvLv4Rc4dm5r3CmOcAQ0ZuiccV2oKzw4/Wic96daae8M5f5KSQ/WTr+h0wXZKp0=" - skip_cleanup: true - file: parity${ARCHIVE_SUFFIX}.tar.gz - on: - tags: true - -notifications: - webhooks: - urls: - - https://hooks.slack.com/services/${SLACK_WEBHOOK} - on_success: always - on_failure: always - on_start: never - -notifications: - slack: - rooms: - - ethcore:4EGxt9WP6AS7uX4JKXSfR9vi#chatops +after_success: + - [ "$RUN_COVERAGE" = "true" ] && ./scripts/cov.sh "$KCOV_CMD" + - [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + [ $TRAVIS_RUST_VERSION = stable ] && + ./scripts/doc.sh && + pip install --user ghp-import && + /home/travis/.local/bin/ghp-import -n target/doc && + git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages diff --git a/add_license.sh b/add_license.sh deleted file mode 100755 index 1d916f427..000000000 --- a/add_license.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -for f in $(find . -name '*.rs'); do - cat license_header $f > $f.new - mv $f.new $f -done diff --git a/cov.sh b/cov.sh deleted file mode 100755 index 8de2264c0..000000000 --- a/cov.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# Installing KCOV under ubuntu -# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650# -### Install deps -# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev -# -### Compile kcov -# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz -# $ cd kcov-master && mkdir build && cd build -# $ cmake .. && make && sudo make install - -### Running coverage -if ! type kcov > /dev/null; then - echo "Install kcov first (details inside this file). Aborting." - exit 1 -fi - -cargo test \ - -p ethkey \ - -p ethstore \ - -p ethash \ - -p ethcore-util \ - -p ethcore \ - -p ethsync \ - -p ethcore-rpc \ - -p parity \ - -p ethcore-signer \ - -p ethcore-dapps \ - --no-run || exit $? -rm -rf target/coverage -mkdir -p target/coverage - -EXCLUDE="~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests" -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethkey-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethstore-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethash-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_util-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethsync-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_rpc-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_signer-* -kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_dapps-* -xdg-open target/coverage/index.html diff --git a/doc.sh b/doc.sh deleted file mode 100755 index 41251f7a8..000000000 --- a/doc.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# generate documentation only for partiy and ethcore libraries - -cargo doc --no-deps --verbose \ - -p ethkey \ - -p ethstore \ - -p ethash \ - -p ethcore-util \ - -p ethcore \ - -p ethsync \ - -p ethcore-rpc \ - -p ethcore-signer \ - -p ethcore-dapps \ - -p parity \ diff --git a/fmt.sh b/fmt.sh deleted file mode 100755 index 624b404ff..000000000 --- a/fmt.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -RUSTFMT="rustfmt --write-mode overwrite" - -$RUSTFMT ./ethash/src/lib.rs -$RUSTFMT ./ethcore/src/lib.rs -$RUSTFMT ./evmjit/src/lib.rs -$RUSTFMT ./json/src/lib.rs -$RUSTFMT ./miner/src/lib.rs -$RUSTFMT ./parity/main.rs -$RUSTFMT ./rpc/src/lib.rs -$RUSTFMT ./signer/src/lib.rs -$RUSTFMT ./dapps/src/lib.rs -$RUSTFMT ./sync/src/lib.rs -$RUSTFMT ./util/src/lib.rs - diff --git a/hook.sh b/hook.sh deleted file mode 100755 index 9ce825f80..000000000 --- a/hook.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -FILE=./.git/hooks/pre-push -echo "#!/bin/sh\n" > $FILE -# Exit on any error -echo "set -e" >> $FILE -# Run release build -echo "cargo build --features dev" >> $FILE -# Build tests -echo "cargo test --no-run --features dev \\" >> $FILE -echo " -p ethkey -p ethstore -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethcore-dapps -p ethcore-signer" >> $FILE -echo "" >> $FILE -chmod +x $FILE diff --git a/test.sh b/test.sh index a62c835e8..0de4d758c 100755 --- a/test.sh +++ b/test.sh @@ -1,15 +1,18 @@ #!/bin/sh # Running Parity Full Test Sute -cargo test --features ethcore/json-tests $1 \ - -p ethkey \ - -p ethstore \ - -p ethash \ - -p ethcore-util \ - -p ethcore \ - -p ethsync \ - -p ethcore-rpc \ - -p ethcore-signer \ - -p ethcore-dapps \ - -p parity \ - -p bigint +FEATURES="--features ethcore/json-tests" + +case $1 in + --no-json) + FEATURES="" + shift # past argument=value + ;; + *) + # unknown option + ;; +esac + +. ./scripts/targets.sh +cargo test $FEATURES $TARGETS $1 \ + From 248428657d6731534abcb24a8eed8910c0955b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 18:23:24 +0200 Subject: [PATCH 02/11] Fixing travis.yml --- .editorconfig | 5 +++++ .travis.yml | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.editorconfig b/.editorconfig index 0ac22f073..28b112186 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,3 +9,8 @@ trim_trailing_whitespace=true max_line_length=120 insert_final_newline=true +[.travis.yml] +indent_style=space +indent_size=2 +tab_width=8 +end_of_line=lf diff --git a/.travis.yml b/.travis.yml index 91a5dd5b9..f3cbb4f45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,22 +44,22 @@ addons: script: - if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi -install: - - [ "$RUN_COVERAGE" = "true" ] && - wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && - tar xzf master.tar.gz && - mkdir kcov-master/build && - cd kcov-master/build && - cmake .. && - make && make install DESTDIR=../tmp && - cd ../.. +install: | + [ "$RUN_COVERAGE" = "true" ] && + wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && + tar xzf master.tar.gz && + mkdir kcov-master/build && + cd kcov-master/build && + cmake .. && + make && make install DESTDIR=../tmp && + cd ../.. after_success: - - [ "$RUN_COVERAGE" = "true" ] && ./scripts/cov.sh "$KCOV_CMD" - - [ $TRAVIS_BRANCH = master ] && - [ $TRAVIS_PULL_REQUEST = false ] && - [ $TRAVIS_RUST_VERSION = stable ] && - ./scripts/doc.sh && - pip install --user ghp-import && - /home/travis/.local/bin/ghp-import -n target/doc && - git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages + - true && [ "$RUN_COVERAGE" = "true" ] && ./scripts/cov.sh "$KCOV_CMD" + - true && [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + [ $TRAVIS_RUST_VERSION = stable ] && + ./scripts/doc.sh && + pip install --user ghp-import && + /home/travis/.local/bin/ghp-import -n target/doc && + git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages From d65a1d2b2a47576d557b3c3783befabf40829167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 18:30:58 +0200 Subject: [PATCH 03/11] Fixing coverage script. --- .travis.yml | 8 ++++---- scripts/add_license.sh | 6 ++++++ scripts/cov.sh | 39 +++++++++++++++++++++++++++++++++++++++ scripts/doc.sh | 7 +++++++ scripts/fmt.sh | 16 ++++++++++++++++ scripts/hook.sh | 14 ++++++++++++++ scripts/targets.sh | 14 ++++++++++++++ 7 files changed, 100 insertions(+), 4 deletions(-) create mode 100755 scripts/add_license.sh create mode 100755 scripts/cov.sh create mode 100755 scripts/doc.sh create mode 100755 scripts/fmt.sh create mode 100755 scripts/hook.sh create mode 100644 scripts/targets.sh diff --git a/.travis.yml b/.travis.yml index f3cbb4f45..7a741b287 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,14 +45,14 @@ script: - if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi install: | - [ "$RUN_COVERAGE" = "true" ] && - wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && + [ "$RUN_COVERAGE" = "false" ] || + (wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xzf master.tar.gz && - mkdir kcov-master/build && + mkdir -p kcov-master/build && cd kcov-master/build && cmake .. && make && make install DESTDIR=../tmp && - cd ../.. + cd) after_success: - true && [ "$RUN_COVERAGE" = "true" ] && ./scripts/cov.sh "$KCOV_CMD" diff --git a/scripts/add_license.sh b/scripts/add_license.sh new file mode 100755 index 000000000..1d916f427 --- /dev/null +++ b/scripts/add_license.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +for f in $(find . -name '*.rs'); do + cat license_header $f > $f.new + mv $f.new $f +done diff --git a/scripts/cov.sh b/scripts/cov.sh new file mode 100755 index 000000000..8b49607e5 --- /dev/null +++ b/scripts/cov.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Installing KCOV under ubuntu +# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650# +### Install deps +# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev +# +### Compile kcov +# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz +# $ cd kcov-master && mkdir build && cd build +# $ cmake .. && make && sudo make install + +### Running coverage + +KCOV_CMD=${1:-kcov} + +if ! type $KCOV_CMD > /dev/null; then + echo "Install kcov first (details inside this file). Aborting." + exit 1 +fi + +. ./scripts/targets.sh + +cargo test $TARGETS --no-run || exit $? +rm -rf target/coverage +mkdir -p target/coverage + +EXCLUDE="~/.multirust,rocksdb,secp256k1,/usr/,/.cargo,/root/.multirust,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests target/kcov" +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethkey-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethstore-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethash-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_util-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethsync-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_rpc-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_signer-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_dapps-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethjson-* +$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/parity-* +xdg-open target/coverage/index.html diff --git a/scripts/doc.sh b/scripts/doc.sh new file mode 100755 index 000000000..657f47567 --- /dev/null +++ b/scripts/doc.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# generate documentation only for partiy and ethcore libraries + +. ./scripts/targets.sh + +cargo doc --no-deps --verbose $TARGETS && + echo '' > target/doc/index.html diff --git a/scripts/fmt.sh b/scripts/fmt.sh new file mode 100755 index 000000000..624b404ff --- /dev/null +++ b/scripts/fmt.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +RUSTFMT="rustfmt --write-mode overwrite" + +$RUSTFMT ./ethash/src/lib.rs +$RUSTFMT ./ethcore/src/lib.rs +$RUSTFMT ./evmjit/src/lib.rs +$RUSTFMT ./json/src/lib.rs +$RUSTFMT ./miner/src/lib.rs +$RUSTFMT ./parity/main.rs +$RUSTFMT ./rpc/src/lib.rs +$RUSTFMT ./signer/src/lib.rs +$RUSTFMT ./dapps/src/lib.rs +$RUSTFMT ./sync/src/lib.rs +$RUSTFMT ./util/src/lib.rs + diff --git a/scripts/hook.sh b/scripts/hook.sh new file mode 100755 index 000000000..9b5512ac0 --- /dev/null +++ b/scripts/hook.sh @@ -0,0 +1,14 @@ +#!/bin/sh +FILE=./.git/hooks/pre-push +. ./scripts/targets.sh + +echo "#!/bin/sh\n" > $FILE +# Exit on any error +echo "set -e" >> $FILE +# Run release build +echo "cargo build --features dev" >> $FILE +# Build tests +echo "cargo test --no-run --features dev \\" >> $FILE +echo $TARGETS >> $FILE +echo "" >> $FILE +chmod +x $FILE diff --git a/scripts/targets.sh b/scripts/targets.sh new file mode 100644 index 000000000..4c2b7ca68 --- /dev/null +++ b/scripts/targets.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +export TARGETS=" + -p ethkey \ + -p ethstore \ + -p ethash \ + -p ethcore-util \ + -p ethcore \ + -p ethsync \ + -p ethcore-rpc \ + -p ethcore-signer \ + -p ethcore-dapps \ + -p parity \ + -p bigint" From ab1c6cd65574b744145d0b37d00dec27ce288991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 18:47:58 +0200 Subject: [PATCH 04/11] New GCC --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7a741b287..5dd844b10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,8 @@ matrix: env: global: + - CXX="g++-4.8" + - CC="gcc-4.8" - RUST_BACKTRACE="1" - RUN_TESTS="false" - RUN_COVERAGE="false" @@ -36,10 +38,14 @@ cache: addons: apt: + sources: + - ubuntu-toolchain-r-test packages: - libcurl4-openssl-dev - libelf-dev - libdw-dev + - gcc-4.8 + - g++-4.8 script: - if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi From 3159e20814ecd21db57dbc8a821c11b6c5b6d097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 18:56:28 +0200 Subject: [PATCH 05/11] Build fixes --- .travis.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5dd844b10..d9aa5965c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,9 +47,6 @@ addons: - gcc-4.8 - g++-4.8 -script: - - if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi - install: | [ "$RUN_COVERAGE" = "false" ] || (wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && @@ -60,12 +57,15 @@ install: | make && make install DESTDIR=../tmp && cd) -after_success: - - true && [ "$RUN_COVERAGE" = "true" ] && ./scripts/cov.sh "$KCOV_CMD" - - true && [ $TRAVIS_BRANCH = master ] && - [ $TRAVIS_PULL_REQUEST = false ] && - [ $TRAVIS_RUST_VERSION = stable ] && - ./scripts/doc.sh && - pip install --user ghp-import && - /home/travis/.local/bin/ghp-import -n target/doc && - git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages +script: + - if [ "$RUN_TESTS" = "true" ]; then ./test.sh; fi + - if [ "$RUN_COVERAGE" = "true" ]; then ./scripts/cov.sh "$KCOV_CMD"; fi + +after_success: | + [ $TRAVIS_BRANCH = master ] && + [ $TRAVIS_PULL_REQUEST = false ] && + [ $TRAVIS_RUST_VERSION = stable ] && + ./scripts/doc.sh && + pip install --user ghp-import && + /home/travis/.local/bin/ghp-import -n target/doc && + git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages From d9aeafa40eafbc473f6d18931a612d67e7135c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 19:11:42 +0200 Subject: [PATCH 06/11] Removing --verify [ci skip] --- scripts/cov.sh | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/scripts/cov.sh b/scripts/cov.sh index 8b49607e5..927afe5f0 100755 --- a/scripts/cov.sh +++ b/scripts/cov.sh @@ -10,30 +10,34 @@ # $ cmake .. && make && sudo make install ### Running coverage - -KCOV_CMD=${1:-kcov} - -if ! type $KCOV_CMD > /dev/null; then +if ! type kcov > /dev/null; then echo "Install kcov first (details inside this file). Aborting." exit 1 fi -. ./scripts/targets.sh - -cargo test $TARGETS --no-run || exit $? +cargo test \ + -p ethkey \ + -p ethstore \ + -p ethash \ + -p ethcore-util \ + -p ethcore \ + -p ethsync \ + -p ethcore-rpc \ + -p parity \ + -p ethcore-signer \ + -p ethcore-dapps \ + --no-run || exit $? rm -rf target/coverage mkdir -p target/coverage -EXCLUDE="~/.multirust,rocksdb,secp256k1,/usr/,/.cargo,/root/.multirust,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests target/kcov" -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethkey-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethstore-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethash-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_util-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethsync-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_rpc-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_signer-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_dapps-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethjson-* -$KCOV_CMD --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/parity-* +EXCLUDE="~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests" +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethkey-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethstore-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethash-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_util-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethsync-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_rpc-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_signer-* +kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_dapps-* xdg-open target/coverage/index.html From cb2ace82db96ee86140004f33d56ea977594a022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 19:20:48 +0200 Subject: [PATCH 07/11] Uploading to coveralls --- scripts/cov.sh | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/scripts/cov.sh b/scripts/cov.sh index 927afe5f0..01caa35c3 100755 --- a/scripts/cov.sh +++ b/scripts/cov.sh @@ -10,34 +10,29 @@ # $ cmake .. && make && sudo make install ### Running coverage -if ! type kcov > /dev/null; then + +KCOV=${1:-kcov} + +if ! type $KCOV > /dev/null; then echo "Install kcov first (details inside this file). Aborting." exit 1 fi -cargo test \ - -p ethkey \ - -p ethstore \ - -p ethash \ - -p ethcore-util \ - -p ethcore \ - -p ethsync \ - -p ethcore-rpc \ - -p parity \ - -p ethcore-signer \ - -p ethcore-dapps \ - --no-run || exit $? -rm -rf target/coverage -mkdir -p target/coverage +. ./scripts/targets.sh + +cargo test $TARGETS --no-run || exit $? +rm -rf target/kcov +mkdir -p target/kcov EXCLUDE="~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests" -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethkey-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethstore-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethash-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_util-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethsync-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_rpc-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_signer-* -kcov --exclude-pattern $EXCLUDE --include-pattern src target/coverage target/debug/deps/ethcore_dapps-* -xdg-open target/coverage/index.html +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethkey-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethstore-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethash-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_util-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethsync-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_rpc-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_signer-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_dapps-* +$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethjson-* +$KCOV --coveralls-id=${TRAVIS_JOB_ID} --exclude-pattern $EXCLUDE target/kcov target/debug/parity-* From 29a2238299020a21a311bb5790bb639fbf3d176f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 11 Jul 2016 19:53:26 +0200 Subject: [PATCH 08/11] Going back to standard builds --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d9aa5965c..9f3bd5e7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: required dist: trusty language: rust branches: From fd6d66fc86914dc2d5a07a9ff2c2a0ee818e4fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 12 Jul 2016 10:30:59 +0200 Subject: [PATCH 09/11] Fixing coverage reports --- scripts/cov.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/cov.sh b/scripts/cov.sh index 01caa35c3..f94a2fda9 100755 --- a/scripts/cov.sh +++ b/scripts/cov.sh @@ -24,7 +24,7 @@ cargo test $TARGETS --no-run || exit $? rm -rf target/kcov mkdir -p target/kcov -EXCLUDE="~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests" +EXCLUDE="~/.cargo,~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests" $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethkey-* $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethstore-* $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore-* @@ -34,5 +34,6 @@ $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/ $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_rpc-* $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_signer-* $KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_dapps-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethjson-* $KCOV --coveralls-id=${TRAVIS_JOB_ID} --exclude-pattern $EXCLUDE target/kcov target/debug/parity-* + +exit 0 From c3925a494d640ade2b4573e25984116b2f7529ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 12 Jul 2016 13:25:55 +0200 Subject: [PATCH 10/11] Fixing coverage reports generation --- scripts/cov.sh | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/scripts/cov.sh b/scripts/cov.sh index f94a2fda9..690b67ded 100755 --- a/scripts/cov.sh +++ b/scripts/cov.sh @@ -11,6 +11,8 @@ ### Running coverage +set -x + KCOV=${1:-kcov} if ! type $KCOV > /dev/null; then @@ -19,21 +21,34 @@ if ! type $KCOV > /dev/null; then fi . ./scripts/targets.sh - cargo test $TARGETS --no-run || exit $? -rm -rf target/kcov -mkdir -p target/kcov -EXCLUDE="~/.cargo,~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests" -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethkey-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethstore-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethash-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_util-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethsync-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_rpc-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_signer-* -$KCOV --exclude-pattern $EXCLUDE --include-pattern src target/kcov target/debug/deps/ethcore_dapps-* -$KCOV --coveralls-id=${TRAVIS_JOB_ID} --exclude-pattern $EXCLUDE target/kcov target/debug/parity-* + + +KCOV_TARGET="target/kcov" +KCOV_FLAGS="--verify" +EXCLUDE="\ + /usr/lib,\ + /usr/include,\ + $HOME/.cargo,\ + $HOME/.multirust,\ + rocksdb,\ + secp256k1,\ + src/tests,\ + util/json-tests,\ + util/src/network/tests,\ + ethcore/src/evm/tests,\ + ethstore/tests\ +" + +rm -rf $KCOV_TARGET +mkdir -p $KCOV_TARGET + +for FILE in `find target/debug/deps ! -name "*.*"` +do + $KCOV --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET $FILE +done + +$KCOV --coveralls-id=${TRAVIS_JOB_ID} --exclude-pattern $EXCLUDE $KCOV_FLAGS $KCOV_TARGET target/debug/parity-* exit 0 From a784240734e4259fb2be7b78ea4e0243683cc41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 12 Jul 2016 16:22:05 +0200 Subject: [PATCH 11/11] Fixing formatting for coverage --- scripts/cov.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/cov.sh b/scripts/cov.sh index 690b67ded..49ef97c09 100755 --- a/scripts/cov.sh +++ b/scripts/cov.sh @@ -27,18 +27,17 @@ cargo test $TARGETS --no-run || exit $? KCOV_TARGET="target/kcov" KCOV_FLAGS="--verify" -EXCLUDE="\ - /usr/lib,\ - /usr/include,\ - $HOME/.cargo,\ - $HOME/.multirust,\ - rocksdb,\ - secp256k1,\ - src/tests,\ - util/json-tests,\ - util/src/network/tests,\ - ethcore/src/evm/tests,\ - ethstore/tests\ +EXCLUDE="/usr/lib,\ +/usr/include,\ +$HOME/.cargo,\ +$HOME/.multirust,\ +rocksdb,\ +secp256k1,\ +src/tests,\ +util/json-tests,\ +util/src/network/tests,\ +ethcore/src/evm/tests,\ +ethstore/tests\ " rm -rf $KCOV_TARGET