-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Build Setup | ||
description: Setup for standard Java builds | ||
|
||
inputs: | ||
update-cache: | ||
description: If cache should be updated | ||
required: false | ||
default: 'false' | ||
|
||
runs: | ||
using: 'composite' | ||
|
||
steps: | ||
- name: Set up JDK 8 and 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
cache: gradle | ||
distribution: 'zulu' | ||
java-version: | | ||
8 | ||
17 | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
cache-write-only: ${{ inputs.update-cache }} | ||
gradle-home-cache-includes: | | ||
caches | ||
caches/retro_futura_gradle | ||
notifications | ||
jdks | ||
wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Build and test the mod | ||
name: Build and test | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
timeout: | ||
description: 'Timeout for runServer (seconds)' | ||
required: false | ||
default: 90 | ||
type: number | ||
client-only: | ||
description: 'Do not execute runServer' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
concurrency: | ||
group: build-and-test-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Apply patch to gradle.properties | ||
run: sed -i 's/debug_all = false/debug_all = true/g' gradle.properties | ||
|
||
- name: Setup Build | ||
uses: ./.github/actions/build_setup | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Compile the mod | ||
run: ./gradlew --info --scan assemble | ||
|
||
- name: Upload Jars | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: GTBeesMatrix | ||
path: build/libs/*.jar | ||
retention-days: 31 | ||
|
||
- name: Run post-build checks | ||
id: build_mod | ||
run: ./gradlew --info build | ||
|
||
- name: Attempt to make a PR fixing spotless errors | ||
if: ${{ failure() && steps.build_mod.conclusion == 'failure' && github.event_name == 'pull_request' && !github.event.pull_request.draft }} | ||
run: | | ||
git reset --hard | ||
git checkout "${github.ref_name}" | ||
./gradlew --info spotlessApply || exit 1 | ||
git diff --exit-code && exit 1 | ||
git config user.name "GitHub Actions" | ||
git config user.email "<>" | ||
git switch -c "${FIXED_BRANCH}" | ||
git commit -am "spotlessApply" | ||
git push --force-with-lease origin "${FIXED_BRANCH}" | ||
gh pr create \ | ||
--head "${FIXED_BRANCH}" \ | ||
--base "${github.ref_name}" \ | ||
--title "Spotless apply for branch ${{ github.event.pull_request.head.ref }} for #${{ github.event.pull_request.number }}" \ | ||
--body "Automatic spotless apply to fix formatting errors, applies to PR #${{ github.event.pull_request.number }}" \ | ||
2>&1 | tee pr-message.log || true | ||
gh pr comment "${github.ref_name}" -F pr-message.log || true | ||
shell: bash # ensures set -eo pipefail | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FIXED_BRANCH: ${{ github.head_ref }}-spotless-fixes | ||
|
||
- name: Run server for ${{ inputs.timeout }} seconds | ||
if: ${{ !inputs.client-only }} | ||
run: | | ||
mkdir -p run | ||
echo "eula=true" > run/eula.txt | ||
# Set a constant seed with a village at spawn | ||
echo "stop" > run/stop.txt | ||
timeout ${{ inputs.timeout }} ./gradlew runServer 2>&1 < run/stop.txt | tee -a server.log || true | ||
- name: Test no errors reported during server run | ||
if: ${{ !inputs.client-only }} | ||
run: | | ||
chmod +x ./scripts/test_no_error_reports.sh | ||
./scripts/test_no_error_reports.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Runs formatting requirements | ||
name: Java Formatting | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: ['src/main/java/**', 'src/test/**'] | ||
pull_request: | ||
paths: ['src/main/java/**', 'src/test/**'] | ||
|
||
concurrency: | ||
group: format-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
formatting: | ||
name: Formatting | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Setup Build | ||
uses: ./.github/actions/build_setup | ||
|
||
- name: Run Spotless Formatting Check with Gradle | ||
id: build | ||
run: ./gradlew --info spotlessCheck | ||
|
||
- name: Attempt to make a PR fixing spotless errors | ||
if: failure() && steps.build.conclusion == 'failure' | ||
run: | | ||
git reset --hard | ||
git checkout "${PR_BRANCH}" | ||
./gradlew --info spotlessApply || exit 1 | ||
git diff --exit-code && exit 1 | ||
git config user.name "GitHub Actions" | ||
git config user.email "<>" | ||
git switch -c "${FIXED_BRANCH}" | ||
git commit -am "spotlessApply" | ||
git push --force-with-lease origin "${FIXED_BRANCH}" | ||
gh pr create \ | ||
--head "${FIXED_BRANCH}" \ | ||
--base "${PR_BRANCH}" \ | ||
--title "Spotless apply for branch ${PR_BRANCH} for #${PR_NUMBER}" \ | ||
--body "Automatic spotless apply to fix formatting errors, applies to PR #${PR_NUMBER}" \ | ||
2>&1 | tee pr-message.log || true | ||
gh pr comment "${PR_BRANCH}" -F pr-message.log || true | ||
shell: bash # ensures set -eo pipefail | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_BRANCH: ${{ github.event.pull_request.head.ref }} | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
FIXED_BRANCH: ${{ github.head_ref }}-spotless-fixes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Publishes the project to GitHub Releases, CurseForge, and Modrinth | ||
name: Publish Project | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Mod version' | ||
required: true | ||
release_type: | ||
description: 'Release type' | ||
type: choice | ||
default: 'beta' | ||
options: | ||
- 'release' | ||
- 'beta' | ||
- 'alpha' | ||
|
||
env: | ||
# link to the changelog with a format code for the version | ||
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{ github.repository }}/releases/tag/GTBeesMatrix-v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }})" | ||
# Version of the mod | ||
FULL_VERSION: "${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}" | ||
# type of release | ||
NAME: "GTBeesMatrix" | ||
|
||
# Curseforge and Modrinth project IDs | ||
CURSEFORGE_PROJECT_ID: "" | ||
MODRINTH_PROJECT_ID: "" | ||
|
||
concurrency: | ||
group: publish-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check if tag already exists | ||
run: | | ||
if git rev-parse --verify --quiet "v${{ github.event.inputs.version }}"; then | ||
echo "Version ${{ github.event.inputs.version }} already exists, aborting workflow." | ||
exit 1 | ||
fi | ||
- name: Set version | ||
run: sed -i "s/modVersion.*=.*/modVersion = ${{ env.FULL_VERSION }}/g" gradle.properties | ||
|
||
- name: Commit and push gradle.properties | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "Bump version to v${{ env.FULL_VERSION }}" | ||
commit_options: '--no-verify' | ||
file_pattern: gradle.properties | ||
tagging_message: "v${{ env.FULL_VERSION }}" | ||
|
||
- name: Setup Build | ||
uses: ./.github/actions/build_setup | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build Project | ||
run: ./gradlew --info build | ||
|
||
- name: Publish to Curseforge and Modrinth | ||
uses: Kir-Antipov/[email protected] | ||
with: | ||
github-tag: "v${{ env.FULL_VERSION }}" | ||
github-generate-changelog: true | ||
github-draft: false | ||
github-prerelease: false | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# modrinth-id: ${{ env.MODRINTH_PROJECT_ID }} | ||
# modrinth-token: "${{ secrets.MODRINTH_API_KEY }}" | ||
# modrinth-dependencies: | | ||
# G1ckZuWK(required) | ||
# tULldUx4(required) | ||
# tZiutdLG(required) | ||
# curseforge-id: ${{ env.CURSEFORGE_PROJECT_ID }} | ||
# curseforge-token: "${{ secrets.CURSEFORGE_API_KEY }}" | ||
# curseforge-dependencies: | | ||
# mixin-booter(required) | ||
# gregtech-ce-unofficial(required) | ||
# gregicality-multiblocks(required) | ||
# implosionnobomb(recommended) | ||
# ae2-extended-life(recommended) | ||
# ae-additions-extra-cells-2-fork(recommended) | ||
# nae2(recommended) | ||
# ender-io-base(recommended) | ||
# ender-io-machines(recommended) | ||
# ender-io-endergy(recommended) | ||
# ender-io-conduits(recommended) | ||
# ender-io-ae2-conduits(recommended) | ||
# gregtech-food-option(recommended) | ||
# chisel(recommended) | ||
# extracpus(recommended) | ||
# draconic-evolution(recommended) | ||
# draconicadditions(recommended) | ||
# project-red-illumination(recommended) | ||
# avaritia-1-1x-unofficial(recommended) | ||
# thaumcraft(recommended) | ||
# forestry(recommended) | ||
# gendustry(recommended) | ||
# binnies-mods-patched(recommended) | ||
# ulv-covers(incompatible) | ||
files: | | ||
build/libs/!(*-@(dev|sources|javadoc)).jar | ||
build/libs/*-@(sources).jar | ||
build/libs/*-@(dev).jar | ||
name: "${{ env.NAME }}-${{ env.FULL_VERSION }}.jar" | ||
changelog: "Changelog is available [here](https://github.com/${{github.repository}}/blob/main/CHANGELOG.md)" | ||
version: "${{ github.event.inputs.version }}" | ||
version-type: "${{ github.event.inputs.release_type }}" | ||
loaders: | | ||
forge | ||
game-versions: | | ||
1.12.2 | ||
java: | | ||
8 | ||
retry-attempts: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Auto rebase pull requests when a comment contains `/rebase` or `/autosquash` | ||
name: Automatic Rebase | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
rebase: | ||
name: Rebase | ||
runs-on: ubuntu-latest | ||
if: >- | ||
github.event.issue.pull_request != '' && | ||
( | ||
contains(github.event.comment.body, '/rebase') || | ||
contains(github.event.comment.body, '/autosquash') | ||
) | ||
steps: | ||
- name: Checkout the latest code | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | ||
- name: Automatic Rebase | ||
uses: cirrus-actions/[email protected] | ||
with: | ||
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Runs tests | ||
name: Java Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
concurrency: | ||
group: test-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Apply patch to build.gradle | ||
run: sed -i 's/debug_all = false/debug_all = true/g' gradle.properties | ||
|
||
- name: Setup Build | ||
uses: ./.github/actions/build_setup | ||
|
||
- name: Run Tests with Gradle | ||
run: ./gradlew --info --scan test |
Oops, something went wrong.