diff --git a/.0pdd.yml b/.0pdd.yml index 3560b315..2eb74483 100644 --- a/.0pdd.yml +++ b/.0pdd.yml @@ -1,5 +1,27 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- errors: - abialiauski.dev@gmail.com tags: - pdd - - bug \ No newline at end of file + - bug diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 00000000..994de216 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,42 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: actionlint +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + actionlint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Download actionlint + id: get_actionlint + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + shell: bash + - name: Check workflow files + run: ${{ steps.get_actionlint.outputs.executable }} -color + shell: bash diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 050d2f3c..bcfe646d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,3 +1,25 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- name: codecov on: push: diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml new file mode 100644 index 00000000..eb41acc1 --- /dev/null +++ b/.github/workflows/license.yml @@ -0,0 +1,53 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: license +on: + push: + pull_request: +jobs: + license: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - run: | + set -e + find . -type f \( \ + -name "LICENSE.*" \ + -o -name "*.yml" \ + -o -name "*.xml" \ + -o -name "*.java" \ + -o -name "*.groovy" \ + -o -name "*.properties" \) > files.txt + header="Copyright (c) 2023-$(date +%Y) Aliaksei Bialiauski, EO-CQRS" + failed="false" + while IFS= read -r file; do + if ! grep -q "$header" "$file"; then + failed="true" + echo "No license in: $file" + fi + done < files.txt + if [ "${failed}" == "true" ]; then + exit 1 + fi diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml new file mode 100644 index 00000000..e4d13bd4 --- /dev/null +++ b/.github/workflows/markdown-lint.yml @@ -0,0 +1,36 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: markdown-lint +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + markdown-lint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: articulate/actions-markdownlint@v1 diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ab9b1c9d..9a7bbdd2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,3 +1,25 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- name: maven on: push: @@ -11,8 +33,8 @@ jobs: name: Build strategy: matrix: - os: [windows-2022, macos-12] - java: [17] + os: [ windows-2022, macos-12 ] + java: [ 17 ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -32,8 +54,8 @@ jobs: name: Build Integrations strategy: matrix: - os-integration: [ubuntu-20.04] - java: [17] + os-integration: [ ubuntu-20.04 ] + java: [ 17 ] runs-on: ${{ matrix.os-integration }} steps: - uses: actions/checkout@v4 @@ -49,4 +71,4 @@ jobs: key: ${{ runner.os }}-jdk-${{ matrix.java }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-jdk-${{ matrix.java }}-maven- - - run: mvn clean install -Pinvoker --errors --batch-mode \ No newline at end of file + - run: mvn clean install -Pinvoker --errors --batch-mode diff --git a/.github/workflows/pdd.yml b/.github/workflows/pdd.yml index 809b1852..048f84a4 100644 --- a/.github/workflows/pdd.yml +++ b/.github/workflows/pdd.yml @@ -1,3 +1,25 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- name: pdd on: push: diff --git a/.github/workflows/reports-check.yml b/.github/workflows/reports-check.yml index 1c4ba873..30980893 100644 --- a/.github/workflows/reports-check.yml +++ b/.github/workflows/reports-check.yml @@ -1,8 +1,29 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. --- name: reports-check on: issues: - types: opened + types: [ opened ] permissions: issues: write contents: read @@ -11,7 +32,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: tracehubpm/reports-check-action@latest + - uses: tracehubpm/reports-check-action@master with: deepinfra_token: ${{ secrets.DEEPINFRA_TOKEN }} github_token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 00000000..269b040c --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,36 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: typos +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + typos: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master diff --git a/.github/workflows/xcop.yml b/.github/workflows/xcop.yml index 877abe51..4a476c93 100644 --- a/.github/workflows/xcop.yml +++ b/.github/workflows/xcop.yml @@ -1,3 +1,25 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- name: xcop on: push: @@ -11,4 +33,4 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: g4s8/xcop-action@master \ No newline at end of file + - uses: g4s8/xcop-action@master diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml new file mode 100644 index 00000000..df1cc16d --- /dev/null +++ b/.github/workflows/yamllint.yml @@ -0,0 +1,38 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: yamllint +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + yamllint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ibiqlik/action-yamllint@v3 + with: + config-file: .yamllint.yml diff --git a/.github/workflows/year.yml b/.github/workflows/year.yml new file mode 100644 index 00000000..bfeb98c1 --- /dev/null +++ b/.github/workflows/year.yml @@ -0,0 +1,48 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +name: year +on: + schedule: + - cron: '0 1 22 * *' # Runs at 01:00 UTC on the 22nd of every month +concurrency: + group: year-${{ github.ref }} + cancel-in-progress: true +jobs: + license: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: FantasticFiasco/action-update-license-year@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + path: | #add new path with glob pattern https://www.npmjs.com/package/glob + **/LICENSE.txt + **/*.xml + **/*.xsl + **/*.java + **/*.yaml + **/*.yml + **/*.groovy + commitTitle: "update license year" diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 00000000..2506e5f3 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,31 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +# Default state for all rules +default: true + +# Line length : https://github.com/DavidAnson/markdownlint/blob/v0.33.0/doc/md013.md +MD013: false + +# Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.33.0/doc/md033.md +MD033: + allowed_elements: [ img ] diff --git a/.rultor.yml b/.rultor.yml index dbbf2292..ad9c25f3 100644 --- a/.rultor.yml +++ b/.rultor.yml @@ -1,6 +1,28 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- architect: - h1alexbel -docker: +docker: image: l3r8y/rultor-image:1.0.3 assets: settings.xml: eo-cqrs/eo-cqrs-secrets#assets/settings.xml @@ -15,4 +37,4 @@ release: [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1 mvn versions:set "-DnewVersion=${tag}" git commit -am "${tag}" - mvn clean deploy -Prelease --errors --settings ../settings.xml \ No newline at end of file + mvn clean deploy -Prelease --errors --settings ../settings.xml diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 00000000..85801c3b --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,31 @@ +# The MIT License (MIT) +# +# Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +--- +extends: default +rules: + line-length: disable + brackets: + min-spaces-inside: 1 + max-spaces-inside: 2 + truthy: + level: warning + allowed-values: [ 'on', 'true', 'false', 'yes', 'no' ] diff --git a/LICENSE.txt b/LICENSE.txt index 4e7da555..f5bbd7b9 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Aliaksei Bialiauski, EO-CQRS +Copyright (c) 2023-2024 Aliaksei Bialiauski, EO-CQRS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 02f29982..3fcfb2e4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ +# eo-kafka + logo This nice logo made by [@l3r8yJ](https://github.com/l3r8yJ) [![Managed By Self XDSD](https://self-xdsd.com/b/mbself.svg)](https://self-xdsd.com/p/eo-cqrs/eo-kafka?provider=github) - [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org) [![DevOps By Rultor.com](https://www.rultor.com/b/eo-cars/eo-kafka)](https://www.rultor.com/p/eo-cqrs/eo-kafka) [![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/) -
[![mvn](https://github.com/eo-cqrs/eo-kafka/actions/workflows/maven.yml/badge.svg)](https://github.com/eo-cqrs/eo-kafka/actions/workflows/maven.yml) [![maven central](http://maven-badges.herokuapp.com/maven-central/io.github.eo-cqrs/eo-kafka/badge.svg)](https://search.maven.org/artifact/io.github.eo-cqrs/eo-kafka) @@ -23,18 +23,21 @@ Project architect: [@h1alexbel](https://github.com/h1alexbel) EO Kafka Producers and consumers for working with Apache Kafka message broker. -Read [_Kafka Producers and Consumers for Elegant Microservices_](https://h1alexbel.github.io/2023/03/26/eo-kafka-for-elegant-microservices.html), the blog post about `EO-Kafka` -
-and [_EO-Kafka with Spring_](https://h1alexbel.github.io/2023/04/15/eo-kafka-with-spring.html), how to connect `EO-Kafka` with Spring. +Read [_Kafka Producers and Consumers for Elegant Microservices_](https://h1alexbel.github.io/2023/03/26/eo-kafka-for-elegant-microservices.html), +the blog post about `EO-Kafka`, and [_EO-Kafka with Spring_](https://h1alexbel.github.io/2023/04/15/eo-kafka-with-spring.html), +about how to connect `EO-Kafka` with Spring. -**Motivation**. We are not happy with Spring Kafka, because it is very procedural and not object-oriented. -eo-kafka is suggesting to do almost exactly the same, but through objects. +**Motivation**. We are not happy with Spring Kafka, because it is very +procedural and not object-oriented. eo-kafka is suggesting to do almost exactly +the same, but through objects. -**Principles**. These are the [design principles](https://www.elegantobjects.org/#principles) behind eo-kafka. +**Principles**. These are the [design principles](https://www.elegantobjects.org/#principles) +behind eo-kafka. **How to use**. All you need is this (get the latest version [here](https://search.maven.org/artifact/io.github.eo-cqrs/eo-kafka)): Maven: + ```xml io.github.eo-cqrs @@ -43,6 +46,7 @@ Maven: ``` To use it with [Spring Boot](https://spring.io/): + ```xml io.github.eo-cqrs @@ -56,7 +60,8 @@ To use it with [Spring Boot](https://spring.io/): ``` -Gradle: +With Gradle: + ```groovy dependencies { compile 'io.github.eo-cqrs:eo-kafka:' @@ -64,12 +69,15 @@ dependencies { ``` ## Messages + To create Kafka Message with **Topic**, **Key** and **Value**: + ```java final Message msg = new Tkv<>("test.topic", "test-k", "test-v"); ``` Creation Kafka Message with **Partition**: + ```java final Message msg = new WithPartition<>( @@ -83,6 +91,7 @@ final Message msg = ``` Creation Kafka Message with **Timestamp**: + ```java final Message msg = new Timestamped<>( @@ -99,12 +108,16 @@ final Message msg = ``` ## Producers + To create Kafka Producer you can wrap original [KafkaProducer](https://kafka.apache.org/23/javadoc/index.html?org/apache/kafka/clients/producer/KafkaProducer.html): + ```java final KafkaProducer origin = ...; final Producer producer = new KfProducer<>(origin); ``` + Or construct it with [KfFlexible](https://github.com/eo-cqrs/eo-kafka/blob/master/src/main/java/io/github/eocqrs/kafka/parameters/KfFlexible.java): + ```java final Producer producer = new KfProducer<>( @@ -119,7 +132,9 @@ final Producer producer = ) ); ``` + Or create it with XML file: + ```java final Producer producer = new KfProducer<>( @@ -128,7 +143,9 @@ final Producer producer = ) ); ``` -btw, your [XML](https://en.wikipedia.org/wiki/XML#:~:text=Extensible%20Markup%20Language%20(XML)%20is,%2Dreadable%20and%20machine%2Dreadable.) file should be in the ```resources``` look like: + +btw, your [XML] file should be in the ```resources``` look like: + ```xml localhost:9092 @@ -138,6 +155,7 @@ btw, your [XML](https://en.wikipedia.org/wiki/XML#:~:text=Extensible%20Markup%20 ``` Since version `0.4.6` you can create Producer with JSON file: + ```java final Producer producer = new KfProducer<>( @@ -147,7 +165,8 @@ final Producer producer = ); ``` -Your [JSON](https://en.wikipedia.org/wiki/JSON), located in resources directory, should look like this: +Your [JSON], located in resources directory, should look like this: + ```json { "bootstrapServers": "localhost:9092", @@ -157,6 +176,7 @@ Your [JSON](https://en.wikipedia.org/wiki/JSON), located in resources directory, ``` Since version `0.5.6` you can create Producer with YAML file: + ```java final Producer producer = new KfProducer<>( @@ -166,7 +186,8 @@ final Producer producer = ); ``` -Your [YAML](https://en.wikipedia.org/wiki/YAML), located in resources directory, should look like this: +Your [YAML], located in resources directory, should look like this: + ```yaml bootstrap-servers: localhost:9092 key-serializer: org.apache.kafka.common.serialization.StringSerializer @@ -174,6 +195,7 @@ value-serializer: org.apache.kafka.common.serialization.StringSerializer ``` To send a [message](#messages): + ```java try (final Producer producer = ...) { producer.send( @@ -192,7 +214,10 @@ try (final Producer producer = ...) { } ``` -Also, you can create [KfCallback](https://github.com/eo-cqrs/eo-kafka/blob/master/src/main/java/io/github/eocqrs/kafka/producer/KfCallback.java), Kafka Producer with Async [Callback](https://kafka.apache.org/26/javadoc/org/apache/kafka/clients/producer/Callback.html) support: +Also, you can create [KfCallback](https://github.com/eo-cqrs/eo-kafka/blob/master/src/main/java/io/github/eocqrs/kafka/producer/KfCallback.java), +Kafka Producer with async [Callback](https://kafka.apache.org/26/javadoc/org/apache/kafka/clients/producer/Callback.html) +support: + ```java final Producer producer = new KfCallback<>( @@ -213,12 +238,16 @@ final Producer producer = ``` ## Consumers + To create Kafka Consumer you can wrap original [KafkaConsumer](https://kafka.apache.org/23/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html): + ```java final KafkaConsumer origin = ...; final Consumer producer = new KfConsumer<>(origin); ``` + Using [KfFlexible](https://github.com/eo-cqrs/eo-kafka/blob/master/src/main/java/io/github/eocqrs/kafka/parameters/KfFlexible.java): + ```java final Consumer consumer = new KfConsumer<>( @@ -235,7 +264,8 @@ final Consumer consumer = ); ``` -And XML File approach: +And XML file approach: + ```java final Consumer consumer = new KfConsumer<>( @@ -243,7 +273,8 @@ final Consumer consumer = ); ``` -Again, [XML](https://en.wikipedia.org/wiki/XML#:~:text=Extensible%20Markup%20Language%20(XML)%20is,%2Dreadable%20and%20machine%2Dreadable.) file should be in the ```resources``` look like: +Again, [XML] file should be in the ```resources``` look like: + ```xml localhost:9092 @@ -254,6 +285,7 @@ Again, [XML](https://en.wikipedia.org/wiki/XML#:~:text=Extensible%20Markup%20Lan ``` Since version `0.4.6` you can create Consumer with JSON file: + ```java final Consumer producer = new KfConsumer<>( @@ -263,7 +295,8 @@ final Consumer producer = ); ``` -Your [JSON](https://en.wikipedia.org/wiki/JSON), located in resources directory, should looks like this: +Your [JSON], located in resources directory, should look like this: + ```json { "bootstrapServers": "localhost:9092", @@ -274,6 +307,7 @@ Your [JSON](https://en.wikipedia.org/wiki/JSON), located in resources directory, ``` Since version `0.5.6` you can create Consumer with YAML file: + ```java final Consumer consumer = new KfConsumer<>( @@ -283,7 +317,8 @@ final Consumer consumer = ); ``` -Your [YAML](https://en.wikipedia.org/wiki/YAML), located in resources directory, should look like this: +Your [YAML], located in resources directory, should look like this: + ```yaml bootstrap-servers: localhost:9092 group-id: "1" @@ -292,6 +327,7 @@ value-deserializer: org.apache.kafka.common.serialization.StringDeserializer ``` Consuming [messages](#messages): + ```java try ( final Consumer consumer = @@ -316,7 +352,9 @@ try ( } } ``` + Also, you can `subscribe` with [ConsumerRebalanceListener](https://kafka.apache.org/24/javadoc/index.html?org/apache/kafka/clients/consumer/ConsumerRebalanceListener.html): + ```java consumer.subscribe(new ConsumerRebalanceListener() { @Override @@ -331,15 +369,17 @@ consumer.subscribe(new ConsumerRebalanceListener() { ``` Finally, you can `unsubscribe`: + ```java consumer.unsubscribe(); ``` ## Fakes -In case of mocking eo-kafka, you can use existing Fake Objects from `io.github.eocqrs.kafka.fake` package. -They look like a normal ones, but instead of talking to real Kafka broker, -they are manipulating in-memory XML document. +In case of mocking eo-kafka, you can use existing Fake Objects from +`io.github.eocqrs.kafka.fake` package. They look like a normal ones, +but instead of talking to real Kafka broker, they are manipulating +in-memory XML document. ### FkBroker @@ -354,6 +394,7 @@ final FkBroker broker = new InXml( ``` It will create in-memory XML document with following structure: + ```xml @@ -369,6 +410,7 @@ broker.with(new TopicDirs("fake.topic").value()); ``` Under the hood XML will be modified to: + ```xml @@ -454,7 +496,8 @@ MatcherAssert.assertThat( ); ``` -As well as production [producers](#producers) and [consumers](#consumers), fake ones also should be closed after things been done: +As well as production [producers](#producers) and [consumers](#consumers), fake +ones also should be closed after things been done: ```java fake.close(); @@ -502,6 +545,7 @@ Under the hood XML document will looks like this: **By the version `0.3.5`, eo-kafka support only String values in FkConsumer**. ## Configs + | Kafka Property | eo-kafka API | XML/JSON tag | YAML |-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------- |------- | `bootstrap.servers` | [BootstrapServers](https://github.com/eo-cqrs/eo-kafka/blob/master/src/main/java/io/github/eocqrs/kafka/parameters/BootstrapServers.java) | bootstrapServers | bootstrap-servers @@ -550,11 +594,16 @@ provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build: ```bash -$ mvn clean install +mvn clean install ``` You will need Maven 3.8.7+ and Java 17+. -If you want to contribute to the next release version of eo-kafka, please check the [project board](https://github.com/orgs/eo-cqrs/projects/2/views/1). +If you want to contribute to the next release version of eo-kafka, please check +the [project board](https://github.com/orgs/eo-cqrs/projects/2/views/1). + +Our [rultor image](https://github.com/eo-cqrs/eo-kafka-rultor-image) for CI/CD. -Our [rultor image](https://github.com/eo-cqrs/eo-kafka-rultor-image) for CI/CD. \ No newline at end of file +[XML]: https://en.wikipedia.org/wiki/XML +[JSON]: https://en.wikipedia.org/wiki/JSON +[YAML]: https://en.wikipedia.org/wiki/YAML diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml index 565ffd19..99fca0d1 100644 --- a/checkstyle-suppressions.xml +++ b/checkstyle-suppressions.xml @@ -2,7 +2,7 @@