Compare commits

..

51 Commits

Author SHA1 Message Date
Klop233
a35c3ec981 Update CI 2024-04-13 18:28:07 +08:00
Klop233
0461985e95 Update CI 2024-04-13 18:15:03 +08:00
Klop233
04b1668fa7 Update CI 2024-04-13 18:00:45 +08:00
Klop233
fb85fe59e6 Update CI 2024-04-13 17:47:15 +08:00
MrHua269
514fe3ca71 Rewrite linear region flush task dispatching 2024-04-13 17:45:46 +08:00
Klop233
b1f0a68b10 Fixed CI 2024-04-13 17:43:51 +08:00
Klop233
fd780f417b Fixed CI 2024-04-13 17:20:03 +08:00
Klop233
6339b2adc1 Update CI 2024-04-12 21:59:58 +08:00
Klop233
cc593b53e2 Update CI 2024-04-12 21:40:57 +08:00
Klop233
3b838086e9 Update CI 2024-04-12 21:26:42 +08:00
Klop233
9f0574db9f Update CI 2024-04-12 21:14:15 +08:00
Klop233
705170d111 Update CI 2024-04-12 20:48:27 +08:00
Klop233
5fdb14947b Update CI 2024-04-12 20:34:39 +08:00
Klop233
d66ce6fb87 Update CI 2024-04-12 20:23:35 +08:00
Klop233
b81eb1857c Update CI 2024-04-12 20:08:32 +08:00
Klop233
cc0312cd76 update CI 2024-04-12 19:52:41 +08:00
Klop233
3313ff7c61 update CI 2024-04-12 19:52:07 +08:00
Klop233
06a87833f3 update CI 2024-04-12 19:51:19 +08:00
Klop233
6d39abe168 update CI 2024-04-12 19:45:36 +08:00
Klop233
9243eea30b update CI 2024-04-12 19:40:30 +08:00
Klop233
1334c291e5 update CI 2024-04-12 19:25:45 +08:00
Klop233
bd1178911d update CI 2024-04-12 19:03:54 +08:00
Klop233
41a500a5ad Merge remote-tracking branch 'origin/ver/1.20.4' into ver/1.20.4 2024-04-12 18:46:57 +08:00
Klop233
a1ba257238 update CI 2024-04-12 18:46:28 +08:00
ShintoKosei
a40d934630 UPDATE CI 2024-04-06 23:18:23 +08:00
ShintoKosei
79b6b41b63 Jump Build To Debug CI <14> 2024-04-06 23:16:27 +08:00
ShintoKosei
52ab368069 Jump Build To Debug CI <13> 2024-04-06 23:15:21 +08:00
ShintoKosei
0bfac95070 Jump Build To Debug CI <12> 2024-04-06 22:35:25 +08:00
ShintoKosei
c69ed4279e Jump Build To Debug CI <11> 2024-04-06 22:34:17 +08:00
ShintoKosei
127aa3728a Jump Build To Debug CI <10> 2024-04-06 22:32:59 +08:00
ShintoKosei
1e7b4394ac Jump Build To Debug CI <9> 2024-04-06 22:30:17 +08:00
ShintoKosei
f129a1e860 Jump Build To Debug CI <8> 2024-04-06 22:23:51 +08:00
ShintoKosei
922a85f662 Update CI 2024-04-06 22:06:15 +08:00
ShintoKosei
d13bfadde4 Jump Build To Debug CI <8> 2024-04-06 22:02:55 +08:00
ShintoKosei
88aab8eadc Jump Build To Debug CI <7> 2024-04-06 22:00:28 +08:00
ShintoKosei
8914d3fcbc Jump Build To Debug CI <6> 2024-04-06 21:58:57 +08:00
ShintoKosei
d2f2ea4382 Jump Build To Debug CI <5> 2024-04-06 21:49:51 +08:00
ShintoKosei
a6888b27d0 Jump Build To Debug CI <4> 2024-04-06 21:30:20 +08:00
ShintoKosei
efabe850e0 Jump Build To Debug CI <3> 2024-04-06 21:29:40 +08:00
ShintoKosei
6c6786792f Jump Build To Debug CI <2> 2024-04-06 21:29:00 +08:00
ShintoKosei
dddb28fdf6 Jump Build To Debug CI <1> 2024-04-06 21:28:13 +08:00
ShintoKosei
8546ac56e2 More Fix CI 2024-04-06 21:12:48 +08:00
ShintoKosei
2c09274132 Fix CI 2024-04-06 20:58:34 +08:00
ShintoKosei
a9238f8e8e Update CI 2024-04-06 20:29:43 +08:00
ShintoKosei
7522e3c67b Update CI 2024-04-06 18:40:49 +08:00
ShintoKosei
71a7127bb1 Update CI 2024-04-06 18:13:22 +08:00
ShintoKosei
75266cceed Update CI 2024-04-06 17:44:45 +08:00
Klop233
8a292a655a update CI 2024-04-06 17:26:39 +08:00
Klop233
a0779956f1 update CI 2024-04-06 17:16:17 +08:00
Klop233
1de9ca9d5f update CI 2024-04-06 17:05:59 +08:00
Klop233
bc842c855a update CI 2024-04-06 17:03:35 +08:00
6 changed files with 177 additions and 53 deletions

View File

@@ -6,18 +6,15 @@ on:
pull_request:
branches: [ "ver/1.20.4" ]
# workflow_dispatch:
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
environment: default
steps:
- name: Checkout Git Repository
uses: actions/checkout@v3
# - name: Validate Gradle wrapper
# uses: gradle/wrapper-validation-action@v1
# - name: Setup Gradle
# uses: gradle/gradle-build-action@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
@@ -35,52 +32,33 @@ jobs:
with:
name: "Luminol CI Artifacts"
path: "build/libs/*.jar"
- name: Get version from asset
id: get_version
run: echo "::set-output name=version::$(echo build/libs/*.jar | grep -oP 'bundler-\K\d+\.\d+\.\d+' | head -1)"
- name: Set outputs
id: short_sha
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set env
run: echo "tag=${{ steps.get_version.outputs.version }}-${{ steps.short_sha.outputs.sha_short }}" >> $GITHUB_ENV
- name: Rename jar file
run: |
mv build/libs/luminol-bundler-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-bundler.jar
mv build/libs/luminol-paperclip-1.20.4-R0.1-SNAPSHOT-reobf.jar build/libs/luminol-1.20.4-paperclip.jar
- name: Get and Set ENV
run: sh scripts/GetSetENV.sh
# - name: Create Release
# if: "!contains(github.event.commits[0].message, '[release-skip]')"
# uses: ncipollo/release-action@v1.12.0
# with:
# tag: ${{ env.tag }}
# name: Luminol ${{ steps.get_version.outputs.version }} - ${{ steps.short_sha.outputs.sha_short }}
# body: |
# 📦Version: `${{ steps.get_version.outputs.version }}` | Commit ${{ steps.short_sha.outputs.sha_short }} [![download](https://img.shields.io/github/downloads/LuminolMC/Luminol/${{ env.tag }}/total?color=0&style=flat-square)](https://github.com/LeavesMC/LuminolMC/Luminol/download/${{ steps.get_version.outputs.version }}-${{ steps.short_sha.outputs.sha_short }}/luminol-1.20.4-paperclip.jar)
# This release is automatically compiled by GitHub Actions
# artifacts: |
# build/libs/luminol-1.20.4-bundler.jar
# build/libs/luminol-1.20.4-paperclip.jar
# generateReleaseNotes: true
# prerelease: ${{ env.pre }}
# makeLatest: ${{ env.make_latest }}
# token: "${{ secrets.GITHUB_TOKEN }}"
- name: Release Artifacts
uses: svenstaro/upload-release-action@v2
- name: setenv
run: |
sh scripts/SetENV.sh
echo "${{ env.tag }}"
- name: Create Release
if: "!contains(github.event.commits[0].message, '[release-skip]')"
uses: ncipollo/release-action@v1.12.0
with:
release_name: "Luminol MC1.20.4 - ${{ github.event.repository.updated_at}}"
tag: ${{ env.tag }}
name: Luminol ${{ env.mcversion }} - ${{ env.commitid }}
body: |
📦Version: `${{ steps.get_version.outputs.version }}` | Commit ${{ steps.short_sha.outputs.sha_short }} [![download](https://img.shields.io/github/downloads/LuminolMC/Luminol/${{ env.tag }}/total?color=0&style=flat-square)](https://github.com/LeavesMC/LuminolMC/Luminol/download/${{ steps.get_version.outputs.version }}-${{ steps.short_sha.outputs.sha_short }}/luminol-1.20.4-paperclip.jar)
This release is automatically compiled by GitHub Actions
repo_token: "${{ secrets.GITHUB_TOKEN }}"
file: "build/libs/luminol-1.20.4-paperclip.jar"
file_glob: true
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commitid }} [![download](https://img.shields.io/github/downloads/LuminolMC/Luminol/${{ env.tag }}/total?color=0)](https://github.com/LeavesMC/LuminolMC/Luminol/download/${{ env.tag }}/luminol-1.20.4-paperclip.jar)
This release is automatically compiled by GitHub Actions
artifacts: |
build/libs/luminol-1.20.4-bundler.jar
build/libs/luminol-1.20.4-paperclip.jar
generateReleaseNotes: true
prerelease: ${{ env.pre }}
makeLatest: ${{ env.make_latest }}
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Push to Api
if: "!contains(github.event.commits[0].message, '[release-skip]')"
env:
secret_v2: ${{ secrets.API_V2_PUSH_TOKEN }}
secret_v2: ${{ secrets.API_KEY }}
tag: ${{ env.tag }}
run: sh scripts/PushToAPI.sh
run: sh scripts/PushToAPI.sh

View File

@@ -7,5 +7,7 @@ org.gradle.caching = true
org.gradle.parallel = true
org.gradle.vfs.watch = false
org.gradle.jvmargs = -Xmx3G
mcVersion=1.20.4
GroupMCV=1.20
preVersion=false

View File

@@ -0,0 +1,120 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <novau233@163.com>
Date: Fri, 12 Apr 2024 13:48:09 +0000
Subject: [PATCH] Rewrite linear region flush task dispatching
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
index e40989889f3821bb7484fc0bae5d94b033013904..dc5a5f42c9ca7a50295c18424722568a3ad33fa5 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
@@ -126,7 +126,7 @@ public class LinearRegionFile implements AbstractRegionFile, AutoCloseable {
}
public void flush() throws IOException {
- if (isMarkedToSave()) flushWrapper(); // sync
+ if (getAndResetSaveMarker()) flushWrapper(); // sync
}
private void markToSave() {
@@ -134,10 +134,18 @@ public class LinearRegionFile implements AbstractRegionFile, AutoCloseable {
markedToSave.set(true);
}
- public boolean isMarkedToSave() {
+ public boolean getAndResetSaveMarker() {
return markedToSave.getAndSet(false);
}
+ public boolean isMarkedToSave(){
+ return this.markedToSave.get();
+ }
+
+ public void resetSaveMarker(){
+ this.markedToSave.set(false);
+ }
+
public void flushWrapper() {
try {
save();
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
index f06d7767c79e465f999b2032086cc224de95152a..65435eb666b2e1cabffc145e016faa5e3b373464 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
@@ -1,17 +1,14 @@
package dev.kaiijumc.kaiiju.region;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import java.util.Queue;
+
+import java.util.Set;
import java.util.concurrent.*;
import org.bukkit.Bukkit;
public class LinearRegionFileFlusher {
- private final Queue<LinearRegionFile> savingQueue = new LinkedBlockingQueue<>();
- private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(
- new ThreadFactoryBuilder()
- .setNameFormat("linear-flush-scheduler")
- .build()
- );
+ private final Set<LinearRegionFile> pendingSaving = ConcurrentHashMap.newKeySet();
+
private final ExecutorService executor = Executors.newFixedThreadPool(
me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushThreads,
new ThreadFactoryBuilder()
@@ -19,26 +16,42 @@ public class LinearRegionFileFlusher {
.build()
);
+ private final Executor delayedFlusher = CompletableFuture.delayedExecutor(
+ me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushFrequency,
+ TimeUnit.SECONDS,
+ executor
+ );
+
public LinearRegionFileFlusher() {
Bukkit.getLogger().info("Using " + me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushThreads + " threads for linear region flushing.");
- scheduler.scheduleAtFixedRate(this::pollAndFlush, 0L, me.earthme.luminol.config.modules.misc.RegionFormatConfig.linearFlushFrequency, TimeUnit.SECONDS);
}
public void scheduleSave(LinearRegionFile regionFile) {
- if (savingQueue.contains(regionFile)) return;
- savingQueue.add(regionFile);
- }
-
- private void pollAndFlush() {
- while (!savingQueue.isEmpty()) {
- LinearRegionFile regionFile = savingQueue.poll();
- if (!regionFile.closed && regionFile.isMarkedToSave())
- executor.execute(regionFile::flushWrapper);
+ if (this.pendingSaving.contains(regionFile) || !regionFile.isMarkedToSave()){
+ return;
}
+
+ this.pendingSaving.add(regionFile);
+ this.delayedFlusher.execute(()->{
+ try {
+ if (!regionFile.closed && regionFile.isMarkedToSave()){
+ regionFile.flushWrapper();
+ }
+ }finally {
+ regionFile.resetSaveMarker();
+ this.pendingSaving.remove(regionFile);
+ }
+ });
}
public void shutdown() {
- executor.shutdown();
- scheduler.shutdown();
+ this.executor.shutdown();
+ for (;;) {
+ try {
+ if (this.executor.awaitTermination(5_00,TimeUnit.MILLISECONDS)) break;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
}
}

View File

@@ -5,23 +5,44 @@ sha256() {
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
echo "$tag"
project_id="luminol"
project_name="uminol"
mcversion_group=$(prop GroupMCV)
mcversion=$(prop mcVersion)
ctime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
pre=$(prop preVersion)
if [ $pre = "true" ]; then
channel="experimental"
else
channel="default"
fi
promoted=false
number=$(git log --oneline master ^`git describe --tags --abbrev=0` | wc -l)
changes=$(git log --pretty='%H<<<%s>>>' -"$number" | sed ':a;N;$!ba;s/\n//g')
jar_name="build/libs/luminol-1.20.4-paperclip.jar"
jar_sha256=`sha256 $jar_name`
changes=$(git log -1 --pretty="[{\\\"commit\\\": \\\"%H\\\", \\\"message\\\": \\\"%s\\\", \\\"summary\\\": \\\"%s\\\"}]")
jar_sha256=`sha256 build/libs/luminol-1.20.4-paperclip.jar`
jar_name="luminol-1.20.4-paperclip.jar"
ctime=$(date -u +"%s")"000"
# v2
curl --location --request POST "https://api.luminolmc.com/v2/commit/build" --header "Content-Type: application/json" --header "Authentication: $secret_v2" --data-raw "{\"project_id\":\"$project_id\",\"version\":\"$mcversion\",\"channel\":\"$channel\",\"changes\":\"$changes\",\"jar_name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"tag\":\"$tag\"}"
echo "Authentication: $secret_v2"
#echo "{\"version_group\":\"$mcversion_group\",\"channel\":\"$channel\",\"changes\":\"$changes\",\"jar_name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"release_tag\":\"$tag\",\"time\":\"$ctime\"}" > data.json
json=$(printf "{\\\"channel\\\":\\\"%s\\\", \\\"jar_name\\\":\\\"%s\\\", \\\"sha256\\\":\\\"%s\\\", \\\"tag\\\":\\\"%s\\\", \\\"time\\\":\\\"%s\\\", \\\"changes\\\":\\\"%s\\\"}" \
"$channel" "$jar_name" "$jar_sha256" "$tag" "$ctime" "$changes")
echo "[DEBUG] $json"
echo "[DEBUG] $changes"
echo "[DEBUG] curl --location --request POST \"https://api.luminolmc.com/v2/projects/$project_id/$mcversion/build/commit\" \
-H \"Content-Type: application/x-www-form-urlencoded\" \
-H \"Authorization: $secret_v2\" \
--data-urlencode \"channel=$channel\" \
--data-urlencode \"jar_name=$jar_name\" \
--data-urlencode \"sha256=$jar_sha256\" \
--data-urlencode \"release_tag=$tag\" \
--data-urlencode \"time=$ctime\" \
--data-urlencode \"changes=$changes\""
curl -L --request POST "https://api.luminolmc.com/v2/projects/$project_id/$mcversion/build/commit" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: $secret_v2" \
--data-urlencode "channel=$channel" \
--data-urlencode "jar_name=$jar_name" \
--data-urlencode "sha256=$jar_sha256" \
--data-urlencode "release_tag=$tag" \
--data-urlencode "time=$ctime" \
--data-urlencode "changes=$changes"

View File

@@ -9,7 +9,10 @@ release_tag="$mcversion-$commitid"
jarName="build/libs/luminol-1.20.4-paperclip.jar"
make_latest=$([ $preVersion = "true" ] && echo "false" || echo "true")
echo "commitid=$commitid" >> $GITHUB_ENV
echo "mcversion=$mcversion" >> $GITHUB_ENV
echo "$mcversion"
echo "tag=$release_tag" >> $GITHUB_ENV
echo "jar=$jarName" >> $GITHUB_ENV
echo "pre=$preVersion" >> $GITHUB_ENV
echo "make_latest=$make_latest" >> $GITHUB_ENV
echo "make_latest=$make_latest" >> $GITHUB_ENV