build(plugin): establish build and release pipeline
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package games.dmg.spigotstealth;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/** Bukkit entry point for Spigot Stealth. */
|
||||
public final class SpigotStealthPlugin extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getLogger().info("Spigot Stealth enabled");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
name: SpigotStealth
|
||||
version: ${version}
|
||||
main: games.dmg.spigotstealth.SpigotStealthPlugin
|
||||
api-version: "1.20"
|
||||
description: Rewards invisibility potion use with identity-concealed sessions.
|
||||
author: dmg.games
|
||||
commands:
|
||||
stealth:
|
||||
description: View and use Spigot Stealth features.
|
||||
usage: /stealth progress
|
||||
permission: spigotstealth.use
|
||||
stealthadmin:
|
||||
description: Inspect and administer Spigot Stealth.
|
||||
usage: /stealthadmin <status|grant|reset|list>
|
||||
permission: spigotstealth.admin
|
||||
permissions:
|
||||
spigotstealth.use:
|
||||
description: Allows use of player-facing Spigot Stealth commands.
|
||||
default: true
|
||||
spigotstealth.admin:
|
||||
description: Allows administration of Spigot Stealth.
|
||||
default: op
|
||||
@@ -0,0 +1,27 @@
|
||||
package games.dmg.spigotstealth;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class DeliveryConfigurationTest {
|
||||
@Test
|
||||
void ciBuildsChecksAndUploadsDevelopmentJar() throws IOException {
|
||||
String workflow = Files.readString(Path.of(".gitea/workflows/ci.yml"));
|
||||
assertTrue(workflow.contains("./gradlew clean check jar"));
|
||||
assertTrue(workflow.contains("commitlint"));
|
||||
assertTrue(workflow.contains("spigot-stealth-${{ github.sha }}"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void mainBranchReleaseBuildsAndUploadsVersionedJar() throws IOException {
|
||||
String workflow = Files.readString(Path.of(".gitea/workflows/release.yml"));
|
||||
assertTrue(workflow.contains("semantic-release"));
|
||||
assertTrue(workflow.contains("-PreleaseVersion=\"$VERSION\""));
|
||||
assertTrue(workflow.contains("spigot-stealth-${VERSION}.jar"));
|
||||
assertTrue(workflow.contains("/releases/${release_id}/assets"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package games.dmg.spigotstealth;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
class PluginMetadataTest {
|
||||
@Test
|
||||
void pluginEntrypointExtendsJavaPlugin() throws ClassNotFoundException {
|
||||
Class<?> pluginClass = Class.forName("games.dmg.spigotstealth.SpigotStealthPlugin");
|
||||
assertTrue(JavaPlugin.class.isAssignableFrom(pluginClass));
|
||||
}
|
||||
|
||||
@Test
|
||||
void exposesSpigotStealthPluginAndCommands() {
|
||||
try (InputStream input = getClass().getClassLoader().getResourceAsStream("plugin.yml")) {
|
||||
assertNotNull(input, "plugin.yml must be packaged");
|
||||
Map<String, Object> metadata = new Yaml().load(input);
|
||||
assertEquals("SpigotStealth", metadata.get("name"));
|
||||
assertEquals("games.dmg.spigotstealth.SpigotStealthPlugin", metadata.get("main"));
|
||||
assertNotNull(metadata.get("commands"));
|
||||
assertNotNull(metadata.get("permissions"));
|
||||
} catch (java.io.IOException exception) {
|
||||
throw new AssertionError(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user