-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a7cdfe2
Showing
126 changed files
with
3,014 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Java CI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 | ||
with: | ||
gradle-version: 8.5 | ||
arguments: jib | ||
env: | ||
USERNAME: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | ||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
# Local | ||
application-local.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Janitorr - Cleans up your media library | ||
|
||
## Not ready for release | ||
Please do not use this yet. It's still undergoing testing. | ||
It does NOT YET check whether certain media is still seeding before deleting it. | ||
It does ALSO NOT YET create "Leaving Soon" libraries in Jellyfin. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
import com.google.cloud.tools.jib.api.buildplan.ImageFormat | ||
import org.gradle.plugins.ide.idea.model.IdeaModel | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import net.nemerosa.versioning.VersioningExtension | ||
import org.springframework.boot.gradle.dsl.SpringBootExtension | ||
|
||
plugins { | ||
|
||
id("idea") | ||
id("org.springframework.boot") version "3.2.1" | ||
id("io.spring.dependency-management") version "1.1.4" | ||
id("com.google.cloud.tools.jib") version "3.4.0" | ||
id("net.nemerosa.versioning") version "2.8.2" | ||
|
||
kotlin("jvm") version "1.9.22" | ||
kotlin("plugin.spring") version "1.9.22" | ||
|
||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("org.jetbrains.kotlin:kotlin-reflect") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") | ||
|
||
implementation("io.github.openfeign:feign-core:13.1") | ||
implementation("io.github.openfeign:feign-jackson:13.1") | ||
implementation("io.github.openfeign:feign-httpclient:13.1") | ||
|
||
developmentOnly("org.springframework.boot:spring-boot-devtools") | ||
|
||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
|
||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") | ||
} | ||
|
||
configure<SpringBootExtension> { | ||
buildInfo() | ||
} | ||
|
||
configure<IdeaModel> { | ||
module { | ||
inheritOutputDirs = true | ||
} | ||
} | ||
|
||
kotlin { | ||
jvmToolchain { | ||
languageVersion.set(JavaLanguageVersion.of(21)) | ||
vendor.set(JvmVendorSpec.ADOPTIUM) | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
sourceCompatibility = JavaVersion.VERSION_21.toString() | ||
targetCompatibility = JavaVersion.VERSION_21.toString() | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs = listOf("-Xjsr305=strict") | ||
jvmTarget = JavaVersion.VERSION_21.toString() | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
|
||
configure<VersioningExtension> { | ||
/** | ||
* Add GitHub CI branch name environment variable | ||
*/ | ||
branchEnv = listOf("GITHUB_REF_NAME") | ||
} | ||
|
||
extra { | ||
val build = getBuild() | ||
val versioning: VersioningExtension = extensions.getByName<VersioningExtension>("versioning") | ||
val branch = versioning.info.branch | ||
val shortCommit = versioning.info.commit.take(8) | ||
|
||
project.extra["build.date-time"] = build.buildDateAndTime | ||
project.extra["build.date"] = build.formattedBuildDate() | ||
project.extra["build.time"] = build.formattedBuildTime() | ||
project.extra["build.revision"] = versioning.info.commit | ||
project.extra["build.revision.abbreviated"] = shortCommit | ||
project.extra["build.branch"] = branch | ||
project.extra["build.user"] = build.userName() | ||
|
||
val containerImageName = "schaka/${project.name}" | ||
val containerImageTags = mutableSetOf(shortCommit, branch) | ||
if (branch == "main") { | ||
containerImageTags.add("latest") | ||
} | ||
|
||
project.extra["docker.image.name"] = containerImageName | ||
project.extra["docker.image.version"] = branch | ||
project.extra["docker.image.source"] = build.projectSourceRoot() | ||
project.extra["docker.image.tags"] = containerImageTags | ||
|
||
} | ||
|
||
|
||
jib { | ||
to { | ||
image = "docker.io/${project.extra["docker.image.name"]}" | ||
tags = project.extra["docker.image.tags"] as Set<String> | ||
|
||
auth { | ||
username = System.getenv("DOCKERHUB_USER") | ||
password = System.getenv("DOCKERHUB_PASSWORD") | ||
} | ||
} | ||
from { | ||
image = "eclipse-temurin:21-jre-jammy" | ||
auth { | ||
username = System.getenv("DOCKERHUB_USER") | ||
password = System.getenv("DOCKERHUB_PASSWORD") | ||
} | ||
platforms { | ||
platform { | ||
architecture = "amd64" | ||
os = "linux" | ||
} | ||
platform { | ||
architecture = "arm64" | ||
os = "linux" | ||
} | ||
} | ||
} | ||
container { | ||
jvmFlags = listOf("-Dspring.config.additional-location=optional:file:/config/application.yaml", "-Xms512m") | ||
mainClass = "com.github.schaka.janitorr.JanitorrApplicationKt" | ||
ports = listOf("8978") | ||
format = ImageFormat.Docker | ||
volumes = listOf("/config") | ||
|
||
labels.set( | ||
mapOf( | ||
"org.opencontainers.image.created" to "${project.extra["build.date"]}T${project.extra["build.time"]}", | ||
"org.opencontainers.image.revision" to project.extra["build.revision"] as String, | ||
"org.opencontainers.image.version" to project.version as String, | ||
"org.opencontainers.image.title" to project.name, | ||
"org.opencontainers.image.authors" to "Schaka <[email protected]>", | ||
"org.opencontainers.image.source" to project.extra["docker.image.source"] as String, | ||
"org.opencontainers.image.description" to project.description, | ||
) | ||
) | ||
|
||
|
||
// Exclude all "developmentOnly" dependencies, e.g. Spring devtools. | ||
configurationName.set("productionRuntimeClasspath") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
group = "com.github.schaka.janitorr" | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
sourceCompatibility = JavaVersion.VERSION_21.toString() | ||
targetCompatibility = JavaVersion.VERSION_21.toString() | ||
} | ||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions { | ||
freeCompilerArgs = listOf("-Xjsr305=strict") | ||
jvmTarget = JavaVersion.VERSION_21.toString() | ||
} | ||
} |
Oops, something went wrong.