-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
156 lines (156 loc) · 5.31 KB
/
action.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Dedicated Launch Test
description: Test if specified mods can launch on dedicated server environment
inputs:
extra:
description: Path to extra mods json
required: false
default: ""
extra1:
description: Another path to extra mods json, in case you need a new one
required: false
default: ""
mod:
description: Path to the mod file
required: true
runs:
using: composite
steps:
- name: Setup
shell: bash
run: |
git clone https://github.com/teaconmc/dedicated-launch-test.git
cd dedicated-launch-test
git checkout 1.21-neoforge
cd ..
mkdir -p dedicated-launch-test/extra
mkdir -p dedicated-launch-test/extra1
mkdir -p dedicated-launch-test/server
- name: Apply extra mods cache
uses: actions/cache@v4
with:
path: dedicated-launch-test/extra
key: ${{ runner.os }}-extra-${{ hashFiles(inputs.extra) }}
#restore-keys: ${{ runner.os }}-extra-
- name: Apply extra-1 mods cache
uses: actions/cache@v4
with:
path: dedicated-launch-test/extra1
key: ${{ runner.os }}-extra1-${{ hashFiles(inputs.extra1) }}
- name: Apply server cache
uses: actions/cache@v4
with:
path: dedicated-launch-test/server
key: ${{ runner.os }}-server1-${{ hashFiles('dedicated-launch-test/server/libraries/**') }}
restore-keys: ${{ runner.os }}-server1-
- name: Download extra mods
shell: bash
env:
EXTRA_MODS: ${{ inputs.extra }}
run: |
cd dedicated-launch-test/extra
EXTRA_MODS="../../$EXTRA_MODS"
if [ -f "$EXTRA_MODS" ]; then
for e in `jq -c '.[]' $EXTRA_MODS`; do
echo "$e" > tmp.json
name=`jq -r '.name' tmp.json`
url=`jq -r '.file' tmp.json`
if [ ! -f "$name" ]; then
echo "Downloading $name from $url"
wget -q -O "$name" "$url"
else
echo "Skipping $name, already downloaded"
fi
rm tmp.json
done
fi
- name: Download extra1 mods
shell: bash
env:
EXTRA1_MODS: ${{ inputs.extra1 }}
run: |
cd dedicated-launch-test/extra1
EXTRA1_MODS="../../$EXTRA1_MODS"
if [ -f "$EXTRA1_MODS" ]; then
cat $EXTRA1_MODS
for e in `jq -c '.[]' $EXTRA1_MODS`; do
echo "$e" > tmp.json
name=`jq -r '.name' tmp.json`
url=`jq -r '.file' tmp.json`
if [ ! -f "$name" ]; then
echo "Downloading $name from $url"
wget -q -O "$name" "$url"
else
echo "Skipping $name, already downloaded"
fi
rm tmp.json
done
fi
- name: Setup Server
shell: bash
run: |
cd dedicated-launch-test/server
mkdir -p config
echo 'disableConfigWatcher = true' > config/fml.toml
echo "Getting latest NeoForge version..."
#NF_VER=$(curl -s https://maven.neoforged.net/releases/net/neoforged/neoforge/maven-metadata.xml | yq -p xml '.metadata.versioning.latest')
NF_VER=21.1.62
echo "Checking if NeoForge $NF_VER is installed..."
if ! ls libraries/net/neoforged/neoforge/$NF_VER; then
echo "Cannot find NeoForge $NF_VER, installing..."
rm -f nf-install.jar
curl -s -o nf-install.jar https://maven.neoforged.net/releases/net/neoforged/neoforge/$NF_VER/neoforge-$NF_VER-installer.jar
java -jar nf-install.jar --installServer > /dev/null 2>&1
else
echo "Found NeoForge $NF_VER"
fi
echo Using NeoForge $NF_VER
mkdir mods || true
echo By using this workflow, you agree with the terms set in Minecraft EULA.
echo Get the full EULA text here: https://www.minecraft.net/en-us/eula
echo -n "eula=true" > eula.txt
- name: Copy mods
shell: bash
env:
MOD: ${{ inputs.mod }}
run: |
cp -v dedicated-launch-test/extra/* dedicated-launch-test/server/mods/ || true
cp -v dedicated-launch-test/extra1/* dedicated-launch-test/server/mods/ || true
cp -v $MOD dedicated-launch-test/server/mods/
- name: Launch
shell: bash
run: |
cd dedicated-launch-test/server
./run.sh nogui <<< "stop" &
for i in $(seq 60); do
sleep 5
jobs > running.txt
if [ ! -s running.txt ]; then
exit 0
fi
done
# Get current running jobs
jobs > running.txt
# If still have running jobs, we know we are in trouble.
# Call jps to get pid, and use jstack to have a trace dump.
# Then, kill server and force exit.
if [ -s running.txt ]; then
jps | grep BootstrapLauncher | sed -e 's/ BootstrapLauncher//g' > dslt.pid
jstack $(cat dslt.pid)
jmap -dump:live,format=b,file=heap.bin $(cat dslt.pid)
kill -9 $(cat dslt.pid)
exit -1
fi
- name: Check
shell: bash
run: |
cd dedicated-launch-test/server
cat crash-reports/* || true
grep 'For help, type "help"' logs/*
- name: Cleanup
shell: bash
run: |
cd dedicated-launch-test/server
rm -vf mods/*
rm -rf crash-reports
rm -rf logs
rm -rf world