Skip to content

Commit

Permalink
Merge d8266f0 into c09c3e6
Browse files Browse the repository at this point in the history
  • Loading branch information
outductor authored Dec 10, 2024
2 parents c09c3e6 + d8266f0 commit 1621790
Show file tree
Hide file tree
Showing 315 changed files with 5,179 additions and 3,273 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-24.04
container: ghcr.io/giganticminecraft/seichiassist-builder-v2:1df7cf5
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Prepare build dependencies cache
uses: actions/cache@v4
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@v4
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: mkdir -p target/build && ./sbt assembly

- name: Clean build artifact for caching target folder
run: rm -r target/build
21 changes: 11 additions & 10 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- develop
- master

pull_request:
branches:
- develop
Expand All @@ -14,16 +13,16 @@ jobs:
build_test_and_upload:
env:
BUILD_ENVIRONMENT_IS_CI_OR_LOCAL: "CI"
runs-on: ubuntu-22.04
container: ghcr.io/giganticminecraft/seichiassist-builder:1a64049
runs-on: ubuntu-24.04
container: ghcr.io/giganticminecraft/seichiassist-builder-v2:1df7cf5
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Prepare build dependencies cache
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-build-dependencies
cache-version: v-5
Expand All @@ -47,7 +46,7 @@ jobs:
- name: Prepare build cache
if: github.ref != 'refs/heads/master'
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-build
cache-version: v-5
Expand All @@ -68,6 +67,8 @@ jobs:
- 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
Expand Down Expand Up @@ -102,7 +103,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Test and build artifact
run: sbt assembly
run: mkdir -p target/build && sbt assembly

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -125,7 +126,7 @@ jobs:

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

create_prerelease:
name: GitHub ReleasesにPreReleaseを作成する
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/develop'
needs:
- build_test_and_upload
Expand Down Expand Up @@ -171,7 +172,7 @@ jobs:
prerelease: true

push_artifact_to_debug_server_definition:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/develop'
needs:
- build_test_and_upload
Expand Down Expand Up @@ -237,7 +238,7 @@ jobs:
avatar_url: ${{ secrets.DISCORD_AVATAR_URL }}

deploy_artifact_to_production:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/master'
needs:
- build_test_and_upload
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-sql-version-duplicated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- .github/workflows/check-sql-version-duplicated-files.yml
jobs:
check:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
111 changes: 111 additions & 0 deletions .github/workflows/create_1_18_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Create 1.18 release

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

jobs:
create_release:
runs-on: ubuntu-24.04
container: ghcr.io/giganticminecraft/seichiassist-builder-v2:1df7cf5
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Prepare build dependencies cache
uses: actions/cache@v4
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@v4
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
# sbt-assembly 2以降からディレクトリを作ってくれなくなった
- name: Build artifact
run: mkdir -p target/build && ./sbt assembly

- name: Create and push a tag
id: tag-name
# GiganticMinecraftにあるSeichiAssistリポジトリのブランチからのPRのみ実行
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
run: |
TAG_NAME=pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
git tag $TAG_NAME
git push origin $TAG_NAME
echo "value=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Create release
uses: softprops/action-gh-release@v1
# GiganticMinecraftにあるSeichiAssistリポジトリのブランチからのPRのみ実行
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: target/build/SeichiAssist.jar
tag_name: ${{ steps.tag-name.outputs.value }}
draft: false

- name: Clean build artifact for caching target folder
run: rm -r target/build
16 changes: 8 additions & 8 deletions .github/workflows/create_new_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
get_branch_name:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
value: ${{ steps.job.outputs.value }}
steps:
Expand All @@ -14,7 +14,7 @@ jobs:
run: echo "value=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT

bump_version:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: get_branch_name
outputs:
old_version: ${{ steps.bump.outputs.old_version }}
Expand Down Expand Up @@ -72,21 +72,21 @@ jobs:
HEAD:${{ needs.get_branch_name.outputs.value }}
create_release:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: bump_version
steps:
- uses: actions/checkout@master
with:
# これがないとchunk_searchで引っかかってリリースのjarアップロードに失敗する
submodules: 'recursive'
submodules: "recursive"

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
distribution: "temurin"
java-version: "17"

- name: build artifacts
run: sbt assembly
run: mkdir -p target/build && sbt assembly

- name: Create release
id: create_release
Expand All @@ -100,7 +100,7 @@ jobs:
prerelease: false

create_pull-request_to_master:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [get_branch_name, bump_version]
steps:
- uses: actions/checkout@master
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/publish_develop_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: publish develop build

on:
push:
branches:
- develop

jobs:
publish_build:
runs-on: ubuntu-24.04
steps:
- name: Publish develop build
env:
SEICHIASSIST_DOWNLOADER_TOKEN: ${{ secrets.SEICHIASSIST_DOWNLOADER_TOKEN }}
run: |
curl -s -X 'POST' 'http://localhost/publish/develop' \
-H 'accept: */*' \
-H 'Authorization: Bearer $SEICHIASSIST_DOWNLOADER_TOKEN'
Loading

0 comments on commit 1621790

Please sign in to comment.