[AB-199] adding build of sources and javadoc

fixing javadoc as various places
adding release plugin
adding developer connection to scm
updating release pipeline to new action versions
This commit is contained in:
Sheldan
2021-03-12 23:43:52 +01:00
parent 2ed456c164
commit a36a884ae9
19 changed files with 99 additions and 40 deletions

View File

@@ -15,20 +15,16 @@ jobs:
java-version: 1.8
- name: Load current version
id: version
run: echo "::set-output name=version::$(mvn --file abstracto-application/pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)"
run: echo "version=$(mvn --file abstracto-application/pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_ENV
- name: Publish to GitHub Packages
run: mvn --file abstracto-application/pom.xml -B deploy -P documentation,deployment-docker -Dmaven.wagon.http.pool=false -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install SSH Client
uses: webfactory/ssh-agent@v0.3.0
with:
ssh-private-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- name: Deploy documentation to GitHub pages
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
REPOSITORY_NAME: Sheldan/abstracto-docs
TARGET_FOLDER: docs/${{ steps.version.outputs.version }}
BRANCH: master
SSH: true
FOLDER: abstracto-application/documentation/target/generated-docs
repository-name: Sheldan/abstracto-docs
target-folder: docs/${{ env.version }}
branch: master
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
folder: abstracto-application/documentation/target/generated-docs

View File

@@ -213,6 +213,7 @@ public interface AssignableRolePlaceService {
* @param server The {@link AServer server} in which the {@link AssignableRolePlace place} is
* @param name The key of the {@link AssignableRolePlace place}
* @param newValue The new vale of the inline attribute
* @return A {@link CompletableFuture future} which completes when the config has been updated, or when the message was edited (if the posts already exist)
*/
CompletableFuture<Void> setAssignablePlaceInlineTo(AServer server, String name, Boolean newValue);
@@ -222,6 +223,7 @@ public interface AssignableRolePlaceService {
* are any.
* @param server The {@link AServer server} in which the {@link AssignableRolePlace place} is
* @param name The key of the {@link AssignableRolePlace place} to inline
* @return A {@link CompletableFuture future} which completes when the config has been updated, or when the message was edited (if the posts already exist)
*/
CompletableFuture<Void> inlineAssignableRolePlace(AServer server, String name);
@@ -229,6 +231,7 @@ public interface AssignableRolePlaceService {
* Sets the inline attribute of the {@link AssignableRolePlace place} to true. This method will update any existing
* {@link AssignableRolePlacePost posts} of the place, if there are any.
* @param place The {@link AssignableRolePlace place} to inline
* @return A {@link CompletableFuture future} which completes when the config has been updated, or when the message was edited (if the posts already exist)
*/
CompletableFuture<Void> inlineAssignableRolePlace(AssignableRolePlace place);
@@ -238,6 +241,7 @@ public interface AssignableRolePlaceService {
* are any.
* @param server The {@link AServer server} in which the {@link AssignableRolePlace place} is
* @param name The key of the {@link AssignableRolePlace place} to spread
* @return A {@link CompletableFuture future} which completes when the config has been updated, or when the message was edited (if the posts already exist)
*/
CompletableFuture<Void> spreadAssignableRolePlace(AServer server, String name);
@@ -245,6 +249,7 @@ public interface AssignableRolePlaceService {
* Sets the inline attribute of the {@link AssignableRolePlace place} to false. This method will update any existing
* {@link AssignableRolePlacePost posts} of the place, if there are any.
* @param place The {@link AssignableRolePlace place} to spread
* @return A {@link CompletableFuture future} which completes when the config has been updated, or when the message was edited (if the posts already exist)
*/
CompletableFuture<Void> spreadAssignableRolePlace(AssignableRolePlace place);
@@ -389,6 +394,7 @@ public interface AssignableRolePlaceService {
* @param server The {@link AServer server} in which the {@link AssignableRolePlace place} is
* @param name The key of the {@link AssignableRolePlace place}
* @param newText The new value for the text attribute displayed in the first {@link AssignableRolePlacePost post}
* @return A {@link CompletableFuture future} which completes when the config has been updated, or when the message was edited (if the posts already exist)
*/
CompletableFuture<Void> changeTextAsync(AServer server, String name, String newText);

View File

@@ -59,9 +59,9 @@ public interface AssignableRoleManagementService {
/**
* Returns the respective {@link AssignableRole assignableRole} for the {@link CachedEmote emote} which is part of the
* {@link AssignableRolePlace place}. It will throw an exception, if the {@link CachedEmote emote} is not used.
* @param cachedEmote
* @param assignableRolePlace
* @return
* @param cachedEmote The {@link CachedEmote emote} which should be used to identify the {@link AssignableRole role}
* @param assignableRolePlace The {@link AssignableRolePlace place} from which the {@link AssignableRole role} should be retrieved for
* @return An instance of {@link AssignableRole role} which was in the place and identified by the emote
*/
AssignableRole getRoleForReactionEmote(CachedEmote cachedEmote, AssignableRolePlace assignableRolePlace);
}

View File

@@ -31,7 +31,7 @@ public interface AssignableRolePlacePostManagementService {
* Creates an {@link AssignableRolePlacePost post} for the given {@link AssignableRolePlace place} in the given message ID
* @param updatedPlace The {@link AssignableRolePlace place} this post should be part of
* @param messageId The ID of the message in which the post exists
* @return
* @return The {@link AssignableRolePlacePost post} which is found in the given {@link AssignableRolePlace place} of the {@link net.dv8tion.jda.api.entities.Message message} ID
*/
AssignableRolePlacePost createAssignableRolePlacePost(AssignableRolePlace updatedPlace, Long messageId);
}

View File

@@ -15,22 +15,26 @@ public interface LeaderBoardEntryResult {
/**
* The experience of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer}
* @return experience count
*/
Long getExperience();
/**
* The current raw level of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer}
* @return Level as integer
*/
Integer getLevel();
/**
* The amount of messages tracked by the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer}
* @return The amount of tracked messages
*/
Long getMessageCount();
/**
* The current position of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer} in the leader board
* ordered by experience count
* @return The position in the current server
*/
Integer getRank();
}

View File

@@ -65,6 +65,7 @@ public interface AUserExperienceService {
* state in the server and the database.
* @param userExperience The {@link AUserExperience userExperience} object to recalculate the {@link AExperienceRole experienceRole} for
* @param roles The list of {@link AExperienceRole roles} used as a role configuration
* @param currentLevel The current level of the user
* @return A {@link CompletableFuture future} containing the {@link RoleCalculationResult result} of the role calculation,
* completing after the role of the {@link net.dv8tion.jda.api.entities.Member} has been updated, if any
*/

View File

@@ -28,7 +28,8 @@ public interface MuteManagementService {
/**
* Finds the mute from the database by the given ID.
* @param muteId The id of the mute to search for
* @param muteId The ID of the mute to search for
* @param serverId The ID of the server to retrieve the {@link Mute mute} in
* @return An optional containing a {@link Mute} if the ID exists, and null otherwise
*/
Optional<Mute> findMuteOptional(Long muteId, Long serverId);

View File

@@ -198,6 +198,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param channel The created {@link TextChannel} in which the mod mail thread is dealt with
* @param userInitiated Whether or not the thread was initiated by a member
* @param undoActions The list of actions to undo, in case an exception occurs
* @return A {@link CompletableFuture future} which completes when the setup is done
*/
@Transactional
public CompletableFuture<Void> performModMailThreadSetup(Member member, Message initialMessage, TextChannel channel, boolean userInitiated, List<UndoActionInstance> undoActions) {
@@ -237,6 +238,8 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
/**
* Sends the message containing the pings to notify the staff members to handle the opened {@link ModMailThread}
* @param member The {@link FullUserInServer} which opened the thread
* @param channel The created {@link TextChannel} in which the mod mail thread is dealt with
* @return A {@link CompletableFuture future} which complets when the notification has been sent
*/
@Transactional
public CompletableFuture<Void> sendModMailNotification(Member member, TextChannel channel) {
@@ -519,7 +522,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
@Override
public CompletableFuture<Void> closeModMailThread(ModMailThread modMailThread, String note, boolean notifyUser, boolean logThread, List<UndoActionInstance> undoActions) {
metricService.incrementCounter(MODMAIL_THREAD_CREATED_COUNTER);
metricService.incrementCounter(MODMAIL_THREAD_CLOSED_COUNTER);
Long modMailThreadId = modMailThread.getId();
log.info("Starting closing procedure for thread {}", modMailThread.getId());
List<ModMailMessage> modMailMessages = modMailThread.getMessages();
@@ -562,6 +565,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param messages The list of loaded {@link Message} to log
* @param serverId The ID of the {@link Guild} the {@link ModMailThread} is in
* @param userId The ID of the user the {@link ModMailThread} is about
* @return A {@link CompletableFuture future} which completes when the messages have been logged
*/
@Transactional
public CompletableFuture<Void> logMessagesToModMailLog(String note, Boolean notifyUser, Long modMailThreadId, List<UndoActionInstance> undoActions, LoadedModmailThreadMessageList messages, Long serverId, Long userId) {
@@ -575,7 +579,11 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
});
return memberService.getMemberInServerAsync(serverId, userId).thenCompose(member ->
self.afterSuccessfulLog(modMailThreadId, notifyUser, member, undoActions)
);
).exceptionally(throwable -> {
log.warn("Failed to retrieve member for closing the modmail thread. Closing without member information.", throwable);
self.afterSuccessfulLog(modMailThreadId, false, null, undoActions);
return null;
});
});
} catch (Exception e) {
log.error("Failed to log mod mail messages", e);
@@ -589,7 +597,9 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param modMailThreadId The ID of the {@link ModMailThread} which is being closed.
* @param notifyUser Whether or not the user should be notified
* @param undoActions The list of {@link UndoActionInstance} to execute in case of exceptions
* @param modMailThreaduser The {@link Member member} for which the {@link ModMailThread thread} was for
* @throws ModMailThreadNotFoundException in case the {@link ModMailThread} is not found by the ID
* @return A {@link CompletableFuture future} which completes after the messages have been logged
*/
@Transactional
public CompletableFuture<Void> afterSuccessfulLog(Long modMailThreadId, Boolean notifyUser, Member modMailThreaduser, List<UndoActionInstance> undoActions) {
@@ -620,6 +630,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param modMailThreadId The ID of the {@link ModMailThread} to delete the {@link MessageChannel} from
* @param undoActions The list of {@link UndoActionInstance} to execute in case of exceptions
* @throws ModMailThreadNotFoundException in case the {@link ModMailThread} is not found by the ID
* @return A {@link CompletableFuture future} which completes after the {@link TextChannel channel} in which the thread was has been deleted
*/
@Transactional
public CompletableFuture<Void> deleteChannelAndClose(Long modMailThreadId, List<UndoActionInstance> undoActions) {
@@ -653,6 +664,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param modMailThreadId The ID of the {@link ModMailThread} to log the messages of
* @param messages The list of {@link CompletableFuture} which contain the {@link Message} which could be loaded
* @param note The note which was entered when closing the {@link ModMailThread}
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @throws ModMailThreadNotFoundException in case the {@link ModMailThread} is not found by the ID
* @return An instance of {@link CompletableFutureList}, which contains a main {@link CompletableFuture} which is resolved,
* when all of the smaller {@link CompletableFuture} in it are resolved. We need this construct, because we need to access
@@ -762,6 +774,9 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param modMailThreadId The ID of the {@link ModMailThread} for which the messages were sent for
* @param anonymous Whether or not the messages were send anonymous
* @param moderator The original {@link AUserInAServer} which authored the messages
* @param createdMessageInDM The {@link Message message} which was sent to the private channel with the {@link User user}
* @param modMailThreadMessage The {@link Message message} which was sent in the channel representing the {@link ModMailThread thread}. Might be null.
* @param replyCommandMessage The {@link Message message} which contained the command used to reply to the user
* @throws ModMailThreadNotFoundException in case the {@link ModMailThread} is not found by the ID
*/
@Transactional

View File

@@ -26,7 +26,7 @@ public class ModMailClosingHeaderModel {
/**
* The duration between the creation and closed date of a {@link ModMailThread}
* @return
* @return The duration between the creation date and the date the thread has been closed
*/
public Duration getDuration() {
return Duration.between(closedThread.getCreated(), closedThread.getClosed());

View File

@@ -26,6 +26,8 @@ public interface ModMailThreadService {
* @param initialMessage The initial message sparking this mod mail thread, null in case it was created by a command
* @param feedBackChannel The {@link MessageChannel} in which feedback about exceptions should be posted to
* @param userInitiated Whether or not the mod mail thread was initiated by a user
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @return A {@link CompletableFuture future} which completes when the modmail thread is set up
*/
CompletableFuture<Void> createModMailThreadForUser(Member member, Message initialMessage, MessageChannel feedBackChannel, boolean userInitiated, List<UndoActionInstance> undoActions);
@@ -51,7 +53,9 @@ public interface ModMailThreadService {
* In case there was no channel found, this will cause a message to be shown to the user and the existing mod mail thread will be closed.
* This is the case, if the mod mail thread was still open in the database, but no text channel was found anymore.
* @param modMailThread The {@link ModMailThread} on which the user answered
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @param messageFromUser The {@link Message} object which was sent by the user as an answer
* @return A {@link CompletableFuture future} which completes when the message has been relayed to the channel
*/
CompletableFuture<Message> relayMessageToModMailThread(ModMailThread modMailThread, Message messageFromUser, List<UndoActionInstance> undoActions);
@@ -63,8 +67,9 @@ public interface ModMailThreadService {
* @param message The pure {@link Message} containing the command which caused the reply
* @param anonymous Whether or nor the message should be send anonymous
* @param feedBack The {@link MessageChannel} in which feedback about possible exceptions should be sent to
* @param undoActions list of {@link UndoActionInstance} to execute in case this fails
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @param targetMember The {@link Member} the {@link ModMailThread} is about.
* @return A {@link CompletableFuture future} which completes when the message has been relayed to the DM
*/
CompletableFuture<Void> relayMessageToDm(Long threadId, String text, Message message, boolean anonymous, MessageChannel feedBack, List<UndoActionInstance> undoActions, Member targetMember);
@@ -77,6 +82,8 @@ public interface ModMailThreadService {
* @param note The text of the note used for the header message of the logged mod mail thread.
* @param notifyUser Whether or not the user should be notified
* @param log whether or not the closed {@link ModMailThread} should be logged (if the {@link dev.sheldan.abstracto.core.config.FeatureMode} is enabled)
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @return A {@link CompletableFuture future} which completes when the {@link ModMailThread thread} has been closed.
*/
CompletableFuture<Void> closeModMailThread(ModMailThread modMailThread, String note, boolean notifyUser, List<UndoActionInstance> undoActions, Boolean log);
@@ -90,6 +97,8 @@ public interface ModMailThreadService {
* logging the mod mail thread
* @param notifyUser Whether or not the user should be notified
* @param logThread Whether or not the thread should be logged to the appropriate post target
* @param undoActions A list of {@link dev.sheldan.abstracto.core.models.UndoAction actions} to be undone in case the operation fails. This list will be filled in the method.
* @return A {@link CompletableFuture future} which completes when the {@link ModMailThread thread} has been closed
*/
CompletableFuture<Void> closeModMailThread(ModMailThread modMailThread, String note, boolean notifyUser, boolean logThread, List<UndoActionInstance> undoActions);

View File

@@ -21,7 +21,7 @@ public interface ModMailMessageManagementService {
* @param author The {@link AUserInAServer} who authored the {@link Message} originally
* @param anonymous Whether or not the message was sent anonymous (only possible by staff members)
* @param dmChannel Whether or not the message originated from the user, and therefore in an direct message channel
* @return
* @return The created {@link ModMailMessage message} instance
*/
ModMailMessage addMessageToThread(ModMailThread modMailThread, Message createdMessageInDM, Message createdMessageInChannel, Message userPostedMessage, AUserInAServer author, Boolean anonymous, Boolean dmChannel);

View File

@@ -34,6 +34,7 @@ public class EmoteStatsModel {
/**
* Whether or not this model contains *any* stats to render.
* @return Whether or not there are any stats to display
*/
public boolean areStatsAvailable() {
return !animatedEmotes.isEmpty() || !staticEmotes.isEmpty();

View File

@@ -6,17 +6,17 @@ package dev.sheldan.abstracto.statistic.emote.model;
*/
public interface EmoteStatsResult {
/**
* ID of the emote
* @return The ID of the emote
*/
Long getEmoteId();
/**
* ID of the server
* @return ID of the server
*/
Long getServerId();
/**
* Amount the emote with the ID has been used in the server with the ID
* @return Amount the emote with the ID has been used in the server with the ID
*/
Long getAmount();
}

View File

@@ -86,18 +86,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>remind-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>repost-detection-impl</artifactId>

View File

@@ -39,6 +39,8 @@ public class FreemarkerConfiguration {
* The correct compatibility version and the provided formatter methods to be used in the templates.
* The encoding of the templates is set to UTF-8.
* @return A configured {@link Configuration} bean according to the configuration
* @throws IOException when the configuration fails to be created
* @throws TemplateException when the configuration fails to be created
*/
@Bean
public Configuration freeMarkerConfiguration() throws IOException, TemplateException {

View File

@@ -10,11 +10,18 @@ import java.util.Optional;
*/
public interface EffectiveTemplateManagementService {
/**
* Retrieves the template identified by the key.
* Retrieves the template identified by the key for the server
* @param key They template key to search for
* @return An {@link Optional} containing the {@link Template} if it exists, and null otherwise
* @param server The ID of the server to retrieve the template for
* @return An {@link Optional} containing the {@link Template} if it exists, and empty otherwise
*/
Optional<EffectiveTemplate> getTemplateByKeyAndServer(String key, Long server);
/**
* Retrieves the template identified by the key.
* @param key They template key to search for
* @return An {@link Optional} containing the {@link Template} if it exists, and empty otherwise
*/
Optional<EffectiveTemplate> getTemplateByKey(String key);
}

View File

@@ -9,7 +9,6 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>dev.sheldan.abstracto.templating</groupId>
<artifactId>documentation</artifactId>
<packaging>pom</packaging>

View File

@@ -36,6 +36,7 @@
<scm>
<url>https://maven.pkg.github.com/Sheldan/abstracto</url>
<developerConnection>scm:git:git@github.com:Sheldan/abstracto.git</developerConnection>
</scm>
<repositories>
@@ -75,7 +76,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
<plugin>
@@ -103,6 +108,30 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@@ -22,6 +22,7 @@ public class SchedulerStartupService {
/**
* Loads the job definitions from the database and schedules them, if the job does not exist yet.
* @param ctxStartEvt The event info from spring
*/
@EventListener
@Transactional(isolation = Isolation.SERIALIZABLE)