Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java
#	src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java
  • Loading branch information
StarWishsama committed Oct 15, 2023
2 parents 80c157b + 00a0540 commit ba81441
Show file tree
Hide file tree
Showing 719 changed files with 21,603 additions and 12,527 deletions.
49 changes: 49 additions & 0 deletions .git-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

echo "[pre-commit check]"

if ! [ -x "$(command -v mvn)" ]; then
echo -e 'Maven are not installed!'
echo
echo 'Please visit following site to download latest maven:'
echo
echo " https://maven.apache.org/download.cgi"
echo
echo 'If you are sure that you have installed maven,'
echo 'Please check whether your environment variables is being set properly.'
exit 1
fi

spotless() {
if [ ! -e "mvn" ]; then
return 0
fi

CHANGED_FILES="$(git --no-pager diff --name-status --no-color --cached | awk '$1 != "D" && $NF ~ /\.xml?$/ { print $NF }')"

if [ -z "$CHANGED_FILES" ]; then
echo "No staged files."
return 0
fi

echo '[pre-commit] Executing Maven spotlessCheck before commit'

git stash --quiet --keep-index

mvn -B spotless:check

RESULT=$?

git stash pop -q

if [ "$RESULT" -ne "0" ]; then
echo -e "spotlessCheck failed..."
echo -e 'You can try "./mvn spotless:apply" to apply auto-fixes.'
fi

return $RESULT
}

if ! spotless; then
exit 1
fi
20 changes: 9 additions & 11 deletions .github/workflows/maven.yml → .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Slimefun Build Test
name: Slimefun Builder

on:
push:
Expand All @@ -10,11 +10,6 @@ on:
paths:
- 'src/**'
- 'pom.xml'
pull_request:
paths:
- '.github/workflows/**'
- 'src/**'
- 'pom.xml'
workflow_dispatch:

jobs:
Expand All @@ -28,21 +23,24 @@ jobs:
java-version: 17
java-package: jdk
architecture: x64
- run: mvn -B test --file pom.xml --errors
- name: Codestyle Check
run: mvn -B spotless:check -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
- name: Build Slimefun
run: mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
- uses: actions/cache@v2
if: github.event_name != 'pull_request'
name: Cache dependencies
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- uses: actions/upload-artifact@v2
if: github.event_name != 'pull_request'
name: Upload Beta artifact
with:
name: Slimefun.jar
name: Slimefun Beta Build
path: staging
- name: Automatic Releases
uses: marvinpinto/[email protected]
if: github.event_name != 'pull_request' && github.ref_name == 'master'
if: github.ref_name == 'master'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "exp"
Expand Down
108 changes: 54 additions & 54 deletions .github/workflows/dev-release.yml → .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Slimefun DEV

on:
push:
branches:
- dev
paths:
- 'src/**'
- 'pom.xml'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
architecture: x64
cache: maven
server-id: github
settings-path: ${{ github.workspace }}
- name: Build Slimefun
if: github.event_name != 'pull_request'
run: mvn -B package --file pom.xml --errors
- name: Publish Slimefun
if: github.event_name != 'pull_request'
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml --file pom-github-package.xml --errors
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Mask Output
if: github.event_name != 'pull_request'
run: |
echo "::add-mask::$CF_API_TOKEN"
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
- name: Find build artifact filename
if: github.event_name != 'pull_request'
run: |
cd target && FILENAME=$(find . -maxdepth 1 -mindepth 1 -name "Slimefun-*" | cut -d'/' -f 2)
echo "slimefun-artifact-name=$FILENAME" >> "$GITHUB_ENV"
cd ..
- name: Upload Build
if: github.event_name != 'pull_request'
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: "r2 object put slimefun-dev/${{ env.slimefun-artifact-name }} --file=./target/${{ env.slimefun-artifact-name }} --content-type=application/java-archive"
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Slimefun DEV

on:
push:
branches:
- dev
paths:
- 'src/**'
- 'pom.xml'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
architecture: x64
cache: maven
- name: Codestyle check
run: mvn -B spotless:check --file pom.xml --errors
- name: Build Slimefun
run: mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Publish Slimefun
run: mvn -B deploy --file pom.xml --errors
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Mask Output
run: |
echo "::add-mask::$CF_API_TOKEN"
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
- name: Get build artifact filename
run: |
cd target && FILENAME=$(find . -maxdepth 1 -mindepth 1 -name "slimefun-*" | cut -d'/' -f 2)
echo "slimefun-artifact-name=$FILENAME" >> "$GITHUB_ENV"
cd ..
- name: Upload Build to R2
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: "r2 object put slimefun-dev/${{ env.slimefun-artifact-name }} --file=./target/${{ env.slimefun-artifact-name }} --content-type=application/java-archive"
16 changes: 16 additions & 0 deletions .github/workflows/package-maintainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Package Maintainer

on:
workflow_dispatch:
schedule:
- cron: '0 17 * * *'

jobs:
delete-package-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/delete-package-versions@v4
with:
package-name: 'com.github.slimefun.slimefun'
package-type: 'maven'
min-versions-to-keep: 5
25 changes: 25 additions & 0 deletions .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Pull Request Checker

on:
pull_request:
paths:
- '.github/workflows/**'
- 'src/**'
- 'pom.xml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
architecture: x64
- name: Codestyle Check
run: mvn -B spotless:check build -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
>
> 例如一个添加了新功能的提交应为 feat(item): add new item to Slimefun
此外, 推荐你使用 [gitmoji](https://gitmoji.dev/) 规范,但并不强制你使用。

如果你提交的代码中解决或处理了 Issue 中的问题,请你在主提交消息外显式声明。

> 如 resolves #114514, fix #114514
Expand All @@ -24,13 +22,16 @@

# 代码规范

**!! 本项目使用空格缩进 !!**
**!! 本项目使用 4 空格缩进 !!**

请不要过度缩减代码长度, 空格少了 Slimefun 也不会因此跑得更快.

我们使用了 Spotless 作为代码格式化工具,你可以直接使用 `mvn spotless:check spotless:apply` 来自动格式化你的代码。

如果你希望你的代码被合并至官方, 请遵守 Slimefun 主仓库的 [提交规范](https://github.com/Slimefun/Slimefun4/blob/master/CONTRIBUTING.md)

# 提交代码类型

你提交的代码可以是修复、新增内容和 API。

下游代码现在支持提交 API 相关代码,开发者们可以通过 jitpack 依赖汉化版的 Slimefun。
下游代码现在支持提交 API 相关代码,开发者们可以通过 jitpack/GitHub Package 依赖汉化版的 Slimefun。
Loading

0 comments on commit ba81441

Please sign in to comment.