Flywheel/.github/workflows/build.yml

86 lines
3 KiB
YAML
Raw Normal View History

name: Build
2024-04-27 07:29:49 +02:00
on: [ workflow_dispatch, pull_request, push ]
env:
JAVA_VERSION: 17
2024-04-27 07:29:49 +02:00
jobs:
build:
runs-on: ubuntu-latest
2024-04-27 07:29:49 +02:00
steps:
- name: Checkout Repository
2024-05-12 07:17:52 +02:00
uses: actions/checkout@v4
- name: Setup Java
run: echo "JAVA_HOME=$JAVA_HOME_${{ env.JAVA_VERSION }}_X64" >> "$GITHUB_ENV"
- name: Loom Cache
2024-05-12 07:17:52 +02:00
uses: actions/cache@v4
2024-04-27 07:29:49 +02:00
with:
path: "**/.gradle/loom-cache"
key: "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}"
restore-keys: "${{ runner.os }}-gradle-"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
2024-04-27 07:29:49 +02:00
with:
gradle-home-cache-cleanup: true
cache-read-only: ${{ !endsWith(github.ref_name, '/dev') }}
- name: Validate Gradle Wrapper Integrity
uses: gradle/wrapper-validation-action@v2
2024-04-27 07:29:49 +02:00
- name: Build
# Doesn't actually publish, as no secrets are passed in, just makes sure that publishing works
# Also generate the mod jars for the test job
run: ./gradlew remapTestModJar publish --no-daemon
2024-04-27 07:29:49 +02:00
- name: Capture Build Artifacts
2024-05-12 07:17:52 +02:00
uses: actions/upload-artifact@v4
2024-04-27 07:29:49 +02:00
with:
name: Artifacts
2024-05-12 07:35:38 +02:00
path: |
common/build/libs/
fabric/build/libs/
forge/build/libs/
test:
strategy:
fail-fast: false
matrix:
loader: [ forge, fabric ]
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: Artifacts
- name: Setup Environment Variables
run: |
echo "MOD_VERSION=$(grep '^mod_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ')" >> "$GITHUB_ENV"
echo "MINECRAFT_VERSION=$(grep '^minecraft_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ')" >> "$GITHUB_ENV"
echo "FABRIC_API_VERSION=$(grep '^fabric_api_version =' gradle.properties | cut -d'=' -f2 | tr -d ' ' | sed 's/+.*//')" >> "$GITHUB_ENV"
- name: Move Test Mod and Flywheel into run/mods
run: |
mkdir -p run/mods
cp ${{ matrix.loader }}/build/libs/flywheel-${{ matrix.loader }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar run/mods
cp ${{ matrix.loader }}/build/libs/flywheel-${{ matrix.loader }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}-testmod.jar run/mods
# Lock to a specific commit, it would be bad if the tag is re-pushed with unwanted changes
- name: Run the MC client
uses: 3arthqu4ke/mc-runtime-test@e72f8fe1134aabf6fc749a2a8c09bb56dd7d283e
with:
mc: ${{ env.MINECRAFT_VERSION }}
modloader: ${{ matrix.loader }}
regex: .*${{ matrix.loader }}.*
mc-runtime-test: none
java: ${{ env.JAVA_VERSION }}
fabric-api: ${{ matrix.loader == 'fabric' && env.FABRIC_API_VERSION || 'none' }}