Skip to content

Commit

Permalink
Merge branch 'master' into 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jan 13, 2025
2 parents 26d57a0 + 7da725e commit 552ecda
Show file tree
Hide file tree
Showing 24 changed files with 1,233 additions and 134 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/auto_snapshot_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
cf_game_version:
description: "CurseForge GameVersion"
required: true
distinct_id:
description: "Automatically set by the return-dispatch action (leave blank if running manually)"
required: false

permissions:
# To push changes to the new snapshot branch.
Expand All @@ -31,6 +34,9 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -72,23 +78,24 @@ jobs:
git checkout -b $BRANCH_NAME
echo "Created and checked out new branch: $BRANCH_NAME"
fi
shell: bash
- name: Run migrateMappings task
run: |
./gradlew migrateMappings --mappings ${{ github.event.inputs.yarn_mappings }}
shell: bash
- name: Replace src/main/java with remapped files
run: |
rm -rf ./src/main/java
mv ./remappedSrc ./src/main/java
shell: bash
- name: Update version constants
run: |
python scripts/update_version_constants.py "${{ github.event.inputs.mc_version }}" "${{ github.event.inputs.yarn_mappings }}" "${{ github.event.inputs.fabric_loader }}" "${{ github.event.inputs.fapi_version }}" "${{ github.event.inputs.cf_game_version }}"
shell: bash
python scripts/update_version_constants.py \
"${{ github.event.inputs.mc_version }}" \
"${{ github.event.inputs.yarn_mappings }}" \
"${{ github.event.inputs.fabric_loader }}" \
"${{ github.event.inputs.fapi_version }}" \
"${{ github.event.inputs.cf_game_version }}"
# To fix any style issues that the migration scripts might cause
- name: Run spotlessApply task
Expand All @@ -101,13 +108,22 @@ jobs:
git add .
git commit -m "[Wurst-Bot] Update to ${{ github.event.inputs.mc_version }}"
git push --set-upstream origin ${{ github.event.inputs.mc_version }}
shell: bash
# For some reason the commit above doesn't automatically trigger the CI
# workflow, so we need to explicitly start it here.
- name: Trigger CI on the new branch
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run gradle.yml --ref ${{ github.event.inputs.mc_version }}
shell: bash
id: ci_dispatch
uses: codex-/return-dispatch@v2
with:
token: ${{ github.token }}
owner: Wurst-Imperium
repo: WI-Zoom
ref: ${{ github.event.inputs.mc_version }}
workflow: gradle.yml

- name: Wait for CI to finish (run ${{ steps.ci_dispatch.outputs.run_id }})
uses: codex-/await-remote-run@v1
with:
token: ${{ github.token }}
owner: Wurst-Imperium
repo: WI-Zoom
run_id: ${{ steps.ci_dispatch.outputs.run_id }}
run_timeout_seconds: 600 # 10 minutes
32 changes: 32 additions & 0 deletions .github/workflows/check_translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check Translations

on:
push:
branches-ignore:
- "dependabot/**"
tags-ignore:
- "**"
paths:
- "src/main/resources/assets/wi_zoom/lang/**.json"
- "src/main/resources/intentionally_untranslated.json"
pull_request:
paths:
- "src/main/resources/assets/wi_zoom/lang/**.json"
- "src/main/resources/intentionally_untranslated.json"
workflow_dispatch:

jobs:
check_translations:
runs-on: ubuntu-latest
steps:

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

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Run check_translations.py
run: python scripts/check_translations.py
3 changes: 2 additions & 1 deletion .github/workflows/dependency_graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ on:
workflow_dispatch:

permissions:
# Needed by the dependency-submission action.
contents: write

jobs:
dependency-submission:
dependency_graph:
runs-on: ubuntu-latest
steps:

Expand Down
69 changes: 61 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: Java CI with Gradle
run-name: |
${{ github.event_name == 'pull_request'
&& format('Test changes in PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title)
|| format('Test changes in {0}: {1}', github.ref_name, github.event.head_commit.message) }}

on:
push:
branches:
- "**"
branches-ignore:
- "dependabot/**"
tags-ignore:
- "**"
paths:
Expand All @@ -24,6 +20,10 @@ on:
- "gradle**"
- "*.gradle"
workflow_dispatch:
inputs:
distinct_id:
description: "Automatically set by the return-dispatch action (leave blank if running manually)"
required: false

jobs:
build:
Expand All @@ -33,6 +33,9 @@ jobs:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
steps:

- name: Echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}

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

Expand Down Expand Up @@ -61,7 +64,10 @@ jobs:
run: ./gradlew spotlessJsonCheck || (echo "::error::JSON validation failed! Run './gradlew spotlessApply' to fix style issues, or check the full error message for syntax errors." && exit 1)

- name: Validate Java code style
run: ./gradlew spotlessCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1)
run: ./gradlew spotlessJavaCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1)

- name: Validate license headers
run: ./gradlew spotlessLicenseHeaderCheck || (echo "::error::License headers are missing or malformed in some files! Run './gradlew spotlessApply' to fix this, or check the full error message for details." && exit 1)

- name: Run unit tests
run: ./gradlew test --stacktrace --warning-mode=fail
Expand All @@ -86,7 +92,6 @@ jobs:

- name: Add VirusTotal links to build summary
if: ${{ env.VIRUSTOTAL_API_KEY && steps.virustotal.outputs.analysis }}
shell: bash
run: |
echo "<details open>" >> $GITHUB_STEP_SUMMARY
echo "<summary>🛡️ VirusTotal Scans</summary>" >> $GITHUB_STEP_SUMMARY
Expand All @@ -99,3 +104,51 @@ jobs:
echo "- [$filename]($url)" >> $GITHUB_STEP_SUMMARY
done
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Run the mod and take screenshots
uses: GabrielBB/[email protected]
with:
run: ./gradlew runEndToEndTest --stacktrace --warning-mode=fail

# Needed because the screenshot gallery won't be created on pull requests.
# Also useful if Imgur uploads fail.
- name: Upload Test Screenshots.zip artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: Test Screenshots
path: run/screenshots

- name: Create test screenshot gallery
if: ${{ env.IMGUR_CLIENT_ID && (success() || failure()) }}
# Imgur uploads randomly fail sometimes, probably because of the low rate limit.
# TODO: Find a better place to upload the screenshots.
continue-on-error: true
run: |
echo "<details open>" >> $GITHUB_STEP_SUMMARY
echo "<summary>📸 Test Screenshots</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
for img in run/screenshots/*.png; do
if [ -f "$img" ]; then
filename=$(basename "$img")
name_without_ext="${filename%.*}"
# Upload to Imgur
response=$(curl -s -X POST \
-H "Authorization: Client-ID $IMGUR_CLIENT_ID" \
-F "image=@$img" \
https://api.imgur.com/3/image)
# Extract the URL from the response
url=$(echo $response | grep -o '"link":"[^"]*"' | cut -d'"' -f4)
if [ ! -z "$url" ]; then
# Convert underscores to spaces and capitalize first letter of each word
title=$(echo "$name_without_ext" | tr '_' ' ' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1')
echo "### $title" >> $GITHUB_STEP_SUMMARY
echo "![${name_without_ext}]($url)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
else
echo "Failed to upload $filename" >> $GITHUB_STEP_SUMMARY
echo "Imgur upload response for $filename: $response"
fi
fi
done
echo "</details>" >> $GITHUB_STEP_SUMMARY
Loading

0 comments on commit 552ecda

Please sign in to comment.