Skip to main content

Exonum precheck deployment script

Project description

Exonum deployment precheck script

exonum_precheck is a script which verifies that all the expected checks are OK for code you're about to push. It is supposed that you'll run this script before every push at the Exonum repository.

This command loads .travis.yml and performs all the checks (tests and lints) exactly as they will be performed on the CI server. Also if installed rustc version doesn't match the one in the travis config, a warning will be shown.

Prerequirements

You should have clippy, rustfmt, deadlinks, cspell and md installed:

cargo install cargo-deadlinks
rustup component add rustfmt
rustup component add clippy
npm install cspell
npm install md

Example

cd exonum_folder
python3 -m exonum_precheck

Example output (actually it's colored):

 Tests results:
 Error: cargo test --all
 Success: cargo run -p exonum --example explorer
 Success: cargo run -p exonum-testkit --example timestamping
 Success: cargo run -p exonum-time --example simple_service
 Lints results:
 Success: npm run cspell
 Success: npm run md
 Success: cargo clippy --all --benches --features "long_benchmarks"
 Success: cargo fmt --all -- --check
 Success: cargo clean --doc
 Success: cargo doc --no-deps
 Success: mkdir -p target/doc/exonum_configuration
 Success: mkdir -p target/std/string
 Success: touch target/std/string/struct.String.html
 Success: touch target/std/primitive.usize.html
 Success: touch target/doc/enum.HashTag.html
 Success: cargo deadlinks --dir target/doc

You can also specify jobs to run manually.

python3 -m exonum_precheck --jobs linux-tests sample-job lints tests

Those jobs will be executed instead of default ones ("unit-test", "lints") in the provided order.

This maybe helpful if you want to use this script on another repository.

Using as a git hook

This script can be also used as a prepush hook:

echo '#!/bin/sh\npython3 -m exonum_precheck || exit 1\n' > ./exonum_folder/.git/hooks/pre-push
chmod +x ./exonum_folder/.git/hooks/pre-push

With that hook you won't be able to push unless all the expected CI checks are passed. However, be careful: if you're going to work on a work-in-progress branch which'll have broken tests, you'll have to temporary remove the hook.

Example of more advanced hook:

#!/bin/sh
npm install && git checkout package-lock.json package.json

export RUST_BACKTRACE=0
export RUST_LOG=off
export RUST_TEST_THREADS=4
export CARGO_BUILD_JOBS=4
ulimit -n 2048

python3 -m exonum_precheck || exit 1

Installing

Install and update using pip:

pip install -U exonum_precheck

LICENSE

exonum_precheck is licensed under the MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for exonum-precheck, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size exonum_precheck-0.1.5-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size exonum_precheck-0.1.5.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page