From 7e011ae635e33877fe0bf0a27b692d16877c27bc Mon Sep 17 00:00:00 2001 From: Nicholas Rose <35816886+nicholasgrose@users.noreply.github.com> Date: Sun, 20 Oct 2024 15:23:27 -0500 Subject: [PATCH] Cleanup part two: CI/CD overhaul --- .editorconfig | 6 ++ .github/workflows/publish_release.yml | 24 +++--- .github/workflows/pull_request_check.yml | 45 +++++------ .idea/detekt.xml | 7 ++ .idea/developer-tools.xml | 6 ++ ...ay__runLints_.xml => Gateway__detekt_.xml} | 4 +- CHANGELOG.md | 22 ++++++ build.gradle.kts | 75 ++++++++----------- dev.env | 2 + gradle.properties | 10 +-- gradle/libs.versions.toml | 26 ++++--- settings.gradle.kts | 13 ++-- .../rose/gateway/config/GatewayConfigFile.kt | 3 +- .../discord/bot/checks/MessageCheck.kt | 7 +- .../bot/extensions/about/AboutExtension.kt | 13 ++-- .../bot/extensions/chat/ChatExtension.kt | 4 +- .../bot/extensions/chat/GameChatEvent.kt | 4 +- .../discord/bot/extensions/ip/IpExtension.kt | 5 +- .../bot/extensions/list/ListExtension.kt | 9 ++- .../bot/extensions/tps/TpsExtension.kt | 9 ++- .../whitelist/WhitelistArguments.kt | 5 +- .../whitelist/WhitelistExtension.kt | 35 +++++---- .../commands/arguments/ConfigListArgs.kt | 1 + .../commands/parsers/ProcessorParser.kt | 5 +- .../commands/runners/ConfigCommands.kt | 8 +- .../gateway/shared/parsing/TextProcessor.kt | 3 +- src/main/resources/plugin.yml | 4 +- .../translations/discord/strings.properties | 29 +++++++ 28 files changed, 221 insertions(+), 163 deletions(-) create mode 100644 .idea/detekt.xml create mode 100644 .idea/developer-tools.xml rename .idea/runConfigurations/{Gateway__runLints_.xml => Gateway__detekt_.xml} (84%) create mode 100644 CHANGELOG.md create mode 100644 dev.env create mode 100644 src/main/resources/translations/discord/strings.properties diff --git a/.editorconfig b/.editorconfig index 33905f72..7c687731 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,9 @@ root = true [*] +charset = utf-8 +trim_trailing_whitespace = true +max_line_length = 120 insert_final_newline = true [{*.kt,*.kts}] @@ -10,3 +13,6 @@ ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL ij_kotlin_name_count_to_use_star_import = 2147483647 ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 ij_kotlin_packages_to_use_import_on_demand = unset + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 8255c2b5..0ed4ca66 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -19,14 +19,15 @@ jobs: - uses: actions/checkout@v4 # https://github.com/marketplace/actions/setup-java-jdk - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: 21 distribution: temurin - - name: Set gradlew execution permission - run: chmod u+x gradlew + # https://github.com/marketplace/actions/build-with-gradle + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 # https://github.com/marketplace/actions/generate-version - name: Get release version @@ -36,18 +37,11 @@ jobs: version-file: gradle.properties version-file-extraction-pattern: '(?<=version=).+' - # https://github.com/marketplace/actions/semver-parser - - name: Parse release version - uses: apexskier/github-semver-parse@v1 - id: semver - with: - version: ${{ env.RELEASE_VERSION }} + - name: Get changelog + run: ./gradlew getChangelog --console=plain -q --no-header --no-summary > LATEST_CHANGES.md - # https://github.com/marketplace/actions/gradle-build-action - name: Build artifacts - uses: gradle/actions/setup-gradle@v3 - with: - arguments: shadowJar + run: ./gradlew shadowJar # https://github.com/marketplace/actions/create-release - name: Create release @@ -55,7 +49,7 @@ jobs: with: name: Gateway ${{ env.RELEASE_VERSION }} tag: v${{ env.RELEASE_VERSION }} - generateReleaseNotes: true + bodyFile: 'LATEST_CHANGES.md' artifacts: 'build/libs/*.jar' - prerelease: ${{ !!steps.semver.outputs.prerelease }} + prerelease: ${{ !!env.RELEASE_VERSION_PRERELEASE }} token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull_request_check.yml b/.github/workflows/pull_request_check.yml index 12675da6..35a0c1b4 100644 --- a/.github/workflows/pull_request_check.yml +++ b/.github/workflows/pull_request_check.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - stable - - develop + - dev paths: - '**/*.kt' @@ -19,47 +19,36 @@ jobs: - uses: actions/checkout@v4 # https://github.com/marketplace/actions/setup-java-jdk - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v4 with: java-version: 21 distribution: temurin - - name: Set gradlew execution permission - run: chmod u+x gradlew + # https://github.com/marketplace/actions/build-with-gradle + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 - # https://github.com/marketplace/actions/gradle-build-action - name: Build artifacts - uses: gradle/actions/setup-gradle@v3 - with: - arguments: shadowJar + run: ./gradlew shadowJar - ktlint: + detekt: runs-on: ubuntu-latest steps: # https://github.com/marketplace/actions/checkout - uses: actions/checkout@v4 - # https://github.com/marketplace/actions/run-ktlint-with-reviewdog - - uses: ScaCap/action-ktlint@v1.9.0 + # https://github.com/marketplace/actions/setup-java-jdk + - name: Set up JDK + uses: actions/setup-java@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - ktlint_version: '1.3.1' - reporter: github-pr-review - fail_on_error: true - - detekt: - runs-on: ubuntu-latest + java-version: 21 + distribution: temurin - steps: - # https://github.com/marketplace/actions/checkout - - uses: actions/checkout@v4 + # https://github.com/marketplace/actions/build-with-gradle + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 - # https://github.com/marketplace/actions/run-detekt-with-reviewdog - - name: Run detekt with reviewdog - uses: alaegin/Detekt-Action@v1.23.6 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - detekt_config: config/detekt/detekt.yml - detekt_build_upon_default_config: true + - name: Run Detekt + run: ./gradlew detekt diff --git a/.idea/detekt.xml b/.idea/detekt.xml new file mode 100644 index 00000000..ee7289c6 --- /dev/null +++ b/.idea/detekt.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/developer-tools.xml b/.idea/developer-tools.xml new file mode 100644 index 00000000..5421cc50 --- /dev/null +++ b/.idea/developer-tools.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Gateway__runLints_.xml b/.idea/runConfigurations/Gateway__detekt_.xml similarity index 84% rename from .idea/runConfigurations/Gateway__runLints_.xml rename to .idea/runConfigurations/Gateway__detekt_.xml index 240d83de..43c649c2 100644 --- a/.idea/runConfigurations/Gateway__runLints_.xml +++ b/.idea/runConfigurations/Gateway__detekt_.xml @@ -1,5 +1,5 @@ - +