Skip to content

Commit d3fd7d0

Browse files
committed
Fix CICD
1 parent 02560f7 commit d3fd7d0

10 files changed

Lines changed: 324 additions & 115 deletions

File tree

.gemini/config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
have_fun: false
2+
memory_config:
3+
disabled: false
4+
code_review:
5+
disable: false
6+
comment_severity_threshold: MEDIUM
7+
max_review_comments: -1
8+
pull_request_opened:
9+
help: true
10+
summary: true
11+
code_review: true
12+
include_drafts: true
13+
ignore_patterns: []

.gemini/styleguide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**コメント:**
2+
- 回答は日本語で記載
3+
- 明確で簡潔なコメントを記載(「何を」ではなく「なぜ」を説明)
4+
- 適度にコメントを使用(自己説明的なコードを心がける)
5+
- 完全な文章で記載(大文字始まり、適切な句読点)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build Setup
2+
description: Setup for standard Java builds
3+
4+
inputs:
5+
update-cache:
6+
description: If cache should be updated
7+
required: false
8+
default: 'false'
9+
10+
runs:
11+
using: 'composite'
12+
13+
steps:
14+
- name: Set up JDK 21
15+
uses: actions/setup-java@v5
16+
with:
17+
cache: gradle
18+
distribution: 'temurin'
19+
java-version: '21'
20+
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v5
23+
with:
24+
cache-write-only: ${{ inputs.update-cache }}
25+
gradle-version: 9.3.1
26+
27+
- name: Grant execute permission for gradlew
28+
shell: bash
29+
run: chmod +x gradlew

.github/workflows/build.yml

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
1-
name: Build mod jar
1+
# Build the mod
2+
name: Build
23

34
on:
4-
[workflow_dispatch, push]
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
510

6-
permissions:
7-
contents: read
11+
concurrency:
12+
group: build-${{ github.ref }}
13+
cancel-in-progress: true
814

915
jobs:
1016
build:
11-
17+
name: Build
1218
runs-on: ubuntu-latest
1319

20+
permissions:
21+
contents: read
22+
1423
steps:
15-
- uses: actions/checkout@v6
16-
- name: Set up JDK
17-
uses: actions/setup-java@v5
18-
with:
19-
java-version: '21'
20-
distribution: 'temurin'
21-
- uses: gradle/actions/setup-gradle@v5
22-
with:
23-
gradle-version: 9.3.1
24-
name: Set up Gradle
25-
- name: Add permission
26-
run: chmod +x ./gradlew
27-
- name: Execute Gradle build
28-
run: ./gradlew build
29-
30-
- name: Upload a Build Artifact
31-
uses: actions/upload-artifact@v5
32-
with:
33-
path: build/libs
24+
- name: Checkout Repository
25+
uses: actions/checkout@v6
26+
27+
- name: Setup Build
28+
uses: ./.github/actions/build_setup
29+
30+
- name: Build Project
31+
run: ./gradlew --info --stacktrace build
32+
33+
- name: Upload Jars
34+
uses: actions/upload-artifact@v5
35+
with:
36+
name: AdvancedBackups-Patch
37+
path: build/libs/*.jar
38+
retention-days: 31
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Build and test the mod
2+
name: Build and test
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
timeout:
8+
description: 'Timeout for runServer (seconds)'
9+
required: false
10+
default: 90
11+
type: number
12+
client-only:
13+
description: 'Do not execute runServer'
14+
required: false
15+
default: false
16+
type: boolean
17+
18+
concurrency:
19+
group: build-and-test-${{ inputs.target_branch || github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build-and-test:
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
contents: write
28+
pull-requests: write
29+
30+
steps:
31+
- name: Checkout Repository
32+
uses: actions/checkout@v6
33+
with:
34+
ref: ${{ inputs.target_branch || github.ref }}
35+
36+
- name: Setup Build
37+
uses: ./.github/actions/build_setup
38+
39+
- name: Compile the mod
40+
run: ./gradlew --info --scan --stacktrace assemble
41+
42+
- name: Upload Jars
43+
uses: actions/upload-artifact@v5
44+
with:
45+
name: GTExpert-Core
46+
path: build/libs/*.jar
47+
retention-days: 31
48+
49+
- name: Run post-build checks
50+
id: build_mod
51+
run: ./gradlew --info build
52+
53+
- name: Attempt to make a PR fixing spotless errors
54+
if: ${{ failure() && steps.build_mod.conclusion == 'failure' && github.event_name == 'pull_request' && !github.event.pull_request.draft }}
55+
run: |
56+
git reset --hard
57+
git checkout "${github.ref_name}"
58+
./gradlew --info spotlessApply || exit 1
59+
git diff --exit-code && exit 1
60+
git config user.name "GitHub Actions"
61+
git config user.email "<>"
62+
git switch -c "${FIXED_BRANCH}"
63+
git commit -am "spotlessApply"
64+
git push --force-with-lease origin "${FIXED_BRANCH}"
65+
gh pr create \
66+
--head "${FIXED_BRANCH}" \
67+
--base "${github.ref_name}" \
68+
--title "Spotless apply for branch ${{ github.event.pull_request.head.ref }} for #${{ github.event.pull_request.number }}" \
69+
--body "Automatic spotless apply to fix formatting errors, applies to PR #${{ github.event.pull_request.number }}" \
70+
2>&1 | tee pr-message.log || true
71+
gh pr comment "${github.ref_name}" -F pr-message.log || true
72+
shell: bash # ensures set -eo pipefail
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
FIXED_BRANCH: ${{ github.head_ref }}-spotless-fixes
76+
77+
- name: Run server for ${{ inputs.timeout }} seconds
78+
if: ${{ !inputs.client-only }}
79+
run: |
80+
mkdir -p run/server/
81+
echo "eula=true" > run/server/eula.txt
82+
# Set a constant seed with a village at spawn
83+
echo "stop" > run/server/stop.txt
84+
timeout ${{ inputs.timeout }} ./gradlew runServer 2>&1 < run/stop.txt | tee -a server.log || true
85+
86+
- name: Test no errors reported during server run
87+
if: ${{ !inputs.client-only }}
88+
run: |
89+
chmod +x ./scripts/test_no_error_reports.sh
90+
./scripts/test_no_error_reports.sh

.github/workflows/publish.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Publishes the project to GitHub Releases, CurseForge, and Modrinth
2+
name: Publish Project
3+
4+
on:
5+
push:
6+
tags:
7+
- "*"
8+
9+
concurrency:
10+
group: publish-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
publish:
15+
name: Publish
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- name: Checkout Repository
23+
uses: actions/checkout@v6
24+
with:
25+
ref: main
26+
fetch-depth: 0
27+
fetch-tags: true
28+
29+
- name: Extract version from tag
30+
id: version
31+
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
32+
33+
- name: Update mod_version in gradle.properties
34+
run: sed -i "s/mod_version.*=.*/mod_version = ${{ steps.version.outputs.version }}/g" gradle.properties
35+
36+
- name: Commit and push gradle.properties
37+
uses: stefanzweifel/git-auto-commit-action@v7
38+
with:
39+
commit_message: "Bump version to v${{ steps.version.outputs.version }}"
40+
file_pattern: gradle.properties
41+
42+
- name: Setup Build
43+
uses: ./.github/actions/build_setup
44+
45+
- name: Build Project
46+
run: ./gradlew --info build
47+
48+
- name: Create GitHub Release
49+
uses: ncipollo/release-action@v1.20.0
50+
with:
51+
artifacts: "build/libs/*"
52+
generateReleaseNotes: true
53+
54+
# - name: Publish to CurseForge and Modrinth
55+
# uses: Kir-Antipov/mc-publish@v3.3
56+
# with:
57+
# # Only include this section if you wish to publish
58+
# # your assets on Modrinth.
59+
# modrinth-id: placeholder
60+
# modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
61+
#
62+
# # Only include this section if you wish to publish
63+
# # your assets on CurseForge.
64+
# curseforge-id: placeholder
65+
# curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
66+
#
67+
# files: |
68+
# build/libs/!(*-@(dev|sources|javadoc)).jar
69+
# build/libs/*-@(dev|sources|javadoc).jar
70+
# loaders: forge
71+
# game-versions: 1.12.2
72+
# java: |
73+
# 21
74+
# 22
75+
# version: ${{ steps.version.outputs.version }}
76+
# changelog: ${{ steps.changes.outputs.changes }}
77+
# retry-attempts: 2

.github/workflows/release-to-cf-mr.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)