mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-25 06:00:34 +00:00
build: add git pre-push hooks using cargo-husky (#274)
Fixes https://github.com/tui-rs-revival/ratatui/issues/214 - add cargo-husky to dev-deps - create hook - update `CONTRIBUTING.md` - ensure that the hook is not installed in CI
This commit is contained in:
parent
b808305507
commit
669a4d5652
4 changed files with 23 additions and 1 deletions
16
.cargo-husky/hooks/pre-push
Executable file
16
.cargo-husky/hooks/pre-push
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if !(command cargo-make >/dev/null 2>&1); then # Check if cargo-make is installed
|
||||
echo Attempting to run cargo-make as part of the pre-push hook but it\'s not installed.
|
||||
echo Please install it by running the following command:
|
||||
echo
|
||||
echo " cargo install --force cargo-make"
|
||||
echo
|
||||
echo If you don\'t want to run cargo-make as part of the pre-push hook, you can run
|
||||
echo the following command instead of git push:
|
||||
echo
|
||||
echo " git push --no-verify"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cargo make ci
|
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -37,6 +37,7 @@ jobs:
|
|||
run: cargo make ci
|
||||
env:
|
||||
RUST_BACKTRACE: full
|
||||
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -71,6 +72,8 @@ jobs:
|
|||
uses: taiki-e/install-action@cargo-llvm-cov
|
||||
- name: cargo llvm-cov
|
||||
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
|
||||
env:
|
||||
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
|
||||
- name: Upload to codecov.io
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
|
|
|
@ -48,6 +48,8 @@ Any idea with a large scale impact on the crate or its users should ideally be d
|
|||
To avoid any issues that may arrise with the CI/CD by not following the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) syntax, we recommend to install [Commitizen](https://commitizen-tools.github.io/commitizen/).\
|
||||
By using this tool you automatically follow the configuration defined in [.cz.toml](.cz.toml).
|
||||
|
||||
Additionally, we're using [cargo-husky](https://github.com/rhysd/cargo-husky) to automatically load pre-push hook, which will run `cargo make ci` before each push. It will load the hook automatically when you run `cargo test`. If `cargo-make` is not installed, it will install it for you.\
|
||||
This will ensure that your code is formatted, compiles and passes all tests before you push. If you want to skip this check, you can use `git push --no-verify`.
|
||||
|
||||
## Continuous Integration
|
||||
|
||||
|
|
|
@ -48,10 +48,11 @@ unicode-width = "0.1"
|
|||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.71"
|
||||
rand = "0.8"
|
||||
argh = "0.1"
|
||||
cargo-husky = { version = "1.5.0", default-features = false, features = ["user-hooks"] }
|
||||
criterion = { version = "0.5", features = ["html_reports"] }
|
||||
fakeit = "1.1"
|
||||
rand = "0.8"
|
||||
|
||||
[[bench]]
|
||||
name = "paragraph"
|
||||
|
|
Loading…
Reference in a new issue