Skip to content

GH-1051 Add integrational tests #3

GH-1051 Add integrational tests

GH-1051 Add integrational tests #3

name: MC Plugin Compatibility Test
on:
workflow_run:
workflows: ["Java CI with Gradle"]
types:
- completed
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
test-minecraft-versions:
runs-on: self-hosted
strategy:
matrix:
mc_version: [1.18.2, 1.19.4, 1.20.6, 1.21.7]
env:
ARTIFACT_NAME: "EternalCore Dev Build"
PLUGIN_GLOB: "eternalcore-plugin/build/libs/EternalCore*.jar"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download plugin artifact from previous workflow
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./artifact
- name: Find plugin JAR file
id: find-jar
run: |
PLUGIN_JAR=$(find ./artifact -name 'EternalCore*.jar' | head -n 1)
echo "PLUGIN_JAR=$PLUGIN_JAR" >> $GITHUB_ENV
echo "Found plugin jar: $PLUGIN_JAR"
if [ -z "$PLUGIN_JAR" ]; then
echo "Plugin JAR not found!"
exit 1
fi
- name: Setup PaperMC server for version ${{ matrix.mc_version }}
run: |
mkdir mc-server
cd mc-server
BUILD_NUMBER=$(curl -s "https://api.papermc.io/v2/projects/paper/versions/${{ matrix.mc_version }}/builds" | jq '.builds | max')
echo "Downloading Paper ${{ matrix.mc_version }} build $BUILD_NUMBER"
wget https://api.papermc.io/v2/projects/paper/versions/${{ matrix.mc_version }}/builds/${BUILD_NUMBER}/downloads/paper-${{ matrix.mc_version }}-${BUILD_NUMBER}.jar -O paper.jar
mkdir plugins
cp ../${{ env.PLUGIN_JAR }} plugins/
- name: Agree to EULA
run: echo "eula=true" > mc-server/eula.txt
- name: Configure server.properties to speed up startup
run: |
cat > mc-server/server.properties <<EOF
# Minecraft server properties
# Generated by GitHub Actions workflow
allow-nether=false
level-type=FLAT
max-world-size=16
EOF
- name: Configure bukkit.yml to disable End
run: |
cat > mc-server/bukkit.yml <<EOF
settings:
allow-end: false
EOF
- name: Run Minecraft server ${{ matrix.mc_version }} and check logs
working-directory: mc-server
run: |
java -Xmx1G -jar paper.jar nogui > server.log 2>&1 &
SERVER_PID=$!
echo "Server started with PID $SERVER_PID"
sleep 60
kill $SERVER_PID
wait $SERVER_PID || true
echo "Checking logs for errors..."
if grep -i -E 'error|exception|failed' server.log; then
echo "❌ Errors found in server logs for version ${{ matrix.mc_version }}"
cat server.log
exit 1
else
echo "✅ No errors found in server logs for version ${{ matrix.mc_version }}"
fi