-
-
Notifications
You must be signed in to change notification settings - Fork 52
86 lines (73 loc) · 3.04 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build
on: [ workflow_dispatch, pull_request, push ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Java
run: echo "JAVA_HOME=$JAVA_HOME_17_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/
fabric/build/devlibs/
forge/build/libs/
forge/build/devlibs/
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/devlibs/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
env:
FLYWHEEL_AUTO_TEST: true
with:
mc: ${{ env.MINECRAFT_VERSION }}
modloader: ${{ matrix.loader }}
regex: .*${{ matrix.loader }}.*
mc-runtime-test: none
java: 17
fabric-api: ${{ matrix.loader == 'fabric' && env.FABRIC_API_VERSION || 'none' }}