From a9675a16e431aa8d23923a086eb64c966379ea80 Mon Sep 17 00:00:00 2001 From: Nong AnuchitO Date: Fri, 22 Mar 2024 19:32:55 +0700 Subject: [PATCH] precommit, pre push --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ .pre-push-config.yaml | 9 +++++++++ kbazaar/makefile | 6 +++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml create mode 100644 .pre-push-config.yaml 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