Compare commits

...

6 commits

Author SHA1 Message Date
35cfc75a04
Separate build-and-test into PR & commit workflow
Some checks failed
build-and-test / build (push) Has been cancelled
build-and-test / test (push) Has been cancelled
build-and-test / generate-javadoc (push) Has been cancelled
2024-08-18 19:54:15 +02:00
03d53fc997
Fix Javadoc issues 2024-08-18 19:47:41 +02:00
eb108495ea
Add option to fail doc when Javadoc throws a warning 2024-08-18 19:34:15 +02:00
736dbed1f3
Remove weird @author and @since tags from base package-info.java 2024-08-18 18:29:22 +02:00
b993124f41
[no ci] Move PR and issue templates to .forgejo 2024-08-18 18:27:48 +02:00
db56c0538a misc: add CI workflows for PRs and commits (#1)
Reviewed-on: StarOpenSource/Engine#1
Co-authored-by: JeremyStarTM <jeremystartm@staropensource.de>
Co-committed-by: JeremyStarTM <jeremystartm@staropensource.de>
2024-08-18 18:25:22 +02:00
22 changed files with 209 additions and 6 deletions

View file

@ -0,0 +1,71 @@
name: build-and-test
on:
- pull_request
- push
jobs:
build:
runs-on: docker
container:
image: git.staropensource.de/staropensource/actions-docker:java
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: Compile
run: ./gradlew --no-daemon jar javadocJar sourceJar
- name: Upload library JARs
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: jars-libraries
path: |
**/build/libs/*.jar
!**/build/libs/*-javadoc.jar
!**/build/libs/*-sources.jar
if-no-files-found: error
- name: Upload API documentation JARs
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: jars-apidocs
path: |
**/build/libs/*-javadoc.jar
if-no-files-found: error
- name: Upload source JARs
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: jars-sources
path: |
**/build/libs/*-sources.jar
if-no-files-found: error
generate-javadoc:
runs-on: docker
container:
image: git.staropensource.de/staropensource/actions-docker:java
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: Generate javadoc
run: ./gradlew --no-daemon javadoc javadocAll
- name: Upload separate javadoc
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: javadoc-separate
path: |
**/build/docs/javadoc/*
if-no-files-found: error
- name: Upload combined javadoc
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: javadoc-combined
path: |
build/docs/javadoc/*
if-no-files-found: error
test:
runs-on: docker
container:
image: git.staropensource.de/staropensource/actions-docker:java
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: Run tests
run: ./gradlew --no-daemon test

View file

@ -0,0 +1,24 @@
name: build-and-test
on:
- pull_request
jobs:
generate-javadoc:
runs-on: docker
container:
image: git.staropensource.de/staropensource/actions-docker:java
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: Generate javadoc
run: ./gradlew --no-daemon javadoc
test:
runs-on: docker
container:
image: git.staropensource.de/staropensource/actions-docker:java
steps:
- name: Checkout
uses: https://code.forgejo.org/actions/checkout@v4
- name: Run tests
run: ./gradlew --no-daemon test

View file

@ -79,6 +79,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -118,6 +118,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -22,7 +22,6 @@ package de.staropensource.sosengine.base.classes;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.exceptions.versioning.InvalidVersionStringException;
import de.staropensource.sosengine.base.internal.events.InternalEngineShutdownEvent;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
@ -71,10 +70,11 @@ public abstract class SubsystemClass {
* Used for dependency resolution during startup.
*
* @return matching {@link DependencyVector} for the subsystem
* @throws IllegalStateException when building the DependencyVector fails, see {@link DependencyVector.Builder#build()}
* @see DependencyVector
* @since v1-alpha1
* @since v1-alpha4
*/
public abstract @NotNull DependencyVector getDependencyVector() throws InvalidVersionStringException;
public abstract @NotNull DependencyVector getDependencyVector() throws IllegalStateException;
/**
* Called on engine shutdown.

View file

@ -83,6 +83,13 @@ public final class DependencySubsystemVector extends DependencyVector {
* @since v1-alpha4
*/
public static final class Builder extends DependencyVector.Builder {
/**
* Constructs this class.
*
* @since v1-alpha4
*/
public Builder() {}
/**
* Contains the {@link SubsystemClass} to associate.
*
@ -129,5 +136,29 @@ public final class DependencySubsystemVector extends DependencyVector {
if (mainClass == null)
throw new IllegalStateException("The main class is unset");
}
/**
* Returns the {@link SubsystemClass} to associate.
*
* @return {@link SubsystemClass} to associcate
* @see DependencySubsystemVector#mainClass
* @since v1-alpha4
*/
public @Nullable SubsystemClass getMainClass() {
return mainClass;
}
/**
* Sets the {@link SubsystemClass} to associate.
*
* @param mainClass new {@link SubsystemClass} to associate
* @return builder instance
* @see DependencySubsystemVector#mainClass
* @since v1-alpha4
*/
public @NotNull DependencyVector.Builder setIdentifier(@Nullable SubsystemClass mainClass) {
this.mainClass = mainClass;
return this;
}
}
}

View file

@ -31,6 +31,13 @@ import org.jetbrains.annotations.Nullable;
* @since v1-alpha4
*/
public class QuietLoggerImplementation implements LoggerImplementation {
/**
* Constructs this class.
*
* @since v1-alpha4
*/
public QuietLoggerImplementation() {}
/** {@inheritDoc} */
@Override
public @Nullable String prePlaceholder(@NotNull LogLevel level, @NotNull Class<?> issuerClass, @NotNull String issuerOrigin, @Nullable String issuerMetadata, @NotNull String message, @NotNull String format) {

View file

@ -22,7 +22,5 @@
*
* @see de.staropensource.sosengine.base.Engine
* @since v1-alpha0
* @author jeremystartm &lt;jeremystartm@staropensource.de&gt;
* @since v1-alpha0
*/
package de.staropensource.sosengine.base;

View file

@ -174,7 +174,7 @@ public class DependencyVector {
* Builds a new {@link DependencyVector} instance.
*
* @return new {@link DependencyVector}
* @throws IllegalStateException if the identifier, versioning system or version is unset
* @throws IllegalStateException when the identifier, versioning system or version is unset or the version string is invalid
* @since v1-alpha4
*/
public @NotNull DependencyVector build() throws IllegalStateException {
@ -285,6 +285,7 @@ public class DependencyVector {
* Sets the identifier of the new vector.
*
* @param identifier new identifier
* @return builder instance
* @see DependencyVector#identifier
* @since v1-alpha4
*/
@ -297,6 +298,7 @@ public class DependencyVector {
* Sets the versioning system the new vector should use.
*
* @param versioningSystem versioning system to use
* @return builder instance
* @see DependencyVector#versioningSystem
* @since v1-alpha4
*/
@ -309,6 +311,7 @@ public class DependencyVector {
* Sets the version of the new vector.
*
* @param version vector version
* @return builder instance
* @see DependencyVector#version
* @since v1-alpha4
*/
@ -321,6 +324,7 @@ public class DependencyVector {
* Sets a set of all identifiers and their versions the new vector should depend on.
*
* @param dependencies dependencies
* @return builder instance
* @see DependencyVector#dependencies
* @since v1-alpha4
*/
@ -333,6 +337,7 @@ public class DependencyVector {
* Sets a set of all identifiers and their versions the new vector should provide.
*
* @param provides provided vectors
* @return builder instance
* @see DependencyVector#provides
* @since v1-alpha4
*/

View file

@ -56,6 +56,7 @@ tasks.register("javadocAll", Javadoc) {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -77,6 +77,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -112,6 +112,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -116,6 +116,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -113,6 +113,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -71,6 +71,7 @@ javadoc {
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above

View file

@ -21,9 +21,12 @@ package de.staropensource.sosengine.testapp;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.data.versioning.OneNumberVersioningSystem;
import de.staropensource.sosengine.base.events.ThrowableCatchEvent;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.base.utility.DependencyResolver;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.base.utility.parser.StackTraceParser;
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
@ -38,7 +41,9 @@ import lombok.SneakyThrows;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Set;
/**
* The main class of the sos!engine development application.
@ -124,6 +129,60 @@ public final class Main {
// Say hello to the world!
logger.info("Hello world!");
// DependencyResolver test
DependencyResolver resolver = new DependencyResolver();
Set<@NotNull String> depsT1 = new HashSet<>();
Set<@NotNull String> provT1 = new HashSet<>();
Set<@NotNull String> depsT2 = new HashSet<>();
Set<@NotNull String> provT2 = new HashSet<>();
Set<@NotNull String> depsT3 = new HashSet<>();
Set<@NotNull String> provT3 = new HashSet<>();
Set<@NotNull String> depsT4 = new HashSet<>();
Set<@NotNull String> provT4 = new HashSet<>();
depsT2.add("test1=5");
provT3.add("test5=11");
depsT4.add("test3>100<10");
resolver.addVectors(new DependencyVector[]{
new DependencyVector.Builder()
.setIdentifier("test1")
.setVersioningSystem(OneNumberVersioningSystem.class)
.setVersion("5")
.setDependencies(depsT1)
.setProvides(provT1)
.build(),
new DependencyVector.Builder()
.setIdentifier("test2")
.setVersioningSystem(OneNumberVersioningSystem.class)
.setVersion("1")
.setDependencies(depsT2)
.setProvides(provT2)
.build(),
new DependencyVector.Builder()
.setIdentifier("test3")
.setVersioningSystem(OneNumberVersioningSystem.class)
.setVersion("106")
.setDependencies(depsT3)
.setProvides(provT3)
.build(),
new DependencyVector.Builder()
.setIdentifier("test4")
.setVersioningSystem(OneNumberVersioningSystem.class)
.setVersion("69")
.setDependencies(depsT4)
.setProvides(provT4)
.build()
});
try {
resolver.resolve();
} catch (Exception exception) {
logger.crash("Test resolution failed", exception);
}
logger.warn("Test resolution succeeded");
// Choose Graphics API to use
if (!GraphicsSubsystem.getInstance().setGraphicsApi())
logger.crash("No Graphics API is compatible");