Skip to content

Commit

Permalink
Merge master into 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jan 31, 2025
1 parent 81c17df commit 0af9c36
Show file tree
Hide file tree
Showing 609 changed files with 972 additions and 781 deletions.
27 changes: 14 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# Dependabot version updates, see:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
# Directory should be `/` instead of `/.github/workflows` according to the docs.
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
time: "06:00"
timezone: "Europe/Berlin"
- package-ecosystem: "github-actions"
# Directory should be `/` instead of `/.github/workflows` according to the docs.
directory: "/"
schedule:
interval: "daily"
time: "06:00"
timezone: "Europe/Berlin"
41 changes: 28 additions & 13 deletions .github/workflows/auto_snapshot_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ on:
fapi_version:
description: "Fabric API version"
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 @@ -50,6 +53,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 @@ -91,23 +97,23 @@ 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 }}"
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 }}"
# To fix any style issues that the migration scripts might cause
- name: Run spotlessApply task
Expand All @@ -120,13 +126,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: Wurst7
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: Wurst7
run_id: ${{ steps.ci_dispatch.outputs.run_id }}
run_timeout_seconds: 600 # 10 minutes
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
21 changes: 14 additions & 7 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,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 @@ -29,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 @@ -57,6 +64,9 @@ jobs:
- name: Validate Java code style
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 @@ -80,7 +90,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 @@ -95,7 +104,7 @@ jobs:
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Run the mod and take screenshots
uses: modmuss50/xvfb-action@c56c7da0c8fc9a7cb5df2e50dd2a43a80b64c5cb
uses: GabrielBB/xvfb-action@v1.7
with:
run: ./gradlew runEndToEndTest --stacktrace --warning-mode=fail

Expand All @@ -110,26 +119,24 @@ jobs:

- name: Create test screenshot gallery
if: ${{ env.IMGUR_CLIENT_ID && (success() || failure()) }}
shell: bash
# 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')
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/multi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Publish Multiple Releases
run-name: Publish v${{ github.event.inputs.wurst_version }} build(s) from ${{ github.event.inputs.branches }}

on:
workflow_dispatch:
inputs:
wurst_version:
description: "Wurst version (without v or -MC)"
required: true
type: string
branches:
description: "Space-separated list of branches to publish from"
required: true
type: string
announce_ports:
description: "Announce as ports on WurstForum"
required: true
type: boolean
default: false
dry_run:
description: "Dry-run mode (don't actually publish anything)"
required: false
type: boolean
default: false

permissions:
# Needed to trigger the publish workflow.
actions: write

jobs:

prepare:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.set_branches.outputs.branches }}
steps:
- name: Convert branches input to JSON array
id: set_branches
run: |
JSON_ARRAY=$(echo "[\"$(echo ${{ inputs.branches }} | tr ' ' '\",\"')\"]")
echo "branches=$JSON_ARRAY" >> "$GITHUB_OUTPUT"
echo "Branches: $JSON_ARRAY" >> "$GITHUB_STEP_SUMMARY"
publish_each:
runs-on: ubuntu-latest
needs: prepare
if: ${{ !fromJson(inputs.dry_run) }}
strategy:
# Each job pushes an automated commit to WurstClient.net@master, so running them all in parallel
# would likely cause conflicts. Also, various servers might hit rate limits if we just upload
# all of the files at once.
max-parallel: 1
# If something goes wrong, all published files have to be manually deleted.
# Best to fail as early as possible.
fail-fast: true
matrix:
branch: ${{ fromJson(needs.prepare.outputs.branches) }}
# TODO: Maybe also verify that the wurst_version in each branch is as expected before publishing?
steps:
- name: Build publish inputs
id: publish_inputs
run: |
JSON_STRING=$(cat << EOF
{
"close_milestone": "true",
"upload_backups": "true",
"publish_github": "true",
"update_website": "true"
}
EOF
)
# Convert to single line and escape quotes
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
- name: Trigger publish workflow
id: publish_dispatch
uses: codex-/return-dispatch@v2
with:
token: ${{ github.token }}
owner: Wurst-Imperium
repo: Wurst7
ref: ${{ matrix.branch }}
workflow: publish.yml
workflow_inputs: ${{ steps.publish_inputs.outputs.json }}
- name: Wait for publish workflow to finish (run ${{ steps.publish_dispatch.outputs.run_id }})
uses: codex-/await-remote-run@v1
with:
token: ${{ github.token }}
owner: Wurst-Imperium
repo: Wurst7
run_id: ${{ steps.publish_dispatch.outputs.run_id }}
run_timeout_seconds: 600 # 10 minutes

announce:
runs-on: ubuntu-latest
needs: [prepare, publish_each]
if: ${{ !failure() && !cancelled() && inputs.announce_ports }}
steps:
- name: Build announcement inputs
id: announce_inputs
run: |
JSON_STRING=$(cat << EOF
{
"wurst_version": "${{ inputs.wurst_version }}",
"branches": "${{ inputs.branches }}",
"dry_run": "${{ inputs.dry_run }}"
}
EOF
)
# Convert to single line and escape quotes
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
- name: Trigger announce workflow
id: announce_dispatch
uses: codex-/return-dispatch@v2
with:
token: ${{ secrets.WURSTCLIENT_NET_PUBLISH_TOKEN }}
owner: Wurst-Imperium
repo: WurstClient.net
ref: gh-pages
workflow: announce_wurst_ports.yml
workflow_inputs: ${{ steps.announce_inputs.outputs.json }}
- name: Wait for announce workflow to finish (run ${{ steps.announce_dispatch.outputs.run_id }})
uses: codex-/await-remote-run@v1
with:
token: ${{ secrets.WURSTCLIENT_NET_PUBLISH_TOKEN }}
owner: Wurst-Imperium
repo: WurstClient.net
run_id: ${{ steps.announce_dispatch.outputs.run_id }}
run_timeout_seconds: 600 # 10 minutes
Loading

0 comments on commit 0af9c36

Please sign in to comment.