Skip to content

Commit

Permalink
tidy up 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
outductor committed Jul 15, 2023
1 parent ff6883a commit 9b954cd
Show file tree
Hide file tree
Showing 136 changed files with 1,968 additions and 1,547 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/1_18.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: 1.18 build check

on:
push:
branches:
- 1_18
paths:
- src/**
- build.sbt
- .scalafix.conf
- .scalafmt.conf
- project/*
- .github/workflows/**.yml
- .github/actions/**/**.yml

jobs:
build_check:
env:
BUILD_ENVIRONMENT_IS_CI_OR_LOCAL: "CI"
runs-on: ubuntu-20.04
container: ghcr.io/giganticminecraft/seichiassist-builder-v2:424c09f
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Prepare build dependencies cache
uses: actions/cache@v3
env:
cache-name: cache-build-dependencies
cache-version: v-5
with:
# sbt等は$HOMEではなくユーザーディレクトリを見ているようで、
# GH Actionsでの ~ は /github/home/ に展開されるにもかかわらず
# 実際のキャッシュは /root/ 以下に配備される。
#
# /root/.ivy/cache, /root/.sbt - sbt関連のキャッシュ
# /root/.m2 - ビルドログを観察した感じprotoc等はここを利用する
# /root/.cache - cousierがscalasbt等をキャッシュするのに使っている
path: |
/root/.ivy2/cache
/root/.sbt
/root/.m2
/root/.cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-${{ hashFiles('**/build.sbt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-
- name: Prepare build cache
if: github.ref != 'refs/heads/master'
uses: actions/cache@v3
env:
cache-name: cache-build
cache-version: v-5
with:
path: |
target
project/target
project/project/target
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-
# CIでのcheckoutはファイルのタイムスタンプをチェックアウト時刻に設定するため、
# そのままビルドするとlocalDependenciesにあるjarに変更が行われたと見なされ
# 不要なインクリメンタルコンパイルが走る
# タイムスタンプをコミット時刻に設定することでこれが回避できる
- name: Restore localDependencies' timestamps
# 参考: https://qiita.com/tomlla/items/219cea9dd071c8a9e147
run: |
git config --global --add safe.directory /__w/SeichiAssist/SeichiAssist
for jar in localDependencies/*.jar; do
timestamp=`git log -1 --pretty=format:'%cd' --date=format:'%Y%m%d%H%M.%S' $jar`
touch -t "$timestamp" $jar
done
# scalapbは.protoの再コンパイルの必要性を判定する際にタイムスタンプを見ているから、コミット時刻に合わせる
- name: Restore protocol timestamps
## 参考: https://qiita.com/tomlla/items/219cea9dd071c8a9e147
run: |
for proto in protocol/*.proto; do
timestamp=`git log -1 --pretty=format:'%cd' --date=format:'%Y%m%d%H%M.%S' $proto`
touch -t "$timestamp" $proto
done
- name: Check format with Scalafmt
run: ./sbt scalafmtCheckAll

- name: Check lint with Scalafix on push
run: ./sbt "scalafix --check"

- name: Test and build artifact
run: ./sbt assembly

- name: Clean build artifact for caching target folder
run: rm -r target/build
26 changes: 13 additions & 13 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ on:
- .github/workflows/**.yml
- .github/actions/**/**.yml

pull_request:
branches:
- develop
paths:
- src/**/
- build.sbt
- .scalafix.conf
- .scalafmt.conf
- project/*
- .github/workflows/**.yml
- .github/actions/**/**.yml
# pull_request:
# branches:
# - develop
# paths:
# - src/**/
# - build.sbt
# - .scalafix.conf
# - .scalafmt.conf
# - project/*
# - .github/workflows/**.yml
# - .github/actions/**/**.yml

jobs:
build_test_and_upload:
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:

output-sha:
name: 最終コミットのSHA値を取得する
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
sha: ${{ steps.output-sha.outputs.sha }}
steps:
Expand All @@ -156,7 +156,7 @@ jobs:

create_prerelease:
name: GitHub ReleasesにPreReleaseを作成する
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/develop'
needs:
- build_test_and_upload
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/create_1_18_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Create 1.18 release

on:
workflow_dispatch:

jobs:
get_version:
runs-on: ubuntu-20.04
outputs:
value: ${{ steps.version.outputs.version }}
steps:
- name: Output release version
id: version
run: echo "version=${{ github.run_number }}" >> "$GITHUB_OUTPUT"

create_release:
runs-on: ubuntu-20.04
container: ghcr.io/giganticminecraft/seichiassist-builder-v2:424c09f
needs: [get_version]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Prepare build dependencies cache
uses: actions/cache@v3
env:
cache-name: cache-build-dependencies
cache-version: v-5
with:
# sbt等は$HOMEではなくユーザーディレクトリを見ているようで、
# GH Actionsでの ~ は /github/home/ に展開されるにもかかわらず
# 実際のキャッシュは /root/ 以下に配備される。
#
# /root/.ivy/cache, /root/.sbt - sbt関連のキャッシュ
# /root/.m2 - ビルドログを観察した感じprotoc等はここを利用する
# /root/.cache - cousierがscalasbt等をキャッシュするのに使っている
path: |
/root/.ivy2/cache
/root/.sbt
/root/.m2
/root/.cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-${{ hashFiles('**/build.sbt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-
- name: Prepare build cache
if: github.ref != 'refs/heads/master'
uses: actions/cache@v3
env:
cache-name: cache-build
cache-version: v-5
with:
path: |
target
project/target
project/project/target
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-${{ github.ref }}-
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.cache-version }}-
# CIでのcheckoutはファイルのタイムスタンプをチェックアウト時刻に設定するため、
# そのままビルドするとlocalDependenciesにあるjarに変更が行われたと見なされ
# 不要なインクリメンタルコンパイルが走る
# タイムスタンプをコミット時刻に設定することでこれが回避できる
- name: Restore localDependencies' timestamps
# 参考: https://qiita.com/tomlla/items/219cea9dd071c8a9e147
run: |
git config --global --add safe.directory /__w/SeichiAssist/SeichiAssist
for jar in localDependencies/*.jar; do
timestamp=`git log -1 --pretty=format:'%cd' --date=format:'%Y%m%d%H%M.%S' $jar`
touch -t "$timestamp" $jar
done
# scalapbは.protoの再コンパイルの必要性を判定する際にタイムスタンプを見ているから、コミット時刻に合わせる
- name: Restore protocol timestamps
## 参考: https://qiita.com/tomlla/items/219cea9dd071c8a9e147
run: |
for proto in protocol/*.proto; do
timestamp=`git log -1 --pretty=format:'%cd' --date=format:'%Y%m%d%H%M.%S' $proto`
touch -t "$timestamp" $proto
done
- name: Build artifact
run: ./sbt assembly

- name: Rename artifact
run: |
mv target/build/SeichiAssist.jar target/build/SeichiAssist-for-1.18-v${{ needs.get_version.outputs.value }}.jar
- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: target/build/SeichiAssist-for-1.18-v${{ needs.get_version.outputs.value }}.jar
tag_name: "v${{ needs.get_version.outputs.value }}-for-1.18"
draft: false

- name: Clean build artifact for caching target folder
run: rm -r target/build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

# Local files
deployLocal.sh
localDependencies/spigot-1.12.2.jar
localDependencies/spigot-1.18.2.jar
plugins/*

# Docker
docker/spigot/serverfiles/eula.txt
Expand Down
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
17.0
14 changes: 9 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

## 開発を始めるために必要なもの
- [IntelliJ IDEA](https://www.jetbrains.com/idea/) などの統合開発環境
- [JDK 8](https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot)
- [AdoptOpenJDK 17](https://adoptium.net/temurin/releases/?version=17)
- [sbt 1.6](https://www.scala-sbt.org/1.x/docs/Setup.html)
- [Scala 2.13](https://www.scala-lang.org/download/)
- Spigot 1.12.2
- Spigot 1.18.2
- Docker
- GitHubのアカウント
- Git

### 準備
#### Java Development Kit
最初に、Java Development Kit (JDK) 8をインストールする必要があります
[AdoptOpenJDK 1.8](https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot) のインストールを推奨します。
最初に、Java Development Kit (JDK) 17をインストールする必要があります
[AdoptOpenJDK 17](https://adoptium.net/temurin/releases/?version=17) のインストールを推奨します。

#### 統合開発環境
次に、[IntelliJ IDEA](https://www.jetbrains.com/idea/)などの統合開発環境を導入します。
Expand Down Expand Up @@ -152,14 +152,18 @@ IntelliJ IDEAの設定でフォーマットに `scalafmt` を使う
#### 手元でデバッグ
SeichiAssistは手元でデバッグできる環境を整えています。環境を立ち上げるためには、Dockerが必要です。

/pluginsディレクトリに対してjarファイル配置すると、そのjarファイルとSeichiAssistを同時に起動した場合の動作を確認することができます。
整地鯖で利用しているプラグインはGiganticMinecraftのメンバーのみ[MinIOからダウンロード](https://minio-console.onp-k8s.admin.seichi.click/browser/seichi-plugins/ZGViLTEtMTYtNS8=)することができます。
接続情報などの詳しい情報は、Discordで聞いてください。

##### Dockerを立ち上げる

Linux環境では、`./prepare-docker.sh`、Windowsでは`prepare-docker.bat`を実行することで
デバッグ用のBungeecordとSpigotの環境を構築することができます。

サーバーやDB等を停止する場合、 `docker compose down` を実行してください。

なお、SeichiAssistがJDK 8以外でコンパイルされた場合は、実行時にエラーとなります。必ずJDKのバージョンを揃えるようにしてください。
なお、SeichiAssistがJava 17未満でコンパイルされた場合は、実行時にエラーとなります。必ずJDKのバージョンを揃えるようにしてください。

##### データベースの初期化

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
[![GitHub Actions](https://github.com/GiganticMinecraft/SeichiAssist/actions/workflows/build_and_deploy.yml/badge.svg)](https://github.com/GiganticMinecraft/SeichiAssist/actions/workflows/build_and_deploy.yml)

## 開発環境
- [Intellij IDEA](https://www.jetbrains.com/idea/) などの統合開発環境
- [AdoptOpenJDK 1.8](https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot)
- [IntelliJ IDEA](https://www.jetbrains.com/idea/) などの統合開発環境
- [AdoptOpenJDK 17](https://adoptium.net/temurin/releases/?version=17)
- [Scala 2.13](https://www.scala-lang.org/download/)
- [sbt 1.6](https://www.scala-sbt.org/1.x/docs/Setup.html)
- Spigot 1.12.2
- Spigot 1.18.2

## 前提プラグイン
- [CoreProtect-2.14.4](https://www.spigotmc.org/resources/coreprotect.8631/download?version=231781)
- [item-nbt-api-plugin-1.8.2-SNAPSHOT](https://www.spigotmc.org/resources/item-entity-tile-nbt-api.7939/download?version=241690)
- [Multiverse-Core-2.5.0](https://dev.bukkit.org/projects/multiverse-core/files/2428161/download)
- [Multiverse-Portals-2.5.0](https://dev.bukkit.org/projects/multiverse-portals/files/2428333/download)
- [CoreProtect-2.15.0](https://www.spigotmc.org/resources/coreprotect.8631/download?version=231781)
- [item-nbt-api-plugin-2.11.2](https://www.spigotmc.org/resources/item-entity-tile-nbt-api.7939/download?version=241690)
- [Multiverse-Core-4.3.1](https://dev.bukkit.org/projects/multiverse-core/files/2428161/download)
- [Multiverse-Portals-4.2.1](https://dev.bukkit.org/projects/multiverse-portals/files/2428333/download)
- [ParticleAPI_v2.1.1](https://dl.inventivetalent.org/download/?file=plugin/ParticleAPI_v2.1.1)
- [WorldBorder1.8.7](https://dev.bukkit.org/projects/worldborder/files/2415838/download)
- [worldedit-bukkit-6.1.9](https://dev.bukkit.org/projects/worldedit/files/2597538/download)
- [worldguard-bukkit-6.2.2](https://dev.bukkit.org/projects/worldguard/files/2610618/download)
- [WorldBorder1.9.10 (beta)](https://www.spigotmc.org/resources/worldborder.60905/download?version=275003)
- [worldedit-bukkit-7.0.0](https://dev.bukkit.org/projects/worldedit/files/2597538/download)
- [worldguard-bukkit-7.0.0](https://dev.bukkit.org/projects/worldguard/files/2610618/download)

## 前提プラグイン(整地鯖内製)
- RegenWorld [リポジトリ](https://github.com/GiganticMinecraft/RegenWorld) | [jar](https://redmine.seichi.click/attachments/download/890/RegenWorld-1.0.jar)
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ val providedDependencies = Seq(
"org.jetbrains" % "annotations" % "24.0.1",
"org.apache.commons" % "commons-lang3" % "3.12.0",
"commons-codec" % "commons-codec" % "1.16.0",
"org.spigotmc" % "spigot-api" % "1.12.2-R0.1-SNAPSHOT",
"org.spigotmc" % "spigot-api" % "1.18.2-R0.1-SNAPSHOT",
// https://maven.enginehub.org/repo/com/sk89q/worldedit/worldedit-bukkit/
"com.sk89q.worldguard" % "worldguard-legacy" % "6.2",
"net.coreprotect" % "coreprotect" % "2.14.2",
"com.mojang" % "authlib" % "1.6.25",
"com.sk89q.worldguard" % "worldguard-bukkit" % "7.0.7",
"net.coreprotect" % "coreprotect" % "21.3",
"com.mojang" % "authlib" % "3.11.50",

// no runtime
"org.typelevel" %% "simulacrum" % "1.0.1"
Expand Down
12 changes: 5 additions & 7 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.7'

networks:
seichi:
external: false
Expand All @@ -23,9 +21,9 @@ services:
- "25566:25565"
- "7091:7091"
environment:
- VERSION=1.12.2
- VERSION=1.18.2
- EULA=TRUE
- TYPE=SPIGOT
- TYPE=PAPER
- ONLINE_MODE=FALSE
- ENABLE_JMX=true
- JMX_PORT=7091
Expand Down Expand Up @@ -53,9 +51,9 @@ services:
- "25567:25565"
- "7092:7091"
environment:
- VERSION=1.12.2
- VERSION=1.18.2
- EULA=TRUE
- TYPE=SPIGOT
- TYPE=PAPER
- ONLINE_MODE=FALSE
- ENABLE_JMX=true
- JMX_PORT=7091
Expand All @@ -72,7 +70,7 @@ services:
- redis
stdin_open: true
bungeecord:
image: itzg/bungeecord:java8
image: itzg/bungeecord:java17
ports:
- "25565:25577"
volumes:
Expand Down
Loading

0 comments on commit 9b954cd

Please sign in to comment.