Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: _step.build

on:
workflow_call:
inputs:
release:
type: boolean
required: false
default: false
target_subproject:
description: see release.yml, leave it empty to build all
type: string
required: false
default: ''
# [FEATURE] MIXIN_AUDITOR
mixin_audit:
description: run mixin audit for Minecraft after build
type: boolean
required: false
default: false

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- name: Cache gradle files
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
./.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle.properties', '**/*.accesswidener', 'settings.json') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build with gradle
run: |
chmod +x gradlew
if [ -z "${{ inputs.target_subproject }}" ]; then
echo "Building all subprojects"
./gradlew build
else
args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:build/' | paste -sd ' ')
echo "Building with arguments=$args"
./gradlew $args
fi
env:
BUILD_ID: ${{ github.run_number }}
BUILD_RELEASE: ${{ inputs.release }}

# [FEATURE] MIXIN_AUDITOR
# - name: Run mixin audit check for Minecraft client
# if: ${{ inputs.mixin_audit }}
# timeout-minutes: 10
# run: |
# mkdir -p ./run
# echo eula=true > ./run/eula.txt # server needs this
# ./gradlew runClientMixinAudit

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: versions/*/build/libs/

- name: Collect mod jars
run: |
shopt -s extglob
mkdir mod-jars
for jar in versions/*/build/libs/!(*-@(dev|sources|shadow)).jar; do
cp -p "$jar" mod-jars/
done
ls -l mod-jars

# This is the artifact recommended for users to download
- name: Upload mod jars
uses: actions/upload-artifact@v4
with:
name: mod-jars
path: mod-jars/*.jar

# # [FEATURE] FALLENS_MAVEN
# - name: Publish with gradle
# if: inputs.release || github.ref == 'refs/heads/dev'
# run: |
# if [ -z "${{ inputs.target_subproject }}" ]; then
# echo "Publishing all subprojects"
# ./gradlew publish
# else
# args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:publish/' | paste -sd ' ')
# echo "Publishing with arguments=$args"
# ./gradlew $args
# fi
# env:
# BUILD_ID: ${{ github.run_number }}
# BUILD_RELEASE: ${{ inputs.release }}
# FALLENS_MAVEN_TOKEN: ${{ secrets.FALLENS_MAVEN_TOKEN }}

summary:
runs-on: ubuntu-latest
needs:
- build

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build-artifacts

- name: Make build summary
run: |
pip install jproperties
python .github/workflows/scripts/summary.py
env:
TARGET_SUBPROJECT: ${{ inputs.target_subproject }}
53 changes: 15 additions & 38 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
# build Java CI with Gradle
name: Dev Builds

on:
push:
# ignore *.md *.yml file changes
# run on 'multiversion' branch
branches: [ multiversion ]
paths-ignore:
- '**.md'
- '**.yml'
push:
paths:
- "*.gradle"
- "gradle.properties"
- "src/**"
- "versions/**"
- ".github/**"
pull_request:

# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Caches Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
./.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew buildAndGather --stacktrace --no-daemon
- name: Upload build artifact
uses: actions/upload-artifact@v3.1.0
with:
name: Artifacts from ${{ github.sha }}
path: build/libs/
build:
uses: ./.github/workflows/build.yml
secrets: inherit
# # [FEATURE] MIXIN_AUDITOR
# with:
# mixin_audit: true
32 changes: 32 additions & 0 deletions .github/workflows/matrix_prep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: _step.matrix_prepare

on:
workflow_call:
inputs:
target_subproject:
description: see release.yml, for generating matrix entries
type: string
required: false
default: ''
outputs:
matrix:
description: The generated run matrix
value: ${{ jobs.matrix_prep.outputs.matrix }}


jobs:
matrix_prep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12

- id: setmatrix
run: python .github/workflows/scripts/matrix.py
env:
TARGET_SUBPROJECT: ${{ inputs.target_subproject }}

outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
Loading