diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..170a986 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +default_install_hook_types: [pre-commit, pre-push] +repos: + - repo: local + hooks: + - id: mkdocs-build + name: mkdocs build + language: python + additional_dependencies: [mkdocs-material] + entry: bash -c 'mkdocs build -q; rc=$?; rm -rf site; exit $rc' + pass_filenames: false + always_run: true + stages: [pre-commit] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..57d9c51 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +# Contributing + +## Development + +Run `pre-commit install` once per clone to install the commit and push hooks. + +- Commit hooks build the docs with mkdocs, matching CI. +- Run everything with `pre-commit run --all-files --hook-stage pre-push`. diff --git a/README.md b/README.md index c9f16d1..b7ca9ff 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,10 @@ mkdocs serve # http://127.0.0.1:8000 1. Add the repo name to the `for repo in ...` list in the `sync-readmes` job. 2. Add a nav entry to `mkdocs.yml` and a card to `docs/index.md`. 3. Run the workflow with `workflow_dispatch`. + +## Development + +Run `pre-commit install` once per clone to install the commit and push hooks. + +- Commit hooks build the docs with mkdocs, matching CI. +- Run everything with `pre-commit run --all-files --hook-stage pre-push`.