mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-07-01 12:57:24 +00:00
Compare commits
1 Commits
v0.5.2
...
change-def
Author | SHA1 | Date | |
---|---|---|---|
2a08f28838
|
@ -1,2 +0,0 @@
|
|||||||
**/
|
|
||||||
!scalabot-app/build/install/
|
|
1
.github/workflows/build-and-test.yml
vendored
1
.github/workflows/build-and-test.yml
vendored
@ -25,7 +25,6 @@ jobs:
|
|||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'adopt-hotspot'
|
distribution: 'adopt-hotspot'
|
||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
|
65
.github/workflows/create-release.yml
vendored
65
.github/workflows/create-release.yml
vendored
@ -1,65 +0,0 @@
|
|||||||
name: Create release draft
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v[0-9]+.[0-9]+.[0-9]+*'
|
|
||||||
|
|
||||||
# 该 Action 有以下步骤:
|
|
||||||
# 1. 拉取并构建代码, 然后生成 Application 发行包;
|
|
||||||
# 2. 创建 Release, 并标记为 Draft(草稿);
|
|
||||||
# 3. 上传 Application 发行包;
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
create-release:
|
|
||||||
timeout-minutes: 10
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
# 创建更新日志.
|
|
||||||
- name: 'Get Previous tag'
|
|
||||||
id: previous-tag
|
|
||||||
uses: younited/get-previous-tag-action@v1.0.0
|
|
||||||
with:
|
|
||||||
match: "v*.*.*"
|
|
||||||
- name: Set up Python 3
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
- name: Install Commitizen
|
|
||||||
run: pip install -U commitizen
|
|
||||||
- name: Create Change log
|
|
||||||
run: cz ch --start-rev ${{ steps.previous-tag.outputs.previous-tag }} --file-name ${{ github.workspace }}/CURRENT_CHANGELOG.md
|
|
||||||
|
|
||||||
# 开始构建项目.
|
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: '11'
|
|
||||||
distribution: 'adopt-hotspot'
|
|
||||||
cache: 'gradle'
|
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
- name: Build and test
|
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
|
||||||
with:
|
|
||||||
gradle-version: 'wrapper'
|
|
||||||
arguments: clean test assembleDist
|
|
||||||
|
|
||||||
# 创建新的发行版本
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
draft: true
|
|
||||||
body_path: ${{ github.workspace }}/CURRENT_CHANGELOG.md
|
|
||||||
files: |
|
|
||||||
*/build/distributions/*
|
|
||||||
*/build/libs/*
|
|
10
.github/workflows/gradle-wrapper-validation.yml
vendored
Normal file
10
.github/workflows/gradle-wrapper-validation.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: "Validate Gradle Wrapper"
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validation:
|
||||||
|
name: "Validation"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: gradle/wrapper-validation-action@v1
|
49
.github/workflows/publish-artifacts.yml
vendored
49
.github/workflows/publish-artifacts.yml
vendored
@ -1,49 +0,0 @@
|
|||||||
name: Publish artifacts
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- published
|
|
||||||
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: lamgc/scalabot
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish-container-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: '11'
|
|
||||||
distribution: 'adopt-hotspot'
|
|
||||||
cache: 'gradle'
|
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
- name: Build and test
|
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
|
||||||
with:
|
|
||||||
gradle-version: 'wrapper'
|
|
||||||
arguments: clean test installDist
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
- name: Set up Docker BuildX
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Build and push container image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ env.IMAGE_NAME }}:latest, ${{ env.IMAGE_NAME }}:${{ github.ref_name }}
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
@ -1,49 +0,0 @@
|
|||||||
name: Build development version container image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
timeout-minutes: 15
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: '11'
|
|
||||||
distribution: 'adopt-hotspot'
|
|
||||||
cache: 'gradle'
|
|
||||||
- uses: gradle/wrapper-validation-action@v1
|
|
||||||
- name: Grant execute permission for gradlew
|
|
||||||
run: chmod +x gradlew
|
|
||||||
- name: Build project and install Distribution package
|
|
||||||
uses: gradle/gradle-build-action@v2.2.1
|
|
||||||
with:
|
|
||||||
gradle-version: 'wrapper'
|
|
||||||
arguments: installDist
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
- name: Set up Docker BuildX
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Build and push container image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: lamgc/scalabot:dev
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
@ -1,8 +0,0 @@
|
|||||||
FROM openjdk:18
|
|
||||||
|
|
||||||
ENV BOT_DATA_PATH /scalabot/data/
|
|
||||||
WORKDIR /scalabot/run/
|
|
||||||
|
|
||||||
CMD ["/scalabot/app/bin/scalabot-app"]
|
|
||||||
|
|
||||||
COPY scalabot-app/build/install/scalabot-app/ /scalabot/app/
|
|
@ -12,5 +12,5 @@ allprojects {
|
|||||||
|
|
||||||
}
|
}
|
||||||
group = "net.lamgc"
|
group = "net.lamgc"
|
||||||
version = "0.5.2"
|
version = "0.5.0"
|
||||||
}
|
}
|
@ -10,9 +10,9 @@ dependencies {
|
|||||||
implementation(project(":scalabot-meta"))
|
implementation(project(":scalabot-meta"))
|
||||||
implementation(project(":scalabot-extension"))
|
implementation(project(":scalabot-extension"))
|
||||||
|
|
||||||
implementation("org.slf4j:slf4j-api:2.0.0")
|
implementation("org.slf4j:slf4j-api:1.7.36")
|
||||||
implementation("io.github.microutils:kotlin-logging:2.1.23")
|
implementation("io.github.microutils:kotlin-logging:2.1.23")
|
||||||
implementation("ch.qos.logback:logback-classic:1.4.0")
|
implementation("ch.qos.logback:logback-classic:1.2.11")
|
||||||
|
|
||||||
val aetherVersion = "1.1.0"
|
val aetherVersion = "1.1.0"
|
||||||
implementation("org.eclipse.aether:aether-api:$aetherVersion")
|
implementation("org.eclipse.aether:aether-api:$aetherVersion")
|
||||||
@ -23,7 +23,7 @@ dependencies {
|
|||||||
implementation("org.eclipse.aether:aether-connector-basic:$aetherVersion")
|
implementation("org.eclipse.aether:aether-connector-basic:$aetherVersion")
|
||||||
implementation("org.apache.maven:maven-aether-provider:3.3.9")
|
implementation("org.apache.maven:maven-aether-provider:3.3.9")
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
|
||||||
implementation("com.google.code.gson:gson:2.9.0")
|
implementation("com.google.code.gson:gson:2.9.0")
|
||||||
|
|
||||||
@ -32,15 +32,11 @@ dependencies {
|
|||||||
implementation("org.telegram:telegrambots-abilities:6.1.0")
|
implementation("org.telegram:telegrambots-abilities:6.1.0")
|
||||||
implementation("org.telegram:telegrambots:6.1.0")
|
implementation("org.telegram:telegrambots:6.1.0")
|
||||||
|
|
||||||
// Added as a mitigation measure for vulnerabilities.
|
implementation("io.prometheus:simpleclient:0.15.0")
|
||||||
// When the relevant reference dependency updates it, it will be removed.
|
implementation("io.prometheus:simpleclient_httpserver:0.15.0")
|
||||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.4.2")
|
|
||||||
|
|
||||||
implementation("io.prometheus:simpleclient:0.16.0")
|
|
||||||
implementation("io.prometheus:simpleclient_httpserver:0.16.0")
|
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
testImplementation("io.mockk:mockk:1.12.7")
|
testImplementation("io.mockk:mockk:1.12.4")
|
||||||
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")
|
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.lamgc.scalabot
|
package net.lamgc.scalabot
|
||||||
|
|
||||||
import ch.qos.logback.core.PropertyDefinerBase
|
import ch.qos.logback.core.PropertyDefinerBase
|
||||||
|
import com.google.common.net.InternetDomainName
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import com.google.gson.JsonArray
|
import com.google.gson.JsonArray
|
||||||
@ -15,9 +16,9 @@ import org.eclipse.aether.repository.RepositoryPolicy
|
|||||||
import org.telegram.telegrambots.bots.DefaultBotOptions
|
import org.telegram.telegrambots.bots.DefaultBotOptions
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
import java.net.URLEncoder
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
|
||||||
import java.util.function.Supplier
|
import java.util.function.Supplier
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ internal fun ProxyConfig.toAetherProxy(): Proxy? {
|
|||||||
|
|
||||||
internal fun MavenRepositoryConfig.toRemoteRepository(proxyConfig: ProxyConfig? = null): RemoteRepository {
|
internal fun MavenRepositoryConfig.toRemoteRepository(proxyConfig: ProxyConfig? = null): RemoteRepository {
|
||||||
val repositoryId = if (id == null) {
|
val repositoryId = if (id == null) {
|
||||||
val generatedRepoId = createDefaultRepositoryId()
|
val generatedRepoId = createDefaultRepositoryId(url)
|
||||||
log.debug { "仓库 Url `$url` 未设置仓库 Id, 已分配缺省 Id: $generatedRepoId" }
|
log.debug { "仓库 Url `$url` 未设置仓库 Id, 已分配缺省 Id: $generatedRepoId" }
|
||||||
generatedRepoId
|
generatedRepoId
|
||||||
} else {
|
} else {
|
||||||
@ -92,10 +93,11 @@ private fun checkRepositoryLayout(layoutType: String): String {
|
|||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
private val repoNumberGenerator = AtomicInteger(1)
|
private fun createDefaultRepositoryId(url: URL): String {
|
||||||
|
val topPrivateDomain = InternetDomainName.from(url.host).topPrivateDomain().toString()
|
||||||
private fun createDefaultRepositoryId(): String {
|
return "Repository-${URLEncoder.encode(topPrivateDomain, StandardCharsets.UTF_8)}-${
|
||||||
return "Repository-${repoNumberGenerator.getAndIncrement()}"
|
url.toString().hashCode().toString(16)
|
||||||
|
}"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":scalabot-extension"))
|
compileOnly(project(":scalabot-extension"))
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,20 +4,14 @@ plugins {
|
|||||||
jacoco
|
jacoco
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("commons-codec:commons-codec:1.15")
|
|
||||||
api("org.telegram:telegrambots-abilities:6.1.0")
|
api("org.telegram:telegrambots-abilities:6.1.0")
|
||||||
api("org.slf4j:slf4j-api:2.0.0")
|
api("org.slf4j:slf4j-api:1.7.36")
|
||||||
|
|
||||||
// Added as a mitigation measure for vulnerabilities.
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
||||||
// When the relevant reference dependency updates it, it will be removed.
|
testImplementation("org.mockito:mockito-core:4.6.1")
|
||||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.4.2")
|
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
|
|
||||||
testImplementation("org.mockito:mockito-core:4.7.0")
|
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ plugins {
|
|||||||
id("org.jetbrains.dokka") version "1.7.0"
|
id("org.jetbrains.dokka") version "1.7.0"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -14,18 +13,14 @@ dependencies {
|
|||||||
|
|
||||||
implementation("org.telegram:telegrambots-meta:6.1.0")
|
implementation("org.telegram:telegrambots-meta:6.1.0")
|
||||||
|
|
||||||
// Added as a mitigation measure for vulnerabilities.
|
|
||||||
// When the relevant reference dependency updates it, it will be removed.
|
|
||||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.4.2")
|
|
||||||
|
|
||||||
api("com.google.code.gson:gson:2.9.0")
|
api("com.google.code.gson:gson:2.9.0")
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
testImplementation("io.mockk:mockk:1.12.7")
|
testImplementation("io.mockk:mockk:1.12.4")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
||||||
|
|
||||||
dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.7.10")
|
dokkaHtmlPlugin("org.jetbrains.dokka:javadoc-plugin:1.7.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
|
Reference in New Issue
Block a user