Skip to content

Commit f9d8378

Browse files
committed
Merge branch 'master' into update-from-template-merged
2 parents 56ef08a + de9071b commit f9d8378

File tree

17 files changed

+1424
-1
lines changed

17 files changed

+1424
-1
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33

44
# Force sh files to have LF
55
*.sh text eol=lf
6+
7+
# Force MVN Wrapper Linux files LF
8+
mvnw text eol=lf
9+
.mvn/wrapper/maven-wrapper.properties text eol=lf

.github/.lycheeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Ignorefile for broken link check
22
localhost
3+
mvnrepository.com

.github/workflows/check-build.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Check Build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
paths-ignore:
8+
- '**.md'
9+
- '.config/**'
10+
- '.github/**'
11+
- '.idea/**'
12+
- 'assets/**'
13+
pull_request:
14+
branches: [ develop ]
15+
paths-ignore:
16+
- '**.md'
17+
- '.config/**'
18+
- '.github/**'
19+
- '.idea/**'
20+
- 'assets/**'
21+
22+
env:
23+
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
24+
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
30+
strategy:
31+
matrix:
32+
java: [17, 21]
33+
distribution: [temurin]
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up JDK
39+
uses: actions/setup-java@v4
40+
with:
41+
distribution: ${{ matrix.distribution }}
42+
java-version: ${{ matrix.java }}
43+
cache: 'maven'
44+
45+
- name: Build with Maven
46+
run: ./mvnw -B clean package
47+
48+
- name: Check for uncommited changes
49+
run: |
50+
if [[ "$(git status --porcelain)" != "" ]]; then
51+
echo ----------------------------------------
52+
echo git status
53+
echo ----------------------------------------
54+
git status
55+
echo ----------------------------------------
56+
echo git diff
57+
echo ----------------------------------------
58+
git diff
59+
echo ----------------------------------------
60+
echo Troubleshooting
61+
echo ----------------------------------------
62+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package"
63+
exit 1
64+
fi
65+
66+
- name: Upload demo files
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: demo-files-java-${{ matrix.java }}
70+
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
71+
if-no-files-found: error
72+
73+
code-style:
74+
runs-on: ubuntu-latest
75+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
76+
77+
strategy:
78+
matrix:
79+
java: [17]
80+
distribution: [temurin]
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Set up JDK
86+
uses: actions/setup-java@v4
87+
with:
88+
distribution: ${{ matrix.distribution }}
89+
java-version: ${{ matrix.java }}
90+
cache: 'maven'
91+
92+
- name: Run Checkstyle
93+
run: ./mvnw -B checkstyle:check -P checkstyle -T2C

.github/workflows/release.yml

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
env:
8+
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
check-code:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
cache: 'maven'
26+
27+
- name: Build with Maven
28+
run: ./mvnw -B clean package
29+
30+
- name: Check for uncommited changes
31+
run: |
32+
if [[ "$(git status --porcelain)" != "" ]]; then
33+
echo ----------------------------------------
34+
echo git status
35+
echo ----------------------------------------
36+
git status
37+
echo ----------------------------------------
38+
echo git diff
39+
echo ----------------------------------------
40+
git diff
41+
echo ----------------------------------------
42+
echo Troubleshooting
43+
echo ----------------------------------------
44+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package"
45+
exit 1
46+
fi
47+
48+
prepare-release:
49+
runs-on: ubuntu-latest
50+
needs: [check-code]
51+
outputs:
52+
upload_url: ${{ steps.create_release.outputs.upload_url }}
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Configure Git
57+
run: |
58+
git config --global user.email "[email protected]"
59+
git config --global user.name "GitHub Actions"
60+
61+
- name: Un-SNAP
62+
run: |
63+
mvnwPath=$(readlink -f ./mvnw)
64+
modules=("") # root
65+
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
66+
for i in "${modules[@]}"
67+
do
68+
echo "Processing $i/pom.xml"
69+
(cd "$i" && $mvnwPath -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false)
70+
done
71+
72+
- name: Get version
73+
id: version
74+
run: |
75+
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
76+
echo "release=$version" >> $GITHUB_OUTPUT
77+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
78+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
79+
80+
- name: Commit and Push
81+
run: |
82+
git add -A
83+
git commit -m "Release ${{ steps.version.outputs.release }}"
84+
git push origin
85+
git tag v${{ steps.version.outputs.release }}
86+
git push origin --tags
87+
88+
- name: Create Release
89+
id: create_release
90+
uses: shogo82148/actions-create-release@v1
91+
with:
92+
tag_name: v${{ steps.version.outputs.release }}
93+
release_name: v${{ steps.version.outputs.release }}
94+
commitish: master
95+
body: |
96+
## [Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
97+
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
98+
99+
## Installation
100+
Add the following lines to your pom:
101+
```XML
102+
<dependency>
103+
<groupId>software.xdev</groupId>
104+
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
105+
<version>${{ steps.version.outputs.release }}</version>
106+
</dependency>
107+
```
108+
109+
publish-maven:
110+
runs-on: ubuntu-latest
111+
needs: [prepare-release]
112+
steps:
113+
- uses: actions/checkout@v4
114+
115+
- name: Init Git and pull
116+
run: |
117+
git config --global user.email "[email protected]"
118+
git config --global user.name "GitHub Actions"
119+
git pull
120+
121+
- name: Set up JDK Apache Maven Central
122+
uses: actions/setup-java@v4
123+
with: # running setup-java again overwrites the settings.xml
124+
java-version: '17'
125+
distribution: 'temurin'
126+
server-id: ossrh
127+
server-username: MAVEN_CENTRAL_USERNAME
128+
server-password: MAVEN_CENTRAL_TOKEN
129+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
130+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
131+
132+
- name: Publish to Apache Maven Central
133+
run: ../mvnw -B deploy -Possrh
134+
env:
135+
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
136+
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
137+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
138+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
139+
140+
publish-pages:
141+
runs-on: ubuntu-latest
142+
needs: [prepare-release]
143+
steps:
144+
- uses: actions/checkout@v4
145+
146+
- name: Init Git and pull
147+
run: |
148+
git config --global user.email "[email protected]"
149+
git config --global user.name "GitHub Actions"
150+
git pull
151+
152+
- name: Setup - Java
153+
uses: actions/setup-java@v4
154+
with:
155+
java-version: '17'
156+
distribution: 'temurin'
157+
cache: 'maven'
158+
159+
- name: Build site
160+
run: ../mvnw -B site
161+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
162+
163+
- name: Deploy to Github pages
164+
uses: peaceiris/actions-gh-pages@v4
165+
with:
166+
github_token: ${{ secrets.GITHUB_TOKEN }}
167+
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
168+
169+
after-release:
170+
runs-on: ubuntu-latest
171+
needs: [publish-maven]
172+
steps:
173+
- uses: actions/checkout@v4
174+
175+
- name: Init Git and pull
176+
run: |
177+
git config --global user.email "[email protected]"
178+
git config --global user.name "GitHub Actions"
179+
git pull
180+
181+
- name: Inc Version and SNAP
182+
run: |
183+
mvnwPath=$(readlink -f ./mvnw)
184+
modules=("") # root
185+
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
186+
for i in "${modules[@]}"
187+
do
188+
echo "Processing $i/pom.xml"
189+
(cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true)
190+
done
191+
192+
- name: Git Commit and Push
193+
run: |
194+
git add -A
195+
git commit -m "Preparing for next development iteration"
196+
git push origin
197+
198+
- name: pull-request
199+
env:
200+
GH_TOKEN: ${{ github.token }}
201+
run: |
202+
gh_pr_up() {
203+
gh pr create "$@" || gh pr edit "$@"
204+
}
205+
gh_pr_up -B "develop" \
206+
--title "Sync back" \
207+
--body "An automated PR to sync changes back"

.github/workflows/sonar.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Sonar
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
paths-ignore:
8+
- '**.md'
9+
- '.config/**'
10+
- '.github/**'
11+
- '.idea/**'
12+
- 'assets/**'
13+
pull_request:
14+
types: [opened, synchronize, reopened]
15+
paths-ignore:
16+
- '**.md'
17+
- '.config/**'
18+
- '.github/**'
19+
- '.idea/**'
20+
- 'assets/**'
21+
22+
env:
23+
SONARCLOUD_ORG: ${{ github.event.organization.login }}
24+
SONARCLOUD_HOST: https://sonarcloud.io
25+
26+
jobs:
27+
token-check:
28+
runs-on: ubuntu-latest
29+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }}
30+
outputs:
31+
hasToken: ${{ steps.check-token.outputs.has }}
32+
steps:
33+
- id: check-token
34+
run: |
35+
[ -z $SONAR_TOKEN ] && echo "has=false" || echo "has=true" >> "$GITHUB_OUTPUT"
36+
env:
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
38+
39+
sonar-scan:
40+
runs-on: ubuntu-latest
41+
needs: token-check
42+
if: ${{ needs.token-check.outputs.hasToken }}
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
47+
48+
- name: Set up JDK
49+
uses: actions/setup-java@v4
50+
with:
51+
distribution: 'temurin'
52+
java-version: 17
53+
54+
- name: Cache SonarCloud packages
55+
uses: actions/cache@v4
56+
with:
57+
path: ~/.sonar/cache
58+
key: ${{ runner.os }}-sonar
59+
restore-keys: ${{ runner.os }}-sonar
60+
61+
- name: Cache Maven packages
62+
uses: actions/cache@v4
63+
with:
64+
path: ~/.m2
65+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
66+
restore-keys: ${{ runner.os }}-m2
67+
68+
- name: Build with Maven
69+
run: |
70+
./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
71+
-DskipTests \
72+
-Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} \
73+
-Dsonar.organization=${{ env.SONARCLOUD_ORG }} \
74+
-Dsonar.host.url=${{ env.SONARCLOUD_HOST }}
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
77+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)