From 029bf2fcedbcfd9186ce49a8de7a7ab7c3b09ea6 Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 21 Oct 2024 08:56:12 +0200 Subject: [PATCH 01/27] Don't fail on broken links --- .github/workflows/broken-links.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index c17c397..48265e8 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -19,6 +19,8 @@ jobs: - name: Link Checker id: lychee uses: lycheeverse/lychee-action@v2 + with: + fail: false # Don't fail on broken links, create an issue instead - name: Find already existing issue id: find-issue From 9ad20ee188ec4d6f55b3ae187386009ed58a8f81 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 22 Oct 2024 02:34:23 +0000 Subject: [PATCH 02/27] Update dependency org.apache.maven.plugins:maven-project-info-reports-plugin to v3.8.0 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index fa36839..e963c1b 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -95,7 +95,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.7.0 + 3.8.0 From 009f795f2baf9ac819c4891d297ae5cc2c78534a Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:04:20 +0200 Subject: [PATCH 03/27] Initial commit --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From efcd43e6d935ffb84ea540561128bc5173923517 Mon Sep 17 00:00:00 2001 From: AB Date: Thu, 24 Oct 2024 14:14:33 +0200 Subject: [PATCH 04/27] Init --- .gitattributes | 5 + .github/.lycheeignore | 2 + .github/ISSUE_TEMPLATE/bug_report.yml | 68 +++++ .github/ISSUE_TEMPLATE/config.yml | 4 + .github/ISSUE_TEMPLATE/enhancement.yml | 32 +++ .github/ISSUE_TEMPLATE/question.yml | 31 ++ .github/labels.yml | 38 +++ .github/workflows/broken-links.yml | 45 +++ .github/workflows/sync-labels.yml | 24 ++ .github/workflows/update-from-template.yml | 318 +++++++++++++++++++++ CHANGELOG.md | 0 LICENSE | 2 +- SECURITY.md | 5 + renovate.json5 | 4 + 14 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 .github/.lycheeignore create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/enhancement.yml create mode 100644 .github/ISSUE_TEMPLATE/question.yml create mode 100644 .github/labels.yml create mode 100644 .github/workflows/broken-links.yml create mode 100644 .github/workflows/sync-labels.yml create mode 100644 .github/workflows/update-from-template.yml create mode 100644 CHANGELOG.md create mode 100644 SECURITY.md create mode 100644 renovate.json5 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0f9f33e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Force sh files to have LF +*.sh text eol=lf diff --git a/.github/.lycheeignore b/.github/.lycheeignore new file mode 100644 index 0000000..972ca61 --- /dev/null +++ b/.github/.lycheeignore @@ -0,0 +1,2 @@ +# Ignorefile for broken link check +localhost diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..68299d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,68 @@ +name: 🐞 Bug +description: Create a bug report for something that is broken +labels: [bug] +body: + - type: markdown + attributes: + value: | + Thank you for reporting a bug. + + Please fill in as much information as possible about your bug so that we don't have to play "information ping-pong" and can help you immediately. + + - type: checkboxes + id: checklist + attributes: + label: "Checklist" + options: + - label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)" + required: true + - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." + required: true + - label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise." + required: true + - label: "This issue contains only one bug." + required: true + + - type: input + id: app-version + attributes: + label: Affected version + description: "In which version did you encounter the bug?" + placeholder: "x.x.x" + validations: + required: true + + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to reproduce the bug + description: | + What did you do for the bug to show up? + + If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug. + placeholder: | + 1. Use '...' + 2. Do '...' + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: | + Tell us what you expect to happen. + + - type: textarea + id: actual-behavior + attributes: + label: Actual behavior + description: | + Tell us what happens with the steps given above. + + - type: textarea + id: additional-information + attributes: + label: Additional information + description: | + Any other relevant information you'd like to include diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..b6fb79b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: 💬 Contact support + url: https://xdev.software/en/services/support + about: "If you need support as soon as possible or/and you can't wait for any pull request" diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml new file mode 100644 index 0000000..7523129 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement.yml @@ -0,0 +1,32 @@ +name: ✨ Feature/Enhancement +description: Suggest a new feature or enhancement +labels: [enhancement] +body: + - type: markdown + attributes: + value: | + Thank you for suggesting a new feature/enhancement. + + - type: checkboxes + id: checklist + attributes: + label: "Checklist" + options: + - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." + required: true + - label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise." + required: true + - label: "This issue contains only one feature request/enhancement." + required: true + + - type: textarea + id: description + attributes: + label: Description + validations: + required: true + + - type: textarea + id: additional-information + attributes: + label: Additional information diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..6ecd6ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,31 @@ +name: ❓ Question +description: Ask a question +labels: [question] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this form! + + - type: checkboxes + id: checklist + attributes: + label: "Checklist" + options: + - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." + required: true + - label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise." + required: true + + - type: textarea + id: what-is-the-question + attributes: + label: What is/are your question(s)? + validations: + required: true + + - type: textarea + id: additional-information + attributes: + label: Additional information + description: "Any other information you'd like to include - for instance logs, screenshots, etc." diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..325f4ce --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,38 @@ +# Default +## Required for template +- name: bug + description: "Something isn't working" + color: 'd73a4a' +- name: enhancement + description: New feature or request + color: '#a2eeef' +- name: question + description: Information is requested + color: '#d876e3' +## Others +- name: duplicate + description: This already exists + color: '#cfd3d7' +- name: good first issue + description: Good for newcomers + color: '#7057ff' +- name: help wanted + description: Extra attention is needed + color: '#008672' +- name: invalid + description: "This doesn't seem right" + color: '#e4e669' +# Custom +- name: automated + description: Created by an automation + color: '#000000' +- name: "can't reproduce" + color: '#e95f2c' +- name: customer-requested + description: Was requested by a customer of us + color: '#068374' +- name: stale + color: '#ededed' +- name: waiting-for-response + description: If no response is received after a certain time the issue will be closed + color: '#202020' diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml new file mode 100644 index 0000000..48265e8 --- /dev/null +++ b/.github/workflows/broken-links.yml @@ -0,0 +1,45 @@ +name: Broken links + +on: + workflow_dispatch: + schedule: + - cron: "23 23 * * 0" + +permissions: + issues: write + +jobs: + link-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: mv .github/.lycheeignore .lycheeignore + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: false # Don't fail on broken links, create an issue instead + + - name: Find already existing issue + id: find-issue + run: | + echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title \"Link Checker Report\"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ github.token }} + + - name: Close issue if everything is fine + if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != '' + run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }} + env: + GH_TOKEN: ${{ github.token }} + + - name: Create Issue From File + if: env.lychee_exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + issue-number: ${{ steps.find-issue.outputs.number }} + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: bug, automated diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml new file mode 100644 index 0000000..ff880f0 --- /dev/null +++ b/.github/workflows/sync-labels.yml @@ -0,0 +1,24 @@ +name: Sync labels + +on: + push: + branches: develop + paths: + - .github/labels.yml + + workflow_dispatch: + +permissions: + issues: write + +jobs: + labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: .github/labels.yml + + - uses: EndBug/label-sync@v2 + with: + config-file: .github/labels.yml diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml new file mode 100644 index 0000000..3ad8e88 --- /dev/null +++ b/.github/workflows/update-from-template.yml @@ -0,0 +1,318 @@ +name: Update from Template + +# This workflow keeps the repo up to date with changes from the template repo (REMOTE_URL) +# It duplicates the REMOTE_BRANCH (into UPDATE_BRANCH) and tries to merge it into +# this repos default branch (which is checked out here) +# Note that this requires a PAT (Personal Access Token) - at best from a servicing account +# PAT permissions: read:discussion, read:org, repo, workflow +# Also note that you should have at least once merged the template repo into the current repo manually +# otherwise a "refusing to merge unrelated histories" error might occur. + +on: + schedule: + - cron: '55 2 * * 1' + workflow_dispatch: + inputs: + no_automatic_merge: + type: boolean + description: 'No automatic merge' + default: false + +env: + UPDATE_BRANCH: update-from-template + UPDATE_BRANCH_MERGED: update-from-template-merged + REMOTE_URL: https://github.com/xdev-software/base-template.git + REMOTE_BRANCH: master + +permissions: + contents: write + pull-requests: write + +jobs: + update: + runs-on: ubuntu-latest + outputs: + update_branch_merged_commit: ${{ steps.manage-branches.outputs.update_branch_merged_commit }} + create_update_branch_merged_pr: ${{ steps.manage-branches.outputs.create_update_branch_merged_pr }} + steps: + - uses: actions/checkout@v4 + with: + # Required because otherwise there are always changes detected when executing diff/rev-list + fetch-depth: 0 + # If no PAT is used the following error occurs on a push: + # refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission + token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + + - name: Init Git + run: | + git config --global user.email "111048771+xdev-gh-bot@users.noreply.github.com" + git config --global user.name "XDEV Bot" + + - name: Manage branches + id: manage-branches + run: | + echo "Adding remote template-repo" + git remote add template ${{ env.REMOTE_URL }} + + echo "Fetching remote template repo" + git fetch template + + echo "Deleting local branches that will contain the updates - if present" + git branch -D ${{ env.UPDATE_BRANCH }} || true + git branch -D ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "Checking if the remote template repo has new commits" + git rev-list ..template/${{ env.REMOTE_BRANCH }} + + if [ $(git rev-list --count ..template/${{ env.REMOTE_BRANCH }}) -eq 0 ]; then + echo "There are no commits new commits on the template repo" + + echo "Deleting origin branch(es) that contain the updates - if present" + git push -f origin --delete ${{ env.UPDATE_BRANCH }} || true + git push -f origin --delete ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "create_update_branch_pr=0" >> $GITHUB_OUTPUT + echo "create_update_branch_merged_pr=0" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Found new commits on the template repo" + + echo "Creating update branch" + git branch ${{ env.UPDATE_BRANCH }} template/${{ env.REMOTE_BRANCH }} + git branch --unset-upstream ${{ env.UPDATE_BRANCH }} + + echo "Pushing update branch" + git push -f -u origin ${{ env.UPDATE_BRANCH }} + + echo "Getting base branch" + base_branch=$(git branch --show-current) + echo "Base branch is $base_branch" + echo "base_branch=$base_branch" >> $GITHUB_OUTPUT + + echo "Trying to create auto-merged branch ${{ env.UPDATE_BRANCH_MERGED }}" + git branch ${{ env.UPDATE_BRANCH_MERGED }} ${{ env.UPDATE_BRANCH }} + git checkout ${{ env.UPDATE_BRANCH_MERGED }} + + echo "Merging branch $base_branch into ${{ env.UPDATE_BRANCH_MERGED }}" + git merge $base_branch && merge_exit_code=$? || merge_exit_code=$? + if [ $merge_exit_code -ne 0 ]; then + echo "Auto merge failed! Manual merge required" + echo "::notice ::Auto merge failed - Manual merge required" + + echo "Cleaning up failed merge" + git merge --abort + git checkout $base_branch + git branch -D ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "Deleting auto-merge branch - if present" + git push -f origin --delete ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "create_update_branch_pr=1" >> $GITHUB_OUTPUT + echo "create_update_branch_merged_pr=0" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Post processing: Trying to automatically fill in template variables" + find . -type f \ + -not -path "./.git/**" \ + -not -path "./.github/workflows/update-from-template.yml" -print0 \ + | xargs -0 sed -i "s/template-placeholder/${GITHUB_REPOSITORY#*/}/g" + + git status + git add --all + + if [[ "$(git status --porcelain)" != "" ]]; then + echo "Filled in template; Committing" + + git commit -m "Fill in template" + fi + + echo "Pushing auto-merged branch" + git push -f -u origin ${{ env.UPDATE_BRANCH_MERGED }} + + echo "update_branch_merged_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + echo "Restoring base branch $base_branch" + git checkout $base_branch + + echo "create_update_branch_pr=0" >> $GITHUB_OUTPUT + echo "create_update_branch_merged_pr=1" >> $GITHUB_OUTPUT + echo "try_close_update_branch_pr=1" >> $GITHUB_OUTPUT + + - name: Create/Update PR update_branch + if: steps.manage-branches.outputs.create_update_branch_pr == 1 + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + gh_pr_up() { + gh pr create -H "${{ env.UPDATE_BRANCH }}" "$@" || (git checkout "${{ env.UPDATE_BRANCH }}" && gh pr edit "$@") + } + gh_pr_up -B "${{ steps.manage-branches.outputs.base_branch }}" \ + --title "Update from template" \ + --body "An automated PR to sync changes from the template into this repo" + + # Ensure that only a single PR is open (otherwise confusion and spam) + - name: Close PR update_branch + if: steps.manage-branches.outputs.try_close_update_branch_pr == 1 + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + gh pr close "${{ env.UPDATE_BRANCH }}" || true + + - name: Create/Update PR update_branch_merged + if: steps.manage-branches.outputs.create_update_branch_merged_pr == 1 + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + gh_pr_up() { + gh pr create -H "${{ env.UPDATE_BRANCH_MERGED }}" "$@" || (git checkout "${{ env.UPDATE_BRANCH_MERGED }}" && gh pr edit "$@") + } + gh_pr_up -B "${{ steps.manage-branches.outputs.base_branch }}" \ + --title "Update from template (auto-merged)" \ + --body "An automated PR to sync changes from the template into this repo" + + # Wait a moment so that checks of PR have higher prio than following job + sleep 3 + + # Split into two jobs to help with executor starvation + auto-merge: + needs: [update] + if: needs.update.outputs.create_update_branch_merged_pr == 1 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # Required because otherwise there are always changes detected when executing diff/rev-list + fetch-depth: 0 + # If no PAT is used the following error occurs on a push: + # refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission + token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + + - name: Init Git + run: | + git config --global user.email "111048771+xdev-gh-bot@users.noreply.github.com" + git config --global user.name "XDEV Bot" + + - name: Checking if auto-merge for PR update_branch_merged can be done + id: auto-merge-check + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + not_failed_conclusion="skipped|neutral|success" + not_relevant_app_slug="dependabot|github-pages|sonarcloud" + + echo "Waiting for checks to start..." + sleep 40s + + for i in {1..20}; do + echo "Checking if PR can be auto-merged. Try: $i" + + echo "Checking if update-branch-merged exists" + git fetch + if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then + echo "Branch still exists; Continuing..." + else + echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing" + exit 0 + fi + + echo "Fetching checks" + cs_response=$(curl -sL \ + --fail-with-body \ + --connect-timeout 60 \ + --max-time 120 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GH_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/commits/${{ needs.update.outputs.update_branch_merged_commit }}/check-suites) + + cs_data=$(echo $cs_response | jq '.check_suites[] | { conclusion: .conclusion, slug: .app.slug, check_runs_url: .check_runs_url }') + echo $cs_data + + if [[ -z "$cs_data" ]]; then + echo "No check suite data - Assuming that there are no checks to run" + + echo "perform=1" >> $GITHUB_OUTPUT + exit 0 + fi + + cs_failed=$(echo $cs_data | jq --arg x "$not_failed_conclusion" 'select ((.conclusion == null or (.conclusion | test($x))) | not)') + if [[ -z "$cs_failed" ]]; then + echo "No check failed so far; Checking if relevant checks are still running" + + cs_relevant_still_running=$(echo $cs_data | jq --arg x "$not_relevant_app_slug" 'select (.conclusion == null and (.slug | test($x) | not))') + if [[ -z $cs_relevant_still_running ]]; then + echo "All relevant checks finished - PR can be merged" + + echo "perform=1" >> $GITHUB_OUTPUT + exit 0 + else + echo "Relevant checks are still running" + echo $cs_relevant_still_running + fi + else + echo "Detected failed check" + echo $cs_failed + + echo "perform=0" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Waiting before next run..." + sleep 30s + done + + echo "Timed out - Assuming executor starvation - Forcing merge" + echo "perform=1" >> $GITHUB_OUTPUT + + - name: Auto-merge update_branch_merged + if: steps.auto-merge-check.outputs.perform == 1 + run: | + echo "Getting base branch" + base_branch=$(git branch --show-current) + echo "Base branch is $base_branch" + + echo "Fetching..." + git fetch + if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then + echo "Branch still exists; Continuing..." + else + echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing" + exit 0 + fi + + expected_commit="${{ needs.update.outputs.update_branch_merged_commit }}" + actual_commit=$(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) + if [[ "$expected_commit" != "$actual_commit" ]]; then + echo "Branch ${{ env.UPDATE_BRANCH_MERGED }} contains unexpected commit $actual_commit" + echo "Expected: $expected_commit" + + exit 0 + fi + + echo "Ensuring that current branch $base_branch is up-to-date" + git pull + + echo "Merging origin/${{ env.UPDATE_BRANCH_MERGED }} into $base_branch" + git merge origin/${{ env.UPDATE_BRANCH_MERGED }} && merge_exit_code=$? || merge_exit_code=$? + if [ $merge_exit_code -ne 0 ]; then + echo "Unexpected merge failure $merge_exit_code - Requires manual resolution" + + exit 0 + fi + + if [[ "${{ inputs.no_automatic_merge }}" == "true" ]]; then + echo "Exiting due no_automatic_merge" + + exit 0 + fi + + echo "Pushing" + git push + + echo "Cleaning up" + git branch -D ${{ env.UPDATE_BRANCH }} || true + git branch -D ${{ env.UPDATE_BRANCH_MERGED }} || true + git push -f origin --delete ${{ env.UPDATE_BRANCH }} || true + git push -f origin --delete ${{ env.UPDATE_BRANCH_MERGED }} || true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE index 261eeb9..ccaa2b3 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2024 XDEV Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..34b9514 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +# Security Policy + +## Reporting a Vulnerability + +Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new). diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 0000000..11a77b2 --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "rebaseWhen": "behind-base-branch" +} From 473ce31f9b4826136dd560129d55c54039760e22 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 26 Oct 2024 02:32:51 +0000 Subject: [PATCH 05/27] Update dependency org.apache.maven.plugins:maven-checkstyle-plugin to v3.6.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..a032933 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.5.0 + 3.6.0 com.puppycrawl.tools diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..e669be0 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -242,7 +242,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.5.0 + 3.6.0 com.puppycrawl.tools From f2c6db40b00a1554cae8eacb6eaec25bc8dbd039 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 26 Oct 2024 02:32:52 +0000 Subject: [PATCH 06/27] Update dependency org.apache.maven.plugins:maven-jxr-plugin to v3.6.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..aa6b8cb 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ org.apache.maven.plugins maven-jxr-plugin - 3.5.0 + 3.6.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..323c61d 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -301,7 +301,7 @@ org.apache.maven.plugins maven-jxr-plugin - 3.5.0 + 3.6.0 From 216f4650d7cd90671ddb7513de3934300bac3dd4 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 26 Oct 2024 02:32:54 +0000 Subject: [PATCH 07/27] Update net.sourceforge.pmd to v7.7.0 --- pom.xml | 4 ++-- template-placeholder/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..e68ab40 100644 --- a/pom.xml +++ b/pom.xml @@ -82,12 +82,12 @@ net.sourceforge.pmd pmd-core - 7.6.0 + 7.7.0 net.sourceforge.pmd pmd-java - 7.6.0 + 7.7.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..63c5a41 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -284,12 +284,12 @@ net.sourceforge.pmd pmd-core - 7.6.0 + 7.7.0 net.sourceforge.pmd pmd-java - 7.6.0 + 7.7.0 From f798625deb74bec76b0e070dd7c3fd7ecacea34b Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sun, 27 Oct 2024 02:38:11 +0000 Subject: [PATCH 08/27] Update dependency com.puppycrawl.tools:checkstyle to v10.19.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..ae44704 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.18.2 + 10.19.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..eba8ad3 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.18.2 + 10.19.0 From d13b2dee2e89f9270e954d48669fe2f506248e4a Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 28 Oct 2024 15:09:18 +0100 Subject: [PATCH 09/27] Changes for PMD 7.7 --- .config/pmd/ruleset.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.config/pmd/ruleset.xml b/.config/pmd/ruleset.xml index 667f74e..7a03f17 100644 --- a/.config/pmd/ruleset.xml +++ b/.config/pmd/ruleset.xml @@ -151,5 +151,12 @@ + + + + + + + From a2d6ebcb76f8c23a6bcf35da8f98d2905f425d3c Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 29 Oct 2024 02:39:53 +0000 Subject: [PATCH 10/27] Update dependency org.apache.maven.plugins:maven-pmd-plugin to v3.26.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 97e1ff1..a62886a 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.25.0 + 3.26.0 true true diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 62a6b63..454ddcc 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -272,7 +272,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.25.0 + 3.26.0 true true From 9e9f2a9ee7866ba0f992e87cb0678ab7c4ebbc7f Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 30 Oct 2024 09:11:40 +0100 Subject: [PATCH 11/27] Tighten timeouts --- .github/workflows/broken-links.yml | 1 + .github/workflows/sync-labels.yml | 1 + .github/workflows/update-from-template.yml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index 48265e8..8f98f1a 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -11,6 +11,7 @@ permissions: jobs: link-checker: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index ff880f0..c9d7ec7 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -14,6 +14,7 @@ permissions: jobs: labels: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml index ba0bf09..cb31845 100644 --- a/.github/workflows/update-from-template.yml +++ b/.github/workflows/update-from-template.yml @@ -31,6 +31,7 @@ permissions: jobs: update: runs-on: ubuntu-latest + timeout-minutes: 60 outputs: update_branch_merged_commit: ${{ steps.manage-branches.outputs.update_branch_merged_commit }} create_update_branch_merged_pr: ${{ steps.manage-branches.outputs.create_update_branch_merged_pr }} @@ -180,6 +181,7 @@ jobs: needs: [update] if: needs.update.outputs.create_update_branch_merged_pr == 1 runs-on: ubuntu-latest + timeout-minutes: 60 steps: - uses: actions/checkout@v4 with: From 02fc7af8377fd12b1d825b378cdd4d0c0a3e3b3d Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 30 Oct 2024 09:13:09 +0100 Subject: [PATCH 12/27] Tighten timeouts --- .github/workflows/check-build.yml | 3 +++ .github/workflows/release.yml | 5 +++++ .github/workflows/sonar.yml | 2 ++ .github/workflows/test-deploy.yml | 1 + 4 files changed, 11 insertions(+) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index 2ac6530..c8966a7 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -26,6 +26,7 @@ env: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 30 strategy: matrix: @@ -72,6 +73,7 @@ jobs: checkstyle: runs-on: ubuntu-latest + timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} strategy: @@ -94,6 +96,7 @@ jobs: pmd: runs-on: ubuntu-latest + timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} strategy: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bf3805..236c0f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ permissions: jobs: check-code: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4 @@ -48,6 +49,7 @@ jobs: prepare-release: runs-on: ubuntu-latest needs: [check-code] + timeout-minutes: 10 outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: @@ -109,6 +111,7 @@ jobs: publish-maven: runs-on: ubuntu-latest needs: [prepare-release] + timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -140,6 +143,7 @@ jobs: publish-pages: runs-on: ubuntu-latest needs: [prepare-release] + timeout-minutes: 15 steps: - uses: actions/checkout@v4 @@ -169,6 +173,7 @@ jobs: after-release: runs-on: ubuntu-latest needs: [publish-maven] + timeout-minutes: 10 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index b38f0d8..df6dbb7 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -27,6 +27,7 @@ jobs: token-check: runs-on: ubuntu-latest if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }} + timeout-minutes: 5 outputs: hasToken: ${{ steps.check-token.outputs.has }} steps: @@ -40,6 +41,7 @@ jobs: runs-on: ubuntu-latest needs: token-check if: ${{ needs.token-check.outputs.hasToken }} + timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index e3ed038..03f5339 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -9,6 +9,7 @@ env: jobs: publish-maven: runs-on: ubuntu-latest + timeout-minutes: 60 steps: - uses: actions/checkout@v4 From 89a6b057d3436a931931105459f573100590d250 Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 30 Oct 2024 10:30:45 +0100 Subject: [PATCH 13/27] Update check-build.yml --- .github/workflows/check-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index c8966a7..0818116 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -73,8 +73,8 @@ jobs: checkstyle: runs-on: ubuntu-latest - timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} + timeout-minutes: 15 strategy: matrix: @@ -96,8 +96,8 @@ jobs: pmd: runs-on: ubuntu-latest - timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} + timeout-minutes: 15 strategy: matrix: From 71f1b1dab2fbc93df1efd3870c88ea14f82de9d5 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Fri, 1 Nov 2024 02:39:13 +0000 Subject: [PATCH 14/27] Update dependency com.puppycrawl.tools:checkstyle to v10.20.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a62886a..8e85bad 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.19.0 + 10.20.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 454ddcc..08cadb5 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.19.0 + 10.20.0 From d7b7b8a7dc4f464a641062cd3ff41b9af4394302 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sun, 3 Nov 2024 02:38:33 +0000 Subject: [PATCH 15/27] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.1 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 454ddcc..e1b6b3c 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -143,7 +143,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.10.1 + 3.11.1 attach-javadocs From d7926e6ce40ec7ee03e218a4eb8433b15d6c1c7e Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Fri, 8 Nov 2024 02:32:23 +0000 Subject: [PATCH 16/27] Update dependency com.puppycrawl.tools:checkstyle to v10.20.1 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8e85bad..d069dc6 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.20.0 + 10.20.1 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e595715..2155875 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.20.0 + 10.20.1 From 8d16f5b86c6eb6a269cddd1fa31671f920a90c94 Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 11 Nov 2024 08:55:26 +0100 Subject: [PATCH 17/27] Update CheckStyle version --- .idea/checkstyle-idea.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index eb3fcd8..5f35e01 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,7 +1,7 @@ - 10.15.0 + 10.20.1 JavaOnlyWithTests true true From b4fd24a990cdc94685c8f081491791727f71dd81 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Mon, 18 Nov 2024 07:45:51 +0000 Subject: [PATCH 18/27] Update dependency com.fasterxml.jackson.core:jackson-databind to v2.18.1 --- chartjs-java-model/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..11bb358 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -95,7 +95,7 @@ com.fasterxml.jackson.core jackson-databind - 2.18.0 + 2.18.1 From 75225853dc8f517e4ef2a0abaa1cb452ce0b0ffc Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Mon, 18 Nov 2024 07:45:52 +0000 Subject: [PATCH 19/27] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.2 --- chartjs-java-model/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..4ada2c0 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -274,7 +274,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.1 + 3.5.2 ${skipTests} From fe63516cd412f70759ba86d2d7c50afbd71b0ad9 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Mon, 18 Nov 2024 07:45:53 +0000 Subject: [PATCH 20/27] Update dependency org.junit.jupiter:junit-jupiter to v5.11.3 --- chartjs-java-model/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..5a76a28 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -129,7 +129,7 @@ org.junit.jupiter junit-jupiter - 5.11.2 + 5.11.3 test From bf9535246a2229b0300857d6ae96bcb4c427e024 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Mon, 18 Nov 2024 07:45:54 +0000 Subject: [PATCH 21/27] Update testcontainers-version to v1.20.3 --- chartjs-java-model/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..325354a 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -50,7 +50,7 @@ 2.0.16 2.24.1 - 1.20.2 + 1.20.3 true From 130295d0ccdc061a946973a8311f50ecb6041847 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Mon, 18 Nov 2024 07:45:55 +0000 Subject: [PATCH 22/27] Update dependency org.seleniumhq.selenium:selenium-chrome-driver to v4.26.0 --- chartjs-java-model/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..6e6107d 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -170,7 +170,7 @@ org.seleniumhq.selenium selenium-chrome-driver - 4.25.0 + 4.26.0 test From f0f08927caa0360f3a50b754c94182faaa6808a8 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Mon, 18 Nov 2024 07:45:56 +0000 Subject: [PATCH 23/27] Update dependency software.xdev:testcontainers-selenium to v1.1.0 --- chartjs-java-model/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..9878e1e 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -162,7 +162,7 @@ software.xdev testcontainers-selenium - 1.0.2 + 1.1.0 test From 2a4179c6fb03d74c3ef41f6c0ee25c4e2ca99a73 Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 18 Nov 2024 11:10:15 +0100 Subject: [PATCH 24/27] PointStyle can also contain non-string constants Fixes #280 --- CHANGELOG.md | 3 +++ .../xdev/chartjs/model/dataset/BarDataset.java | 7 +++---- .../chartjs/model/dataset/BubbleDataset.java | 7 +++---- .../chartjs/model/dataset/PointDataset.java | 9 ++++----- .../xdev/chartjs/model/enums/PointStyle.java | 15 ++++++++++----- .../chartjs/model/options/elements/Point.java | 17 ++++------------- 6 files changed, 27 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4854f..0dd511d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.4.0 +* PointStyle can also contain non-string constants #280 + ## 2.3.1 * Synced ``LineOptions/DataSet`` ``stepped`` and ``tension`` with ChartJS source #262 * Updated dependencies diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BarDataset.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BarDataset.java index 051ec6f..44a4b22 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BarDataset.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BarDataset.java @@ -18,7 +18,6 @@ import java.util.List; import software.xdev.chartjs.model.enums.BorderSkipped; -import software.xdev.chartjs.model.enums.PointStyle; import software.xdev.chartjs.model.objects.OptionalArray; @@ -35,7 +34,7 @@ public class BarDataset extends BackgroundBorderHoverDataset protected Object barThickness; protected Number maxBarThickness; protected Number minBarLength; - protected PointStyle pointStyle; + protected Object pointStyle; protected Boolean grouped; protected final List borderSkipped = new OptionalArray<>(); @@ -123,12 +122,12 @@ public BarDataset setMinBarLength(final Number minBarLength) return this; } - public PointStyle getPointStyle() + public Object getPointStyle() { return this.pointStyle; } - public BarDataset setPointStyle(final PointStyle pointStyle) + public BarDataset setPointStyle(final Object pointStyle) { this.pointStyle = pointStyle; return this; diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BubbleDataset.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BubbleDataset.java index 92aab9c..2504a57 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BubbleDataset.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/BubbleDataset.java @@ -18,7 +18,6 @@ import java.util.List; import software.xdev.chartjs.model.datapoint.BubbleDataPoint; -import software.xdev.chartjs.model.enums.PointStyle; import software.xdev.chartjs.model.objects.OptionalArray; @@ -32,7 +31,7 @@ public class BubbleDataset extends BackgroundBorderHoverDataset hoverRadius = new OptionalArray<>(); - protected PointStyle pointStyle; + protected Object pointStyle; @Override protected String defaultType() @@ -95,12 +94,12 @@ public List getHoverRadius() return this.hoverRadius; } - public PointStyle getPointStyle() + public Object getPointStyle() { return this.pointStyle; } - public BubbleDataset setPointStyle(final PointStyle pointStyle) + public BubbleDataset setPointStyle(final Object pointStyle) { this.pointStyle = pointStyle; return this; diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/PointDataset.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/PointDataset.java index 87ad4fc..361d037 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/PointDataset.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/dataset/PointDataset.java @@ -20,7 +20,6 @@ import software.xdev.chartjs.model.enums.BorderCapStyle; import software.xdev.chartjs.model.enums.BorderJoinStyle; -import software.xdev.chartjs.model.enums.PointStyle; import software.xdev.chartjs.model.objects.OptionalArray; import software.xdev.chartjs.model.options.elements.Fill; @@ -63,7 +62,7 @@ public abstract class PointDataset, O> extends Dataset pointHoverBorderWidth = new OptionalArray<>(); - private final List pointStyle = new OptionalArray<>(); + private final List pointStyle = new OptionalArray<>(); /** * @see #setFill(Fill) @@ -528,7 +527,7 @@ public T setPointHoverBorderWidth(final List pointHoverBorderWidth) /** * @see #setPointStyle(List) */ - public List getPointStyle() + public List getPointStyle() { return this.pointStyle; } @@ -536,7 +535,7 @@ public List getPointStyle() /** * @see #setPointStyle(List) */ - public T addPointStyle(final PointStyle pointStyle) + public T addPointStyle(final Object pointStyle) { this.pointStyle.add(pointStyle); return this.self(); @@ -547,7 +546,7 @@ public T addPointStyle(final PointStyle pointStyle) * and * 'dash'. If the option is an image, that image is drawn on the canvas using drawImage. */ - public T setPointStyle(final List pointStyle) + public T setPointStyle(final List pointStyle) { this.pointStyle.clear(); if(pointStyle != null) diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/enums/PointStyle.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/enums/PointStyle.java index f00696d..173269f 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/enums/PointStyle.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/enums/PointStyle.java @@ -20,18 +20,23 @@ import software.xdev.chartjs.model.EnumNameToCamelCase; +/** + * @apiNote Only contains the (string) constants. Other valid values are e.g. false, an image element or a + * canvas element. + * @see ChartJS Source + */ public enum PointStyle { CIRCLE, - TRIANGLE, + CROSS, + CROSS_ROT, + DASH, + LINE, RECT, RECT_ROUNDED, RECT_ROT, - CROSS, - CROSS_ROT, STAR, - LINE, - DASH; + TRIANGLE; @JsonValue @Override diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/Point.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/Point.java index e3ec6fd..11d84ed 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/Point.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/elements/Point.java @@ -15,9 +15,6 @@ */ package software.xdev.chartjs.model.options.elements; -import software.xdev.chartjs.model.enums.PointStyle; - - /** *

* Point elements are used to represent the points in a line chart or a bubble chart. @@ -26,12 +23,13 @@ * When set, these options apply to all objects of that type unless specifically overridden by the configuration * attached to a dataset. *

+ * @see ChartJS Source */ public class Point { protected Integer radius; - protected PointStyle pointStyle; + protected Object pointStyle; protected Object backgroundColor; @@ -68,24 +66,17 @@ public Point setRadius(final Integer radius) return this; } - /** - * @see #setPointStyle(PointStyle) - */ - public PointStyle getPointStyle() + public Object getPointStyle() { return this.pointStyle; } /** - *

- * Default point style - *

- * *

* Default {@code 'circle'} *

*/ - public Point setPointStyle(final PointStyle pointStyle) + public Point setPointStyle(final Object pointStyle) { this.pointStyle = pointStyle; return this; From 266b81c7188fdd0375db279658ea4b716f04bf3c Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 18 Nov 2024 11:10:38 +0100 Subject: [PATCH 25/27] Update version --- chartjs-java-model-demo/pom.xml | 4 ++-- chartjs-java-model/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chartjs-java-model-demo/pom.xml b/chartjs-java-model-demo/pom.xml index 8aacd3f..80e0232 100644 --- a/chartjs-java-model-demo/pom.xml +++ b/chartjs-java-model-demo/pom.xml @@ -7,11 +7,11 @@ software.xdev chartjs-java-model-root - 2.3.1-SNAPSHOT + 2.4.0-SNAPSHOT chartjs-java-model-demo - 2.3.1-SNAPSHOT + 2.4.0-SNAPSHOT jar diff --git a/chartjs-java-model/pom.xml b/chartjs-java-model/pom.xml index 3ef53c3..4c8c10c 100644 --- a/chartjs-java-model/pom.xml +++ b/chartjs-java-model/pom.xml @@ -6,7 +6,7 @@ software.xdev chartjs-java-model - 2.3.1-SNAPSHOT + 2.4.0-SNAPSHOT jar chartjs-java-model diff --git a/pom.xml b/pom.xml index b8acaf5..7d7209c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ software.xdev chartjs-java-model-root - 2.3.1-SNAPSHOT + 2.4.0-SNAPSHOT pom From 3c796fbe6e5b88e38de34e273bde14614b72cb4e Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 18 Nov 2024 11:15:55 +0100 Subject: [PATCH 26/27] Update ChartJS to latest version --- .../src/main/java/software/xdev/Application.java | 2 +- chartjs-java-model/src/test/resources/test-template.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chartjs-java-model-demo/src/main/java/software/xdev/Application.java b/chartjs-java-model-demo/src/main/java/software/xdev/Application.java index 3d16e65..4dc8b3d 100644 --- a/chartjs-java-model-demo/src/main/java/software/xdev/Application.java +++ b/chartjs-java-model-demo/src/main/java/software/xdev/Application.java @@ -45,7 +45,7 @@ private static void createAndOpenTestFile(final Chart chart) + "\n" + "\t\n" + "\t\t\n" - + "\t\t\n" + + "\t\t\n" + "\t\n" + "\t\n" + "\t\t\n" diff --git a/chartjs-java-model/src/test/resources/test-template.html b/chartjs-java-model/src/test/resources/test-template.html index 0a54b07..9aa08cd 100644 --- a/chartjs-java-model/src/test/resources/test-template.html +++ b/chartjs-java-model/src/test/resources/test-template.html @@ -2,7 +2,7 @@ - + From 9c9f41f9e1ef1314e839ffb275659a4d1efd1a7a Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 18 Nov 2024 11:28:53 +0100 Subject: [PATCH 27/27] Use ``CoreInteractionOptions`` for ``Options#interaction`` and ``Options#hover`` Fix #281 --- CHANGELOG.md | 2 + .../model/options/CoreInteractionOptions.java | 71 +++++++++++++++++ .../xdev/chartjs/model/options/Hover.java | 77 ------------------- .../xdev/chartjs/model/options/Options.java | 21 +++-- 4 files changed, 88 insertions(+), 83 deletions(-) create mode 100644 chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/CoreInteractionOptions.java delete mode 100644 chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Hover.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dd511d..297ded3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 2.4.0 * PointStyle can also contain non-string constants #280 +* Use ``CoreInteractionOptions`` for ``Options#interaction`` and ``Options#hover`` #281 +* Updated dependencies ## 2.3.1 * Synced ``LineOptions/DataSet`` ``stepped`` and ``tension`` with ChartJS source #262 diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/CoreInteractionOptions.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/CoreInteractionOptions.java new file mode 100644 index 0000000..5145f8b --- /dev/null +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/CoreInteractionOptions.java @@ -0,0 +1,71 @@ +/* + * Copyright © 2023 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.chartjs.model.options; + +/** + * @see ChartJS Source + */ +public class CoreInteractionOptions +{ + protected String mode; + protected Boolean intersect; + protected String axis; + protected Boolean includeInvisible; + + public String getMode() + { + return this.mode; + } + + public CoreInteractionOptions setMode(final String mode) + { + this.mode = mode; + return this; + } + + public Boolean getIntersect() + { + return this.intersect; + } + + public CoreInteractionOptions setIntersect(final Boolean intersect) + { + this.intersect = intersect; + return this; + } + + public String getAxis() + { + return this.axis; + } + + public CoreInteractionOptions setAxis(final String axis) + { + this.axis = axis; + return this; + } + + public Boolean getIncludeInvisible() + { + return this.includeInvisible; + } + + public CoreInteractionOptions setIncludeInvisible(final Boolean includeInvisible) + { + this.includeInvisible = includeInvisible; + return this; + } +} diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Hover.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Hover.java deleted file mode 100644 index f078fe9..0000000 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Hover.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright © 2023 XDEV Software (https://xdev.software) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package software.xdev.chartjs.model.options; - -import software.xdev.chartjs.model.enums.HoverMode; -import software.xdev.chartjs.model.javascript.JavaScriptFunction; - - -public class Hover -{ - protected HoverMode mode; - protected JavaScriptFunction onHover; - - /** - * @see #setMode(HoverMode) - */ - public HoverMode getMode() - { - return this.mode; - } - - /** - *

- * Default {@code single} - *

- * - *

- * Sets which elements hover. Acceptable options are 'single', 'label', 'x-axis', or 'dataset'. - *

- *
    - *
  • {@code single} highlights the closest element. - *
  • {@code label} highlights elements in all datasets at the same X value. - *
  • {@code x-axis} also highlights elements in all datasets at the same X - * value, but activates when hovering anywhere within the vertical slice of - * the x-axis representing that X value. - *
  • {@code dataset} highlights the closest dataset. - *
- */ - public Hover setMode(final HoverMode mode) - { - this.mode = mode; - return this; - } - - /** - * @see #setOnHover(JavaScriptFunction) - */ - public JavaScriptFunction getOnHover() - { - return this.onHover; - } - - /** - * Default {@code null}
- *

- * Called when any of the events fire. Called in the context of the chart and passed an array of active elements - * (bars, points, etc) - */ - public Hover setOnHover(final JavaScriptFunction onHover) - { - this.onHover = onHover; - return this; - } -} diff --git a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java index 309d13e..9afdc3a 100644 --- a/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java +++ b/chartjs-java-model/src/main/java/software/xdev/chartjs/model/options/Options.java @@ -40,7 +40,8 @@ public class Options, A extends Animation> protected JavaScriptFunction onClick; protected JavaScriptFunction legendCallback; protected JavaScriptFunction onResize; - protected Hover hover; + protected CoreInteractionOptions interaction; + protected CoreInteractionOptions hover; protected Animations animations; protected Boolean animation = true; protected Layout layout; @@ -215,10 +216,18 @@ public T setOnResize(final JavaScriptFunction onResize) return this.self(); } - /** - * @see #setHover(Hover) - */ - public Hover getHover() + public CoreInteractionOptions getInteraction() + { + return this.interaction; + } + + public T setInteraction(final CoreInteractionOptions interaction) + { + this.interaction = interaction; + return this.self(); + } + + public CoreInteractionOptions getHover() { return this.hover; } @@ -227,7 +236,7 @@ public Hover getHover() * The hover configuration is passed into the options.hover namespace. The global hover configuration is at * Chart.defaults.global.hover. */ - public T setHover(final Hover hover) + public T setHover(final CoreInteractionOptions hover) { this.hover = hover; return this.self();