Skip to content

Commit

Permalink
Initial version of YARB
Browse files Browse the repository at this point in the history
  • Loading branch information
dfuchss committed Jul 27, 2024
0 parents commit b2d5330
Show file tree
Hide file tree
Showing 19 changed files with 757 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.gitignore
.gitattributes
.idea
target
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 160
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @dfuchss
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "monthly"
time: "11:00"
timezone: "Europe/Berlin"
commit-message:
prefix: "Dependency"
include: "scope"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
time: "11:00"
timezone: "Europe/Berlin"
commit-message:
prefix: "Dependency"
include: "scope"
14 changes: 14 additions & 0 deletions .github/workflows/dependency-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Maven Dependency Updates

on:
schedule:
- cron: "00 11 1 * *"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update:
uses: dfuchss/actions/.github/workflows/maven-update.yml@main
secrets:
PAT: ${{ secrets.PAT }}
22 changes: 22 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Docker Push

on:
workflow_dispatch:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
paths-ignore:
- '**.md'
- '.github/**'

# Publish `v1.2.3` tags as releases.
tags:
- v*

jobs:
push:
uses: dfuchss/actions/.github/workflows/docker.yml@main
with:
image-name: yarb
push: true
23 changes: 23 additions & 0 deletions .github/workflows/maven-manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Maven Release (Manual)

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
release-version:
type: string
description: The version for release. E.g., "1.2.3"
required: true
next-version:
type: string
description: The version after release. E.g., "2.0.0-SNAPSHOT"
required: true
jobs:
release:
uses: dfuchss/actions/.github/workflows/maven-manual-release.yml@main
secrets:
# Needs to be a personal access token to push as a certain user; otherwise actions won't be triggered.
PAT: ${{ secrets.PAT }}
with:
release-version: ${{ github.event.inputs.release-version }}
next-version: ${{ github.event.inputs.next-version }}
12 changes: 12 additions & 0 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Maven Release

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update:
uses: dfuchss/actions/.github/workflows/maven-release.yml@main
secrets:
# Needs to be a personal access token to push as a certain user; otherwise actions won't be triggered.
PAT: ${{ secrets.PAT }}
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Create Release
on:
workflow_dispatch:
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*

jobs:
release:
uses: dfuchss/actions/.github/workflows/github-release.yml@main

23 changes: 23 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Spotless & Formatter Checks

on:
push:
paths:
- '**/src/**'
- '**/pom.xml'
- 'pom.xml'
pull_request:
types: [ opened, synchronize, reopened ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
verify:
uses: dfuchss/actions/.github/workflows/maven.yml@main
with:
deploy: false
secrets:
OSSRH_USER: ""
OSSRH_TOKEN: ""
GPG_KEY: ""
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
config*.json
!config-sample.json
*.iml
target
docker-compose.yml
!data/.gitkeep
data
1 change: 1 addition & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--add-opens java.base/java.lang=ALL-UNNAMED
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM maven:3-eclipse-temurin-21 AS builder

WORKDIR /usr/src/bot
COPY src src
COPY pom.xml pom.xml
RUN mvn clean package

FROM eclipse-temurin:21-jre

ENV RUN_IN_DOCKER=true
ENV TZ=Europe/Berlin
ENV CONFIG_PATH=/usr/src/bot/data/config.json

WORKDIR /usr/src/bot
COPY --from=builder /usr/src/bot/target/yarb-*-jar-with-dependencies.jar yarb.jar

VOLUME /usr/src/bot/data

ENTRYPOINT java -jar /usr/src/bot/yarb.jar
15 changes: 15 additions & 0 deletions config-sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"prefix": "yarb",
"baseUrl": "https://matrix-client.matrix.org",
"username": "",
"password": "",
"dataDirectory": "./data/",
"admins": [
"@dominik:fuchss.org"
],
"users": [
":matrix.org",
":fuchss.org"
],
"offset_in_minutes": 0
}
180 changes: 180 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.fuchss</groupId>
<artifactId>maven-parent</artifactId>
<version>0.21.28</version>
</parent>
<groupId>org.fuchss.matrix</groupId>
<artifactId>yarb</artifactId>
<version>0.1.0-SNAPSHOT</version>

<developers>
<developer>
<id>dfuchss</id>
<name>Dominik Fuchss</name>
<email>[email protected]</email>
<url>https://www.fuchss.org</url>
<timezone>GMT+1</timezone>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/dfuchss/YARB.git</connection>
<developerConnection>scm:git:ssh://github.com:dfuchss/YARB.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/dfuchss/YARB/tree/main</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.class>org.fuchss.matrix.yarb.MainKt</main.class>
</properties>

<dependencies>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.fuchss</groupId>
<artifactId>matrix-bot-base</artifactId>
<version>0.11.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>mavenSnapshot</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration combine.self="append">
<kotlin>
<ktlint>
<editorConfigPath>.editorconfig</editorConfigPath>
</ktlint>
</kotlin>
</configuration>
<executions>
<execution>
<id>spotless:check</id>
<goals>
<goal>check</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<compilerPlugins>
<plugin>kotlinx-serialization</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-serialization</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<phase>test-compile</phase>
</execution>
</executions>
</plugin>
</plugins>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
</build>
</project>
Loading

0 comments on commit b2d5330

Please sign in to comment.