-
-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (93 loc) · 3.9 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: "Build"
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
- "!master"
jobs:
build:
name: "Build project"
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Parse gradle properties"
id: gradle-properties
run: |
while IFS='=' read -r key value; do
key=$(echo $key | awk '{$1=$1;print}')
value=$(echo $value | awk '{$1=$1;print}')
case "$key" in
minecraft_version) echo "MINECRAFT_VERSION=$value" >> $GITHUB_OUTPUT ;;
mod_name) echo "MOD_NAME=$value" >> $GITHUB_OUTPUT ;;
mod_version) echo "MOD_VERSION=$value" >> $GITHUB_OUTPUT ;;
enabled_platforms) echo "ENABLED_PLATFORMS=$value" >> $GITHUB_OUTPUT ;;
esac
done < gradle.properties
- name: "Set up JDK 17"
if: steps.gradle-properties.outputs.MINECRAFT_VERSION != '1.20.6' && steps.gradle-properties.outputs.MINECRAFT_VERSION != '1.21'
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: "Set up JDK 21"
if: steps.gradle-properties.outputs.MINECRAFT_VERSION == '1.20.6' || steps.gradle-properties.outputs.MINECRAFT_VERSION == '1.21'
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: "Run gradle build"
uses: gradle/gradle-build-action@v3
with:
generate-job-summary: false
gradle-version: wrapper
arguments: build
- name: "Generate matrix for the run job"
id: set-matrix
run: ./.github/scripts/generate-run-matrix.sh
run:
name: Run ${{ matrix.mod_loader }} ${{ matrix.script }}
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.matrix)}}
timeout-minutes: 15
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up JDK 17"
if: matrix.mod_loader.version != '1.20.6' && matrix.mod_loader.version != '1.21'
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: "Set up JDK 21"
if: matrix.version == '1.20.6' || matrix.version == '1.21'
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: "Setup Gradle and run build"
uses: gradle/gradle-build-action@v3
with:
cache-read-only: true
gradle-version: wrapper
arguments: ${{ matrix.mod_loader }}:build
- name: "Accept eula"
run: mkdir -p ${{ matrix.mod_loader }}/run && echo "eula=true" > ${{ matrix.mod_loader }}/run/eula.txt
- name: Run ${{ matrix.mod_loader }} ${{ matrix.script }}
uses: modmuss50/xvfb-action@v1
with:
run: ./.github/scripts/run-${{ matrix.script }}.sh ${{ matrix.mod_loader }}
shell: bash