Skip to content

Commit 30ebfbc

Browse files
author
Robert Winkler
committed
Improved ThingBuilder
1 parent d3340f4 commit 30ebfbc

File tree

21 files changed

+608
-71
lines changed

21 files changed

+608
-71
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
version: 2
6+
updates:
7+
- package-ecosystem: "gradle"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# This workflow uses actions that are not certified by GitHub.
6+
# They are provided by a third-party and are governed by
7+
# separate terms of service, privacy policy, and support
8+
# documentation.
9+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
10+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
11+
12+
name: Gradle Package
13+
14+
on:
15+
push:
16+
tags: [ 'releasemain' ]
17+
18+
jobs:
19+
build:
20+
name: "Publish"
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
packages: write
25+
26+
steps:
27+
- name: Get Token
28+
uses: actions/create-github-app-token@v1
29+
id: app-token
30+
with:
31+
app-id: ${{ secrets.LMOS_COMMITER_APPID }}
32+
private-key: ${{ secrets.LMOS_COMMITER }}
33+
34+
- name: Checkout main
35+
uses: actions/checkout@v4
36+
with:
37+
ref: 'main'
38+
fetch-depth: '0'
39+
token: ${{ steps.app-token.outputs.token }}
40+
41+
- name: Drop release tag
42+
run: git push origin :releasemain
43+
44+
- name: Set up JDK 21
45+
uses: actions/setup-java@v4
46+
with:
47+
java-version: '21'
48+
distribution: 'temurin'
49+
50+
- name: Generate versions
51+
uses: HardNorth/[email protected]
52+
with:
53+
version-source: file
54+
version-file: gradle.properties
55+
version-file-extraction-pattern: '(?<=version=).+'
56+
next-version-increment-minor: true
57+
58+
- name: Validate Gradle
59+
uses: gradle/actions/[email protected]
60+
61+
- name: Setup Gradle
62+
uses: gradle/actions/[email protected]
63+
64+
- name: Git init
65+
run: git config --global user.email "[email protected]" && git config --global user.name "CICD"
66+
67+
- name: Update version
68+
run: ./gradlew :release -x build -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{ env.RELEASE_VERSION }} -Prelease.newVersion=${{ env.NEXT_VERSION }} --no-parallel
69+
env:
70+
GITHUB_USER: ${{ github.actor }}
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Checkout release tag
74+
uses: actions/checkout@v4
75+
with:
76+
ref: ${{ env.RELEASE_VERSION }}
77+
fetch-depth: '0'
78+
79+
- name: Publish release
80+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
81+
env:
82+
GITHUB_USER: ${{ github.actor }}
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }}
85+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }}
86+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }}
87+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }}
88+
89+
- name: Build and push image to GitHub Packages
90+
run: ./gradlew bootBuildImage
91+
env:
92+
REGISTRY_URL: ghcr.io
93+
REGISTRY_USERNAME: ${{ github.actor }}
94+
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
95+
REGISTRY_NAMESPACE: lmos-ai
96+
97+
- name: Publish Chart to GitHub Packages
98+
run: ./gradlew helmPush
99+
env:
100+
REGISTRY_URL: ghcr.io
101+
REGISTRY_USERNAME: ${{ github.actor }}
102+
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
103+
REGISTRY_NAMESPACE: lmos-ai
104+
105+
- name: "Create release info"
106+
uses: "actions/github-script@v7"
107+
with:
108+
github-token: "${{ secrets.GITHUB_TOKEN }}"
109+
script: |
110+
try {
111+
const response = await github.rest.repos.createRelease({
112+
draft: false,
113+
generate_release_notes: true,
114+
name: process.env.RELEASE_VERSION,
115+
owner: context.repo.owner,
116+
prerelease: false,
117+
repo: context.repo.repo,
118+
tag_name: process.env.RELEASE_VERSION,
119+
});
120+
121+
core.exportVariable('RELEASE_ID', response.data.id);
122+
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
123+
} catch (error) {
124+
core.setFailed(error.message);
125+
}

.github/workflows/gradle.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# This workflow uses actions that are not certified by GitHub.
6+
# They are provided by a third-party and are governed by
7+
# separate terms of service, privacy policy, and support
8+
# documentation.
9+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
10+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
11+
12+
name: Java CI with Gradle
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
branches: [ "main" ]
19+
20+
jobs:
21+
validation:
22+
name: "Gradle wrapper validation"
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/[email protected]
26+
- uses: gradle/actions/[email protected]
27+
build:
28+
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Set up JDK 17
36+
uses: actions/setup-java@v4
37+
with:
38+
java-version: '17'
39+
distribution: 'temurin'
40+
- name: Setup Gradle
41+
uses: gradle/actions/setup-gradle@0d30c9111cf47a838eb69c06d13f3f51ab2ed76f # v3.1.0
42+
- name: Build with Gradle Wrapper
43+
run: ./gradlew build
44+
45+
dependency-submission:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: write
49+
steps:
50+
- uses: actions/checkout@v4
51+
- name: Set up JDK 21
52+
uses: actions/setup-java@v4
53+
with:
54+
java-version: '21'
55+
distribution: 'temurin'
56+
57+
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
58+
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
59+
- name: Generate and submit dependency graph
60+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
61+
uses: gradle/actions/dependency-submission@0d30c9111cf47a838eb69c06d13f3f51ab2ed76f # v3.1.0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: REUSE Compliance Check
6+
7+
on: [push, pull_request]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: REUSE Compliance Check
15+
uses: fsfe/reuse-action@v4

CODE_OF_CONDUCT.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2023 www.contributor-covenant.org
3+
4+
SPDX-License-Identifier: CC-BY-4.0
5+
-->
6+
7+
# Contributor Covenant Code of Conduct
8+
9+
## Our Pledge
10+
11+
We as members, contributors, and leaders pledge to make participation in our
12+
community a harassment-free experience for everyone, regardless of age, body
13+
size, visible or invisible disability, ethnicity, sex characteristics, gender
14+
identity and expression, level of experience, education, socio-economic status,
15+
nationality, personal appearance, race, caste, color, religion, or sexual
16+
identity and orientation.
17+
18+
We pledge to act and interact in ways that contribute to an open, welcoming,
19+
diverse, inclusive, and healthy community.
20+
21+
## Our Standards
22+
23+
Examples of behavior that contributes to a positive environment for our
24+
community include:
25+
26+
* Demonstrating empathy and kindness toward other people
27+
* Being respectful of differing opinions, viewpoints, and experiences
28+
* Giving and gracefully accepting constructive feedback
29+
* Accepting responsibility and apologizing to those affected by our mistakes,
30+
and learning from the experience
31+
* Focusing on what is best not just for us as individuals, but for the overall
32+
community
33+
34+
Examples of unacceptable behavior include:
35+
36+
* The use of sexualized language or imagery, and sexual attention or advances of
37+
any kind
38+
* Trolling, insulting or derogatory comments, and personal or political attacks
39+
* Public or private harassment
40+
* Publishing others' private information, such as a physical or email address,
41+
without their explicit permission
42+
* Other conduct which could reasonably be considered inappropriate in a
43+
professional setting
44+
45+
## Enforcement Responsibilities
46+
47+
Community leaders are responsible for clarifying and enforcing our standards of
48+
acceptable behavior and will take appropriate and fair corrective action in
49+
response to any behavior that they deem inappropriate, threatening, offensive,
50+
or harmful.
51+
52+
Community leaders have the right and responsibility to remove, edit, or reject
53+
comments, commits, code, wiki edits, issues, and other contributions that are
54+
not aligned to this Code of Conduct, and will communicate reasons for moderation
55+
decisions when appropriate.
56+
57+
## Scope
58+
59+
This Code of Conduct applies within all community spaces, and also applies when
60+
an individual is officially representing the community in public spaces.
61+
Examples of representing our community include using an official e-mail address,
62+
posting via an official social media account, or acting as an appointed
63+
representative at an online or offline event.
64+
65+
## Enforcement
66+
67+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
68+
reported to the community leaders responsible for enforcement at
69+
70+
All complaints will be reviewed and investigated promptly and fairly.
71+
72+
All community leaders are obligated to respect the privacy and security of the
73+
reporter of any incident.
74+
75+
## Enforcement Guidelines
76+
77+
Community leaders will follow these Community Impact Guidelines in determining
78+
the consequences for any action they deem in violation of this Code of Conduct:
79+
80+
### 1. Correction
81+
82+
**Community Impact**: Use of inappropriate language or other behavior deemed
83+
unprofessional or unwelcome in the community.
84+
85+
**Consequence**: A private, written warning from community leaders, providing
86+
clarity around the nature of the violation and an explanation of why the
87+
behavior was inappropriate. A public apology may be requested.
88+
89+
### 2. Warning
90+
91+
**Community Impact**: A violation through a single incident or series of
92+
actions.
93+
94+
**Consequence**: A warning with consequences for continued behavior. No
95+
interaction with the people involved, including unsolicited interaction with
96+
those enforcing the Code of Conduct, for a specified period of time. This
97+
includes avoiding interactions in community spaces as well as external channels
98+
like social media. Violating these terms may lead to a temporary or permanent
99+
ban.
100+
101+
### 3. Temporary Ban
102+
103+
**Community Impact**: A serious violation of community standards, including
104+
sustained inappropriate behavior.
105+
106+
**Consequence**: A temporary ban from any sort of interaction or public
107+
communication with the community for a specified period of time. No public or
108+
private interaction with the people involved, including unsolicited interaction
109+
with those enforcing the Code of Conduct, is allowed during this period.
110+
Violating these terms may lead to a permanent ban.
111+
112+
### 4. Permanent Ban
113+
114+
**Community Impact**: Demonstrating a pattern of violation of community
115+
standards, including sustained inappropriate behavior, harassment of an
116+
individual, or aggression toward or disparagement of classes of individuals.
117+
118+
**Consequence**: A permanent ban from any sort of public interaction within the
119+
community.
120+
121+
## Attribution
122+
123+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
124+
version 2.1, available at
125+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
126+
127+
Community Impact Guidelines were inspired by
128+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
129+
130+
For answers to common questions about this code of conduct, see the FAQ at
131+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
132+
[https://www.contributor-covenant.org/translations][translations].
133+
134+
[homepage]: https://www.contributor-covenant.org
135+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
136+
[Mozilla CoC]: https://github.com/mozilla/diversity
137+
[FAQ]: https://www.contributor-covenant.org/faq
138+
[translations]: https://www.contributor-covenant.org/translations

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
2+
3+
SPDX-License-Identifier: Apache-2.0

build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@ plugins {
22
kotlin("jvm") version "2.0.20"
33
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
44
id("org.jetbrains.kotlinx.kover") version "0.8.3"
5+
id("org.cadixdev.licenser") version "0.6.1"
56
}
67

8+
9+
710
subprojects {
811
apply(plugin = "org.jetbrains.kotlin.jvm")
912
apply(plugin = "org.jlleitschuh.gradle.ktlint")
1013
apply(plugin = "org.jetbrains.kotlinx.kover")
14+
apply(plugin = "org.cadixdev.licenser")
1115

1216
group = "ai.ancf.lmos"
1317
version = "1.0-SNAPSHOT"
1418

19+
license {
20+
include("**/*.java")
21+
include("**/*.kt")
22+
include("**/*.yaml")
23+
exclude("**/*.properties")
24+
}
25+
1526
dependencies {
1627
testImplementation(kotlin("test"))
1728
testImplementation ("org.jetbrains.kotlinx:kotlinx-coroutines-test")

0 commit comments

Comments
 (0)