Flywheel/.github/workflows/build.yml
IThundxr 461578ec0e
Automated testing (#269)
* Automated testing

* Testing testing

- Use 2 spaces for indents yaml
- Move setupTestMod to PlatformExtension
- Allow specifying the sourceSet for the testMod artifact
- Rename things to camelCase
- Use rootCompile from transitiveSourceSets for the testMod source sets
- Use a blanket remapTestModJar task in the gh actions build

* Fail slowly

- We want to know the results of both tests regardless

* Add workflow dispatch

* Shoes should be steel toed, dangerous stuff

* Update build.yml

* fix modid

* Update FlywheelTestModClient.java

* add debug logging

* fix syntax issues

* fix issues

* Update build.yml

* Add debug logging

* more logging

* get testmod from correct dir

* switch to env var

* Why wait?

- Immediately audit on client tick

* DidObfuscate

- Fix RenderSystemMixin on fabric
- setShaderFogShape's arguments need to be remapped, but the name of the
  function should not be. Fortunately mixin allows matching by function
  name alone

* Clever commit title

- Change the Fabric mod ID to match Forge
- Move "Flywheel Test Mod" to static
- Cleanup start/stop messages
- Use the client start event on Fabric

---------

Co-authored-by: Jozufozu <jozsefaug@gmail.com>
2024-11-03 17:57:47 -08:00

85 lines
3 KiB
YAML

name: Build
on: [ workflow_dispatch, pull_request, push ]
env:
JAVA_VERSION: 17
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java
run: echo "JAVA_HOME=$JAVA_HOME_${{ env.JAVA_VERSION }}_X64" >> "$GITHUB_ENV"
- name: Loom Cache
uses: actions/cache@v4
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
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
- 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
- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
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' }}