Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed May 15, 2024
0 parents commit bfefa51
Show file tree
Hide file tree
Showing 19 changed files with 4,529 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4
ij_any_block_comment_add_space = false
ij_any_block_comment_at_first_column = false
ij_any_line_comment_at_first_column = false
ij_any_line_comment_add_space = true
max_line_length = 120
ij_visual_guides = 80

[*.tiny]
indent_style=tab

[*.bat]
end_of_line=crlf

[*.yml]
indent_size=2

[*.patch]
trim_trailing_whitespace=false

[*.java]
ij_continuation_indent_size = 4
ij_java_class_count_to_use_import_on_demand = 999999
ij_java_insert_inner_class_imports = false
ij_java_names_count_to_use_import_on_demand = 999999
ij_java_imports_layout = *,|,$*
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true

[*-Server/src/main/resources/data/**/*.json]
indent_size = 2

[paper-api-generator/generated/**/*.java]
ij_java_imports_layout = $*,|,*
43 changes: 43 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test Gradle build script

on:
push:
branches: [ "ver/*", "dev/*", "feat/**/*" ]
paths:
- "*.kt"
- "*.kts"
- "*.toml"
- "gradle-wrapper.*"
workflow_dispatch:

jobs:
check:
name: Test Gradle build script
strategy:
matrix:
jdk: [21]
java: ['zulu']
os: [ubuntu-22.04]

if: "!contains(github.event.commits[0].message, '[CheckSkip]')"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout action
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
distribution: ${{ matrix.java }}
java-version: ${{ matrix.jdk }}
cache: 'gradle'

- name: Configure Git
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
- name: Run Gradle
run: ./gradlew --stacktrace
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release Volt

on:
push:
branches: [ "ver/*", "dev/*", "feat/**/*" ]
paths:
- "**.patch"
workflow_dispatch:

env:
ORG_NAME: PlazmaMC
MC_VERSION: 1.20.4

jobs:
release:
name: Release Volt
strategy:
matrix:
base_jdk: [17]
os: [ubuntu-22.04]

if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')"
runs-on: ${{ matrix.os }}
steps:
- name: Setup Variables
id: setup
env:
BRANCH: ${{ github.ref_name }}
run: echo "branch=${BRANCH##*/}" >> $GITHUB_OUTPUT

- name: Checkout repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up GraalVM ${{ matrix.base_jdk }}
uses: graalvm/setup-graalvm@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
java-version: ${{ matrix.base_jdk }}
version: latest
cache: 'gradle'

- name: Configure Git
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"

- name: Apply Patches
run: ./gradlew applyPatches --stacktrace

- name: Build
run: ./gradlew build --stacktrace

- name: Create Reobf Jar
run: ./gradlew createReobfPaperclipJar --stacktrace

- name: Create Mojmap Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace

- name: Publish Packages
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
run: |
export GITHUB_USERNAME=${{ env.ORG_NAME }}
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
./gradlew publish --stacktrace
- name: Get Release Number
if: startsWith(github.ref_name, 'ver/')
run: echo "RELEASE=$(git ls-remote --tags origin | grep "build/${{ env.MC_VERSION }}" | wc -l)" >> $GITHUB_ENV

- name: Release Artifacts
if: startsWith(github.ref_name, 'ver/')
uses: softprops/[email protected]
with:
name: "Build #${{ env.RELEASE }} for ${{ env.MC_VERSION }}"
tag_name: build/${{ env.MC_VERSION }}/${{ env.RELEASE }}
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar

- name: Release Artifacts (Latest/Stable)
if: startsWith(github.ref_name, 'ver/')
uses: softprops/[email protected]
with:
name: "Build #${{ env.RELEASE }} for ${{ env.MC_VERSION }}"
tag_name: build/${{ env.MC_VERSION }}/latest
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar

- name: Release Artifacts (Latest/Development)
if: startsWith(github.ref_name, 'dev/')
uses: softprops/[email protected]
with:
name: "Development Build for ${{ env.MC_VERSION }}"
tag_name: build/${{ env.MC_VERSION }}/latest
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar
118 changes: 118 additions & 0 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Always Up To Date
on:
workflow_dispatch:
schedule:
- cron: "*/20 * * * *"

jobs:
prepare:
name: Prepare Actions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Pull Branches
id: matrix
run: |
respond=$(curl --silent https://api.github.com/repos/plazmamc/thunderbolt/branches | jq -rc 'del(.[]|.protected) | del(.[]|.commit)')
flavor=$(echo $respond | jq -rc 'map(select(.name | test("feat/.*")) | .flavor = .name | del(.name))')
echo "matrix={\"include\":$(echo "$base $flavor" | jq -sc add)}" >> $GITHUB_OUTPUT
upstream:
name: Update Base Upstream
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: base

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21

- name: Determine if update is required
id: check
run: echo "needs=$(./gradlew -q checkNeedsUpdate)" >> $GITHUB_OUTPUT

- name: Configure Git
if: steps.check.outputs.needs == 'true'
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"

- name: Update upstream
if: steps.check.outputs.needs == 'true'
run: ./gradlew updateUpstream

- name: Apply patches
if: steps.check.outputs.needs == 'true'
run: ./gradlew applyPatches

- name: Check build
if: steps.check.outputs.needs == 'true'
run: ./gradlew build

- name: Commit changes
if: steps.check.outputs.needs == 'true'
run: git add . && printf "Updated Upstream (Plazma)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -

- name: Push changes
if: steps.check.outputs.needs == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

flavor:
name: Update Flavors Upstream
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.flavor }}

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 21

- name: Determine if update is required
id: check
run: echo "needs=$(./gradlew -q checkNeedsUpdate)" >> $GITHUB_OUTPUT

- name: Configure Git
if: steps.check.outputs.needs == 'true'
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"

- name: Update upstream
if: steps.check.outputs.needs == 'true'
run: ./gradlew updateUpstream

- name: Apply patches
if: steps.check.outputs.needs == 'true'
run: ./gradlew applyPatches

- name: Check build
if: steps.check.outputs.needs == 'true'
run: ./gradlew build

- name: Commit changes
if: steps.check.outputs.needs == 'true'
run: git add . && printf "Updated Upstream (Base)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -

- name: Push changes
if: steps.check.outputs.needs == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# JVM crash related
core.*
hs_err_pid*

# Intellij
.idea/
*.iml
*.ipr
*.iws
out/

# Eclipse
.classpath
.project
.settings/

# netbeans
nbproject/
nbactions.xml

# Gradle
!gradle-wrapper.jar
.gradle/
build/
*/build/
run/
javadoc/

# we use maven!
build.xml

# Maven
log/
target/
dependency-reduced-pom.xml

# various other potential build files
bin/
dist/
manifest.mf

# Mac
.DS_Store/
.DS_Store

# vim
.*.sw[a-p]

# Linux temp files
*~

# Paperweight
libs/
build-data/
*-API
*-MojangAPI
*-Server
paper-api-generator
compare.txt
*.patch
!patches/**/*
23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License (MIT)
=====================

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit bfefa51

Please sign in to comment.