diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..bad7935 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +default_stages: [commit] +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: detect-private-key + - id: end-of-file-fixer + verbose: true + - id: check-yaml + + - repo: local + hooks: + - id: run-spotless-format + name: run spotless format-check + language: system + entry: bash -c 'cd kbazaar && make format-check' + pass_filenames: false + stages: [pre-commit] diff --git a/.pre-push-config.yaml b/.pre-push-config.yaml new file mode 100644 index 0000000..0491007 --- /dev/null +++ b/.pre-push-config.yaml @@ -0,0 +1,9 @@ +default_stages: [push] +repos: + - repo: local + hooks: + - id: run-unit-tests + name: run unit tests + language: system + entry: bash -c 'cd kbazaar && make test' + pass_filenames: false diff --git a/kbazaar/makefile b/kbazaar/makefile index 0e49f2a..b822c50 100644 --- a/kbazaar/makefile +++ b/kbazaar/makefile @@ -1,6 +1,10 @@ build: clean ./gradlew build +setup: + pre-commit install --hook-type pre-commit --config .pre-commit-config.yaml + pre-commit install --hook-type pre-push --config .pre-push-config.yaml + clean: ./gradlew clean @@ -29,4 +33,4 @@ docker-build: docker build -t kbazaar . docker-run: - docker run -p 8080:8080 kbazaar \ No newline at end of file + docker run -p 8080:8080 kbazaar