Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
63db25b
update gradle wrapper
UpcraftLP Feb 29, 2024
0ffcdd1
fix project name capitalization
UpcraftLP Feb 29, 2024
da5f05f
use java toolchains
UpcraftLP Feb 29, 2024
ab9cf57
set up database and create bootstrap configuration
UpcraftLP Mar 2, 2024
f049fec
add initial DB migration
UpcraftLP Mar 2, 2024
655ab3d
replace ArgsParser with picocli
UpcraftLP Mar 2, 2024
907fe71
refactor downloading, implement maven and raw URLs
UpcraftLP Mar 3, 2024
2093a0a
temp fix compile errors
UpcraftLP Mar 3, 2024
fbdc31e
drop url-to-maven parsing
UpcraftLP Mar 6, 2024
f039b3d
switch hashes to SHA-512
UpcraftLP Mar 6, 2024
a9de218
fix maven downloading and hook up discord app
UpcraftLP Mar 7, 2024
3cf2b8d
better discord message parsing
UpcraftLP Mar 7, 2024
ef341f3
todo: done!
UpcraftLP Mar 7, 2024
b01a52e
update config serialization
UpcraftLP Mar 7, 2024
fa9ff98
implement modrinth downloading
UpcraftLP Mar 7, 2024
2e4d394
minor cleanup
UpcraftLP Mar 7, 2024
551c78b
streamline download behavior
UpcraftLP Mar 7, 2024
604955d
overhaul configs
UpcraftLP Mar 7, 2024
3c28071
set up DB connections
UpcraftLP Mar 7, 2024
6d86b6a
remove unused class
UpcraftLP Mar 7, 2024
2c3c13b
bootstrap database on app start
UpcraftLP Mar 7, 2024
7238bf7
implement mod info parsing
UpcraftLP Mar 10, 2024
8047bbd
fix path validation erroring on nonexistent paths
UpcraftLP Mar 10, 2024
4987cc5
move parser related classes to separate package
UpcraftLP Mar 10, 2024
dac2d57
set up GH actions and Dockerfile
UpcraftLP Mar 11, 2024
11ae5ba
also build on tag push
UpcraftLP Mar 11, 2024
1c13617
remove unused volume
UpcraftLP Mar 11, 2024
8c17404
fix docker build
UpcraftLP Mar 11, 2024
1191c96
a
UpcraftLP Mar 11, 2024
dce5e25
update ghcr tags, set gradle to not use a daemon
UpcraftLP Mar 11, 2024
2249339
Revert "a"
UpcraftLP Mar 11, 2024
15ff1f4
update README
UpcraftLP Mar 11, 2024
151a53c
default to new files not being active
UpcraftLP Mar 11, 2024
ec56cb9
implement approval system
UpcraftLP Mar 12, 2024
a1a0b31
switch to apache http client
UpcraftLP Mar 13, 2024
c7dc3ee
add default user agent and refactor http handlers
UpcraftLP Mar 13, 2024
7bfb401
add curseforge download support
UpcraftLP Mar 14, 2024
9f7e4f2
allow shorthand cf and mr for download matching
UpcraftLP Mar 14, 2024
cf98459
update gradle wrapper
UpcraftLP May 8, 2024
99ade7a
update GH actions scripts
UpcraftLP May 8, 2024
7eceb28
remove leftover comment
UpcraftLP May 8, 2024
831223c
fix typo
UpcraftLP May 9, 2024
2423abc
fix test compile errors
UpcraftLP May 9, 2024
6486619
add neoforge.mods.toml support
UpcraftLP Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Status

on:
push:
pull_request:

jobs:
build:
env:
JAVA_VERSION: 21
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew --no-daemon build
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}
path: |
build/libs/*.jar
!build/libs/*-slim.jar
57 changes: 57 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Upload to GHCR

on:
push:
branches:
- '*'
tags:
- '*'

jobs:
build:
env:
JAVA_VERSION: 21
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew --no-daemon installShadowDist
- name: Setup Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Log into container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
# default values
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
JAVA_VERSION=${{ env.JAVA_VERSION }}
VERSION=${{ github.ref_name }}
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
.idea/
*.iws
*.iml
*.ipr
Expand Down Expand Up @@ -41,6 +38,7 @@ bin/
### Mac OS ###
.DS_Store

run/
config.json
downloads/
.idea
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG JAVA_VERSON=21

FROM mcr.microsoft.com/openjdk/jdk:${JAVA_VERSON}-distroless

WORKDIR /app

VOLUME /app/data

ENV CONFIG_FILE=/app/config.json

COPY build/install/Ember-shadow/lib/Ember-*.jar Ember.jar

ENTRYPOINT ["java", "-XshowSettings:vm", "-XX:MinRAMPercentage=20", "-XX:MaxRAMPercentage=95", "-jar", "Ember.jar", "--config", "${CONFIG_FILE}"]
Comment thread
UpcraftLP marked this conversation as resolved.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ember
# Ember [![Build Status](https://github.com/forgecraft/Ember/actions/workflows/build_status.yml/badge.svg)](https://github.com/forgecraft/Ember/actions/workflows/build_status.yml)

Ember is our resident ForgeCraft Discord bot. It's a relatively simple bot that just helps with the day to day running of the server. It's written in Java and JavaCord.

Expand All @@ -19,4 +19,4 @@ If you would like to contribute to Ember, please feel free to fork the repositor

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
This project is licensed under the MIT License - see the [LICENSE file](LICENSE.md) for details.
135 changes: 129 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ import org.jetbrains.gradle.ext.runConfigurations
import org.jetbrains.gradle.ext.settings

plugins {
id("java")
id("application")
java
application
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.3"
id("org.jooq.jooq-codegen-gradle") version "3.19.5"
id("com.github.johnrengelman.shadow") version "8.1.1"
}

val javaVersion = 21

group = "net.forgecraft.services"
version = "1.0.0"

sourceSets {
create("generated")
create("database")
}

repositories {
mavenCentral()
}
Expand All @@ -22,28 +31,142 @@ dependencies {
implementation("org.javacord:javacord:3.8.0")

implementation("org.apache.logging.log4j:log4j-to-slf4j:2.22.1")
implementation("ch.qos.logback:logback-classic:1.5.0")
sourceSets.getByName("database").implementationConfigurationName("org.apache.logging.log4j:log4j-to-slf4j:2.22.1")

runtimeOnly("ch.qos.logback:logback-classic:1.5.0")
sourceSets.getByName("database").runtimeOnlyConfigurationName("ch.qos.logback:logback-classic:1.5.0")

// Jackson
implementation("com.fasterxml.jackson.core:jackson-core:2.16.1")
implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1")
runtimeOnly("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1")

implementation("org.jooq:jooq:3.19.5")
sourceSets.getByName("database").implementationConfigurationName("org.jooq:jooq:3.19.5")
sourceSets.getByName("generated").implementationConfigurationName("org.jooq:jooq:3.19.5")

runtimeOnly("org.xerial:sqlite-jdbc:3.45.1.0")
sourceSets.getByName("database").runtimeOnlyConfigurationName("org.xerial:sqlite-jdbc:3.45.1.0")
jooqCodegen("org.xerial:sqlite-jdbc:3.45.1.0")

// Utils
implementation("commons-io:commons-io:2.15.1")
implementation("org.jetbrains:annotations:24.1.0")
implementation("com.google.guava:guava:33.0.0-jre")
implementation("it.unimi.dsi:fastutil:8.5.13")
implementation("com.electronwill.night-config:toml:3.6.7")
implementation("io.github.matyrobbrt:curseforgeapi:1.8.0")
Comment thread
MichaelHillcox marked this conversation as resolved.

implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1")
Comment thread
MichaelHillcox marked this conversation as resolved.

implementation("info.picocli:picocli:4.7.5")
annotationProcessor("info.picocli:picocli-codegen:4.7.5")

compileOnly("org.jetbrains:annotations:24.1.0")
sourceSets.getByName("database").compileOnlyConfigurationName("org.jetbrains:annotations:24.1.0")

implementation(sourceSets.getByName("database").output)
implementation(sourceSets.getByName("generated").output)
}

tasks.named("shadowJar", Jar::class).configure {
archiveClassifier.set("")
archiveVersion.set(project.version.toString())
}

tasks.named("jar", Jar::class).configure {
archiveClassifier.set("slim")

manifest.attributes(
"Specification-Vendor" to "ForgeCraft (https://forgecraft.net)",
"Implementation-Vendor" to "https://github.com/forgecraft/Ember",
"Implementation-Title" to "Ember",
"Implementation-Version" to project.version.toString(),
)
}

tasks.withType(JavaCompile::class).configureEach {
options.encoding = "UTF-8"
options.release.set(javaVersion)
}

tasks.named("compileJava", JavaCompile::class).configure {
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
}
}

jooq {
version = "3.19.5"

configuration {

jdbc {
driver = "org.sqlite.JDBC"
url = "jdbc:sqlite:${project.file("run/data/sqlite.db").path}"
}

generator {
database {
name = "org.jooq.meta.sqlite.SQLiteDatabase"
includes = ".*"

// exclude the migrations table from schema generation
excludes = """
__migrations
""".trimIndent()
}

target {
packageName = "net.forgecraft.services.ember.db.schema"
directory = project.file("src/generated/java").path
}
}
}

project.file("run/data").mkdirs()
}

// Runs for intelij
idea.project.settings {
runConfigurations {
register("Start Ember", Application::class) {
project.file("run").mkdirs()
mainClass = "net.forgecraft.services.ember.Main"
programParameters = "--config=config.json"
moduleName = "ember.main"
moduleName = "${project.name}.main"
workingDirectory = project.file("run").path
}

register("Bootstrap Database", Application::class) {
project.file("run").mkdirs()
mainClass = "net.forgecraft.services.ember.db.Main"
moduleName = "${project.name}.database"
workingDirectory = project.file("run").path
}
}
}

// configure the java application plugin for CI and anyone not using IDEA
application {
mainClass.set("net.forgecraft.services.ember.Main")
executableDir = project.file("run").path
}

tasks.named("run", JavaExec::class) {
args("--config=config.json")
}

tasks.register("boostrapDatabase", JavaExec::class) {
group = "application"
mainClass.set("net.forgecraft.services.ember.db.Main")
classpath = sourceSets.getByName("database").runtimeClasspath
workingDir = project.file("run")
}
tasks.getByName("jooqCodegen").dependsOn("boostrapDatabase")

tasks.test {
useJUnitPlatform()
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Wed Feb 21 21:24:02 GMT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading