Skip to content

Repository files navigation

hakase-discord

codacy coverage integration delivery

hakase is a collection of helpful utilities for class chatrooms, including an assignment due date reminder, study session scheduler, and more. It is currently under development. This repository holds the Discord Bot, built with Spring Boot on Kotlin.

Local Development

Building and Running

To start off in VS Code, install the Kotlin by JetBrains extension. Local development with hakase-discord is relatively simple. The only command you have to run is:

./gradlew bootRun

You do have to have some environment variables in place. hakase does not directly read from a .env file, but you can configure environment variables or reference a .env file through IDE launch options. Otherwise, you can set environment variables locally.

ENV="development"
DISCORD_BOT_TOKEN="from Discord Dev Portal"
BACKEND_URL="from Backend API"
BACKEND_AUTH_TOKEN="from Backend API"

To only build the project without running the Spring Boot application, run the following:

./gradlew build

Testing

For testing, the following command should be run, with the above environment variables in place:

./gradlew test

Tests are JUnit based, with Mockito for the mocking library. The integrate.yml GitHub Actions workflow will run these tests with coverage.

Linting and Formatting

This project uses detekt for linting and ktfmt for code formatting. The gradle build task will check both linting and code formatting, but to fix linting and formatting errors, run:

./gradlew detekt # linting
./gradlew spotlessApply # formatting

The integrate.yml GitHub Actions workflow will check for linting errors and formatting mistakes as a part of the gradle build task.

Deployment

For deployment, hakase is built into a Docker image with BellSoft Cloud Native Buildpacks, and then deployed to Dokku on the DigitalOcean droplet using the Dokku GitHub Action.

On the deployed docker container, the same environment variables should be set, with ENV now being production.

Continuous Delivery

hakase has a continuous delivery GitHub Actions workflow, deliver.yml. The steps taken are summarized:

  1. Build a Docker image with the BellSoft Cloud Native Buildpacks
  2. Publish the docker image to GitHub Container Registry.
  3. Deploy to Dokku on the DigitalOcean droplet using the Dokku GitHub Action.
  4. A new Sentry release is created for monitoring with the Sentry Release GitHub Action.

About

Helpful Utilities for Class Chatrooms

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages