Skip to content

Implement custom crafting recipes as official JSON recipes #2234

Implement custom crafting recipes as official JSON recipes

Implement custom crafting recipes as official JSON recipes #2234

Workflow file for this run

name: Build modules
on:
push:
branches: [ master, ver/* ]
pull_request:
workflow_dispatch:
env:
VERSION: '1.21'
COMMIT_MSG: ${{ github.event.head_commit.message }}
jobs:
build:
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.event_name != 'pull_request' && 'release' || format('pr-{0}', github.event.number) }}
steps:
- uses: actions/checkout@v4
- name: Checkout release branch
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
with:
ref: release
path: release
- name: Fetch pull request base
if: github.event_name == 'pull_request'
run: git fetch origin ${{ github.base_ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-in-project: true
- name: Setup cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install
- name: Build and publish all modules
if: github.event_name != 'pull_request'
run: poetry run beet -p beet-release.yaml -l ${{ env.LOG_LEVEL }} build
env:
BEET_MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
BEET_SMITHED_TOKEN: ${{ secrets.SMITHED_TOKEN }}
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}}
MASTER_BUILD: true
- name: Build all modules for pull request
if: github.event_name == 'pull_request'
run: poetry run beet -p beet-release.yaml -l ${{ env.LOG_LEVEL }} build
env:
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}}
- name: Remove non-modules for artifact
if: github.event_name == 'pull_request'
run: |
rm -r release/$VERSION/generated
rm release/$VERSION/lib_*
rm release/$VERSION/meta.json
- name: Upload artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: 'Modules for pull request #${{ github.event.number }}'
path: ${{ github.workspace }}/release/${{ env.VERSION }}/
- name: Commit release
if: github.event_name != 'pull_request'
run: |
git config --global user.email "${{ github.event.head_commit.author.email }}"
git config --global user.name "${{ github.event.head_commit.author.username }}"
cd release
git add .
git commit -m "🚀 ${{ github.event.after }} $COMMIT_MSG"
- name: Push release
if: github.event_name != 'pull_request'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: release
branch: release
test:
strategy:
fail-fast: false
matrix:
include:
# https://fabricmc.net/use/server/
# https://modrinth.com/mod/fabric-api/versions
# https://modrinth.com/mod/packtest/versions
- version: '1.21.1'
fabric_server_url: https://meta.fabricmc.net/v2/versions/loader/1.21.1/0.16.5/1.0.1/server/jar
fabric_api_url: https://cdn.modrinth.com/data/P7dR8mSH/versions/WTaAx4ah/fabric-api-0.105.0%2B1.21.1.jar
packtest_url: https://cdn.modrinth.com/data/XsKUhp45/versions/x9txtivi/packtest-1.8-mc1.21.1.jar
- version: '1.21.3'
fabric_server_url: https://meta.fabricmc.net/v2/versions/loader/1.21.3/0.16.7/1.0.1/server/jar
fabric_api_url: https://cdn.modrinth.com/data/P7dR8mSH/versions/dhD4I4lJ/fabric-api-0.106.1%2B1.21.3.jar
packtest_url: https://cdn.modrinth.com/data/XsKUhp45/versions/wjOUK14F/packtest-1.9-mc1.21.2.jar
name: 'test-${{ matrix.version }}'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-in-project: true
- name: Setup cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install
- name: Build all modules for tests
run: poetry run beet -p beet-test.yaml -l ${{ env.LOG_LEVEL }} build
env:
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Download server files
run: |
curl -o server.jar ${{ matrix.fabric_server_url }}
mkdir mods
curl -o mods/fabric-api.jar ${{ matrix.fabric_api_url }}
curl -o mods/packtest.jar ${{ matrix.packtest_url }}
- name: Copy packs to world
run: |
mkdir -p world/datapacks
rm out/gm4_zauber_cauldrons.zip
rm out/gm4_zauber_liquids.zip
cp out/gm4_*.zip world/datapacks
- name: Run test server
id: run-tests
run: |
java -Xmx2G -Dpacktest.auto -Dpacktest.auto.annotations -jar server.jar nogui
- name: Upload test world
if: ${{ failure() && steps.run-tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: 'Test world in ${{ matrix.version }} for ${{ github.sha }}'
path: ${{ github.workspace }}/world/