From ea237f27a5b6fc40b1616eae092e97ba4be17604 Mon Sep 17 00:00:00 2001 From: John Kasper Svergja Date: Wed, 17 Jan 2024 16:28:02 +0100 Subject: [PATCH] Add pre-commit and update README --- .github/workflows/pre-commit.yaml | 11 +++++++++++ .pre-commit-config.yaml | 6 ++++++ README.md | 28 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..e6eec55 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,11 @@ +name: pre-commit + +on: push + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..103c034 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.27.3 + hooks: + - id: check-metaschema + files: ^src/.*\.json$ \ No newline at end of file diff --git a/README.md b/README.md index e69de29..fc6bdd0 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,28 @@ +# dapla-kuben-resource-model + +jsonschemas which defines how resources used in kuben are defined. Useful for validation and code generation. + +## Contributing + +This repository uses [pre-commit](https://pre-commit.com/) to ensure that all schemas are formatted correctly before +committed. +Install the pre-commit hooks by running `pre-commit install && pre-commit install-hooks`. +The pre-commit hooks will also run as a github workflow for each push + +Code under generated is generated from the JSON schemas under src. Files here should not be modified manually (only +exception is pom.xml). + +Usual workflow is: +1. Create branch +2. Make changes to your schema +3. Run `pre-commit run --all-files` to format your schema +4. Commit and push your changes +5. Github action will run and generate code from your schema +6. Create a PR and merge it when it is ready + +Create release: +1. Pull latest changes from main +2. Create a branch with name `release-java` +3. Push the branch +4. … +5. Profit \ No newline at end of file