Repository navigation
Fix CI: update actions to Node 24 versions, Paper build 69, Docker My… #561
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: ["Latest", main, "fix/mysql-compat-and-auction-displayname", "feature/custom-item-scanner"] | |
| pull_request: | |
| branches: ["Latest", main, "fix/mysql-compat-and-auction-displayname", "feature/custom-item-scanner"] | |
| permissions: | |
| contents: read | |
| env: | |
| PAPER_BUILD: "69" | |
| PAPER_JAR_SHA: "d30fae0c74092b10855f0412ca6b265c60301a013d34bc28a2a41bf5682dd80b" | |
| VAULT_URL: "https://github.com/MilkBowl/Vault/releases/download/1.7.3/Vault.jar" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Upload JAR | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Aurelium | |
| path: build/libs/*.jar | |
| smoke-test: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Download Aurelium | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: Aurelium | |
| path: artifact-tmp | |
| - name: Move JAR to plugins folder | |
| run: | | |
| mkdir -p plugins | |
| find artifact-tmp -name "*.jar" -type f -exec mv {} plugins/ \; | |
| echo "Contents of plugins/:" | |
| ls -la plugins/ | |
| - name: Download Vault | |
| run: curl -sL "${{ env.VAULT_URL }}" -o plugins/Vault.jar | |
| - name: Download Paper | |
| run: | | |
| PAPER_URL="https://fill-data.papermc.io/v1/objects/${{ env.PAPER_JAR_SHA }}/paper-26.1.2-${{ env.PAPER_BUILD }}.jar" | |
| curl -sL "$PAPER_URL" -o paper.jar | |
| ls -lh paper.jar | |
| if [ ! -s paper.jar ]; then | |
| echo "FAIL: paper.jar is empty or missing" | |
| exit 1 | |
| fi | |
| - name: Start server and run smoke test | |
| run: | | |
| echo "eula=true" > eula.txt | |
| cat > server.properties << 'PROPS' | |
| online-mode=false | |
| server-port=25565 | |
| enable-rcon=true | |
| rcon.port=25575 | |
| rcon.password=test | |
| PROPS | |
| java -Xmx2G -jar paper.jar --nogui & | |
| SERVER_PID=$! | |
| for i in $(seq 1 60); do | |
| if grep -q "Done (" logs/latest.log 2>/dev/null; then | |
| echo "Server started successfully!" | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| if ! grep -q "Done (" logs/latest.log 2>/dev/null; then | |
| echo "Server failed to start" | |
| kill $SERVER_PID 2>/dev/null || true | |
| exit 1 | |
| fi | |
| SMOKE_FAIL=0 | |
| if grep -q "AurelEconomy has been enabled" logs/latest.log 2>/dev/null; then | |
| echo "PASS: Aurelium plugin loaded successfully!" | |
| elif grep -q "Aurelium" logs/latest.log 2>/dev/null; then | |
| echo "FAIL: Aurelium mentioned in log but may have errors" | |
| SMOKE_FAIL=1 | |
| else | |
| echo "FAIL: Aurelium not found in log" | |
| SMOKE_FAIL=1 | |
| fi | |
| if [ -f "plugins/Aurelium/database.db" ]; then | |
| echo "PASS: SQLite database file exists" | |
| else | |
| echo "FAIL: No .db file found" | |
| SMOKE_FAIL=1 | |
| fi | |
| SCHEMA_VER=$(sqlite3 plugins/Aurelium/database.db "SELECT version FROM database_info LIMIT 1;" 2>/dev/null || echo "0") | |
| if [ "$SCHEMA_VER" = "2" ] || [ "$SCHEMA_VER" = "v2" ] || [ "$SCHEMA_VER" = "2 " ]; then | |
| echo "PASS: Database migration ran" | |
| else | |
| echo "FAIL: Database schema version is '$SCHEMA_VER' (expected 2)" | |
| SMOKE_FAIL=1 | |
| fi | |
| for table in players player_balances auctions offline_earnings buy_orders price_history auction_offers custom_items database_info; do | |
| if sqlite3 plugins/Aurelium/database.db ".tables" 2>/dev/null | grep -qw "$table"; then | |
| echo "PASS: Table '$table' exists" | |
| else | |
| echo "FAIL: Table '$table' missing from database" | |
| SMOKE_FAIL=1 | |
| fi | |
| done | |
| if sqlite3 plugins/Aurelium/database.db "PRAGMA table_info(custom_items);" 2>/dev/null | grep -q .; then | |
| echo "PASS: custom_items table has columns" | |
| for col in canonical_id source_plugin display_name enabled buy_price sell_price item_data; do | |
| if sqlite3 plugins/Aurelium/database.db "PRAGMA table_info(custom_items);" 2>/dev/null | grep -q "$col"; then | |
| echo "PASS: Column '$col' exists in custom_items" | |
| else | |
| echo "FAIL: Column '$col' missing from custom_items" | |
| SMOKE_FAIL=1 | |
| fi | |
| done | |
| else | |
| echo "FAIL: Could not read custom_items table info" | |
| SMOKE_FAIL=1 | |
| fi | |
| if [ -f "plugins/Aurelium/config.yml" ]; then | |
| echo "PASS: config.yml generated" | |
| else | |
| echo "FAIL: config.yml not found" | |
| SMOKE_FAIL=1 | |
| fi | |
| if grep -qi "exception.*aurelium\|error.*aurelium" logs/latest.log 2>/dev/null; then | |
| REAL_ERR=$(grep -i "exception.*aurelium\|error.*aurelium" logs/latest.log | grep -vi "vault\|registration attempt\|PLEASE RESTART" || true) | |
| if [ -n "$REAL_ERR" ]; then | |
| echo "FAIL: Aurelium exceptions during runtime" | |
| echo "$REAL_ERR" | |
| SMOKE_FAIL=1 | |
| else | |
| echo "PASS: No Aurelium exceptions during runtime" | |
| fi | |
| else | |
| echo "PASS: No Aurelium exceptions during runtime" | |
| fi | |
| kill $SERVER_PID 2>/dev/null || true | |
| wait $SERVER_PID 2>/dev/null || true | |
| if [ "$SMOKE_FAIL" -ne 0 ]; then | |
| echo "SMOKE TEST FAILED ($SMOKE_FAIL check(s) failed)" | |
| exit 1 | |
| else | |
| echo "ALL SMOKE CHECKS PASSED" | |
| fi | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: smoke-test-log | |
| path: logs/latest.log | |
| retention-days: 7 | |
| ingame-test: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Download Aurelium | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: Aurelium | |
| path: artifact-tmp | |
| - name: Move JAR to plugins folder | |
| run: | | |
| mkdir -p plugins | |
| find artifact-tmp -name "*.jar" -type f -exec mv {} plugins/ \; | |
| - name: Download Vault | |
| run: curl -sL "${{ env.VAULT_URL }}" -o plugins/Vault.jar | |
| - name: Download Paper | |
| run: | | |
| PAPER_URL="https://fill-data.papermc.io/v1/objects/${{ env.PAPER_JAR_SHA }}/paper-26.1.2-${{ env.PAPER_BUILD }}.jar" | |
| curl -sL "$PAPER_URL" -o paper.jar | |
| if [ ! -s paper.jar ]; then | |
| echo "FAIL: paper.jar is empty or missing" | |
| exit 1 | |
| fi | |
| - name: Start server and run in-game tests | |
| run: | | |
| echo "eula=true" > eula.txt | |
| cat > server.properties << 'PROPS' | |
| online-mode=false | |
| server-port=25565 | |
| enable-rcon=true | |
| rcon.port=25575 | |
| rcon.password=test | |
| PROPS | |
| java -Xmx2G -jar paper.jar --nogui & | |
| SERVER_PID=$! | |
| for i in $(seq 1 60); do | |
| if grep -q "Done (" logs/latest.log 2>/dev/null; then | |
| echo "Server started successfully!" | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| if ! grep -q "Done (" logs/latest.log 2>/dev/null; then | |
| echo "Server failed to start" | |
| kill $SERVER_PID 2>/dev/null || true | |
| exit 1 | |
| fi | |
| sleep 5 | |
| python3 .github/scripts/test_ingame_rcon.py | tee rcon_test.log | |
| RCON_EXIT=${PIPESTATUS[0]} | |
| kill $SERVER_PID 2>/dev/null || true | |
| wait $SERVER_PID 2>/dev/null || true | |
| if [ "$RCON_EXIT" -ne 0 ]; then | |
| echo "RCON in-game test failed" | |
| exit 1 | |
| fi | |
| echo "RCON in-game test passed" | |
| - name: Print RCON test log | |
| if: failure() | |
| run: cat rcon_test.log || true | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ingame-test-log | |
| path: logs/latest.log | |
| retention-days: 7 | |
| - name: Upload RCON test log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ingame-test-rcon-log | |
| path: rcon_test.log | |
| retention-days: 7 | |
| mysql-test: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Start MySQL container | |
| run: | | |
| docker run -d --name mysql-test \ | |
| -e MYSQL_ROOT_PASSWORD=test \ | |
| -e MYSQL_DATABASE=aurelium_test \ | |
| -p 3306:3306 \ | |
| mysql:8.0 \ | |
| --default-authentication-plugin=mysql_native_password | |
| for i in $(seq 1 30); do | |
| if docker exec mysql-test mysqladmin ping -h localhost -ptest 2>/dev/null; then | |
| echo "MySQL ready!" | |
| docker exec mysql-test mysql -h localhost -ptest -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'test'; FLUSH PRIVILEGES;" 2>/dev/null || true | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Download Aurelium | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: Aurelium | |
| path: artifact-tmp | |
| - name: Move JAR to plugins folder | |
| run: | | |
| mkdir -p plugins | |
| find artifact-tmp -name "*.jar" -type f -exec mv {} plugins/ \; | |
| - name: Download Vault | |
| run: curl -sL "${{ env.VAULT_URL }}" -o plugins/Vault.jar | |
| - name: Download Paper | |
| run: | | |
| PAPER_URL="https://fill-data.papermc.io/v1/objects/${{ env.PAPER_JAR_SHA }}/paper-26.1.2-${{ env.PAPER_BUILD }}.jar" | |
| curl -sL "$PAPER_URL" -o paper.jar | |
| if [ ! -s paper.jar ]; then | |
| echo "FAIL: paper.jar is empty or missing" | |
| exit 1 | |
| fi | |
| - name: Create MySQL config | |
| run: | | |
| mkdir -p plugins/Aurelium | |
| cat > plugins/Aurelium/config.yml << 'CFG' | |
| database: | |
| type: mysql | |
| mysql: | |
| host: 127.0.0.1 | |
| port: 3306 | |
| database: aurelium_test | |
| username: root | |
| password: test | |
| CFG | |
| - name: Start server with MySQL and test | |
| run: | | |
| echo "eula=true" > eula.txt | |
| cat > server.properties << 'PROPS' | |
| online-mode=false | |
| server-port=25565 | |
| enable-rcon=true | |
| rcon.port=25576 | |
| rcon.password=test | |
| PROPS | |
| java -Xmx2G -jar paper.jar --nogui & | |
| SERVER_PID=$! | |
| for i in $(seq 1 60); do | |
| if grep -q "Done (" logs/latest.log 2>/dev/null; then | |
| echo "Server started with MySQL!" | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| if ! grep -q "Done (" logs/latest.log 2>/dev/null; then | |
| echo "Server failed to start with MySQL" | |
| kill $SERVER_PID 2>/dev/null || true | |
| exit 1 | |
| fi | |
| MYSQL_FAIL=0 | |
| if grep -q "AurelEconomy has been enabled" logs/latest.log 2>/dev/null; then | |
| echo "PASS: Plugin loaded with MySQL" | |
| else | |
| echo "FAIL: Plugin did not load with MySQL" | |
| MYSQL_FAIL=1 | |
| fi | |
| if grep -qi "sql syntax error\|sqlexception" logs/latest.log 2>/dev/null; then | |
| echo "FAIL: SQL syntax errors detected with MySQL" | |
| MYSQL_FAIL=1 | |
| else | |
| echo "PASS: No SQL syntax errors with MySQL" | |
| fi | |
| mysql -h 127.0.0.1 -u root -ptest aurelium_test -e "SHOW TABLES;" 2>/dev/null | |
| if mysql -h 127.0.0.1 -u root -ptest aurelium_test -e "SELECT COUNT(*) FROM custom_items;" 2>/dev/null; then | |
| echo "PASS: custom_items table exists in MySQL" | |
| else | |
| echo "FAIL: custom_items table missing from MySQL database" | |
| MYSQL_FAIL=1 | |
| fi | |
| SCHEMA_VER=$(mysql -h 127.0.0.1 -u root -ptest aurelium_test -N -e "SELECT version FROM database_info LIMIT 1;" 2>/dev/null || echo "0") | |
| if [ "$SCHEMA_VER" = "2" ] || [ "$SCHEMA_VER" = "v2" ] || [ "$SCHEMA_VER" = "2 " ]; then | |
| echo "PASS: MySQL schema version is correct" | |
| else | |
| echo "FAIL: MySQL schema version is '$SCHEMA_VER' (expected 2)" | |
| MYSQL_FAIL=1 | |
| fi | |
| kill $SERVER_PID 2>/dev/null || true | |
| wait $SERVER_PID 2>/dev/null || true | |
| if [ "$MYSQL_FAIL" -ne 0 ]; then | |
| exit 1 | |
| fi | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: mysql-test-log | |
| path: logs/latest.log | |
| retention-days: 7 | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Run unit tests | |
| run: ./gradlew test | |
| - name: Check code style | |
| run: ./gradlew checkstyleMain 2>/dev/null || echo "No checkstyle task configured" |