Skip to content

Revert "Updated compiler target version" #186

Revert "Updated compiler target version"

Revert "Updated compiler target version" #186

Workflow file for this run

name: Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 8
continue-on-error: ${{ matrix.version == '1.20.4' }}
strategy:
fail-fast: false
matrix:
flavor: ['bukkit', 'spigot', 'paper', 'purpur']
version: ['1.20.4', '1.19.4', '1.18.2', '1.17.1', '1.16.5']
steps:
# Download code from repository
- name: Checkout code
uses: actions/checkout@v4
# Setup Java (for building)
- name: Setup JDK (for building)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
# Build plugin
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
# Setup Java (for testing)
- name: Setup JDK (for testing)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ startsWith(matrix.version, '1.16') && '11' || (startsWith(matrix.version, '1.17') && '16' || '17') }}
# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# Setup automata
- name: Setup automata
working-directory: ./automata
run: npm install
# Setup server
- name: Setup server
env:
FLAVOR: ${{ matrix.flavor }}
VERSION: ${{ matrix.version }}
GETBUKKIT_SUBDOMAIN: ${{ startsWith(matrix.version, '1.16') && 'cdn' || 'download' }}
run: |
if [ $FLAVOR == "bukkit" ]; then
url="https://$GETBUKKIT_SUBDOMAIN.getbukkit.org/craftbukkit/craftbukkit-$VERSION.jar"
elif [ $FLAVOR == "spigot" ]; then
url="https://$GETBUKKIT_SUBDOMAIN.getbukkit.org/spigot/spigot-$VERSION.jar"
elif [ $FLAVOR == "paper" ]; then
build=$(curl "https://papermc.io/api/v2/projects/paper/versions/$VERSION" | jq '.builds[-1]')
url="https://papermc.io/api/v2/projects/paper/versions/$VERSION/builds/$build/downloads/paper-$VERSION-$build.jar"
elif [ $FLAVOR == "purpur" ]; then
url="https://api.purpurmc.org/v2/purpur/$VERSION/latest/download"
fi
mkdir ./server && cd ./server
wget -nv "$url" -O server.jar
java -jar server.jar || true
sed -i 's/eula=false/eula=true/g' eula.txt
echo 'online-mode=false' >> server.properties
echo 'enable-rcon=true' >> server.properties
echo 'rcon.password=rcon' >> server.properties
echo 'allow-nether=false' >> server.properties
echo 'allow-end=false' >> server.properties
echo 'generate-structures=false' >> server.properties
echo 'level-type=flat' >> server.properties
# Install dependencies
- name: Install plugin dependencies
run: |
url="https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/artifact/build/libs/ProtocolLib.jar"
mkdir -p ./server/plugins/ProtocolLib
wget -q "$url" -O ./server/plugins/ProtocolLib.jar
echo -e "global:\n auto updater:\n notify: false\n download: false" > ./server/plugins/ProtocolLib/config.yml
# Install plugin
- name: Install plugin
run: |
mkdir -p ./server/plugins/YamipaPlugin/images
cp ./target/YamipaPlugin-*.jar ./server/plugins/
echo "verbose: true" > ./server/plugins/YamipaPlugin/config.yml
for i in {1..5}; do
wget -q "https://picsum.photos/400" -O "./server/plugins/YamipaPlugin/images/pic-$i.jpg"
done
# Test plugin
- name: Run plugin in server
working-directory: ./server
env:
FLAVOR: ${{ matrix.flavor }}
run: |
(cd ../automata && npm run start) &
timeout -s SIGINT -k 110s 90s java -DIReallyKnowWhatIAmDoingISwear -jar server.jar nogui | tee server.log || true
if ! grep -Fq '[YamipaPlugin] ' server.log; then
echo "Plugin did not load"
exit 1
fi
if ! grep -Fq '[YamipaPlugin] Running on VERBOSE mode' server.log; then
echo "Plugin did not enabled verbose mode"
exit 1
fi
if ! grep -Fq '[YamipaPlugin] [ImageStorage] Found 5 file(s) in images directory' server.log; then
echo "Plugin did not read image directory"
exit 1
fi
if ! grep -Fq '[YamipaPlugin] [ImageCommandBridge] Fixed command permissions' server.log; then
echo "Plugin did not fixed command permissions"
exit 1
fi
if ! grep -Fq '[YamipaPlugin] [FakeImage] Created FakeImage' server.log; then
echo "Plugin did not place the fake image"
exit 1
fi
if ! grep -Fq '[YamipaPlugin] [FakeImage] Invalidated FakeImage' server.log; then
echo "Plugin did not remove the fake image"
exit 1
fi
if [ "$FLAVOR" != "bukkit" ] && grep -iFq 'exception' server.log; then
echo "Server threw an exception"
exit 1
fi