rust-gamedig/.pre-commit-config.yaml
Tom b3a29b15b1
[CI] Improvement and fixes (#161)
* protocols: Fix building without the "games" feature

* crate/lib: Add required features for examples

This prevents cargo from running the examples if the required features
aren't enabled.

* ci: Run if ANY Cargo.toml files are changed

* ci: Make sure to run unit tests

* ci: Separate checks for library and CLI

* ci: Add slightly better comments

* ci: Only run deeper tests for CLI or LIB when their files were changed

* ci: Improve act arguments for testing actions locally

* ci: Fix pre-commit not running tests

* ci: Only update shared cache after the initial build

* ci: Make sure that rustup downloads get cached

* tidy: Clean up file formatting

* ci: Fix issue with audit
2023-11-25 00:34:26 +02:00

60 lines
1.8 KiB
YAML

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: clippy
name: Check clippy
language: system
files: '[.]rs$'
pass_filenames: false
entry: rustup run --install nightly-2023-07-09 cargo-clippy -- --workspace --all-features -- -D warnings
- id: build-no-features
name: Check crate build with no features
language: system
files: '[.]rs$'
pass_filenames: false
entry: cargo check --workspace --no-default-features
- id: build-all-features
name: Check crate builds with all features
language: system
files: '[.]rs$'
pass_filenames: false
entry: cargo check --workspace --all-features --lib --bins --examples
- id: test
name: Check tests pass
language: system
files: '[.]rs$'
pass_filenames: false
entry: cargo test --workspace --bins --lib --examples --tests --all-features
- id: format
name: Check rustfmt
language: system
files: '[.]rs$'
pass_filenames: false
entry: rustup run --install nightly-2023-07-09 cargo-fmt --check
- id: msrv
name: Check MSRV compiles (lib only)
language: system
files: '[.]rs$'
pass_filenames: false
entry: rustup run --install 1.65 cargo check -p gamedig
- id: docs
name: Check rustdoc compiles
language: system
files: '[.]rs$'
pass_filenames: false
entry: env RUSTDOCFLAGS="-D warnings" cargo doc
- id: actions
name: Check actions work
language: system
files: '^[.]github/workflows/'
pass_filenames: false
entry: act --rm