ci
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
This commit is contained in:
parent
f334831758
commit
9746b1ada0
51
.gitea/workflows/ci.yml
Normal file
51
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,51 @@
|
||||
name: Deploy App
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
paths-ignore:
|
||||
- .gitignore
|
||||
- README.md
|
||||
- LICENSE
|
||||
- docker-compose.yml
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["ubuntu-latest"]
|
||||
git-version: ["2.44.0"]
|
||||
java-version: ["17"]
|
||||
maven-version: ["3.8.5"]
|
||||
runs-on: ${{ matrix.arch }}
|
||||
|
||||
# Steps to run
|
||||
steps:
|
||||
# Checkout the repo
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Setup Java and Maven
|
||||
- name: Set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@v1.12.0
|
||||
with:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
distribution: "zulu"
|
||||
maven-version: ${{ matrix.maven-version }}
|
||||
|
||||
# Run JUnit Tests
|
||||
- name: Run Tests
|
||||
run: mvn --batch-mode test -q
|
||||
|
||||
# Re-checkout to reset the FS before deploying to Dokku
|
||||
- name: Checkout - Reset FS
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Deploy to Dokku
|
||||
- name: Push to dokku
|
||||
uses: dokku/github-action@master
|
||||
with:
|
||||
git_remote_url: "ssh://dokku@10.0.50.137:22/minecraft-helper"
|
||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM maven:3.9.6-eclipse-temurin-17-alpine
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /home/container
|
||||
|
||||
# Copy the current directory contents into the container at /home/container
|
||||
COPY . .
|
||||
|
||||
# Build the jar
|
||||
RUN mvn package -q -Dmaven.test.skip -DskipTests -T2C
|
||||
|
||||
# Make port 80 available to the world outside this container
|
||||
EXPOSE 80
|
||||
ENV PORT=80
|
||||
|
||||
# Run the jar file
|
||||
CMD java -jar target/Paste-Backend.jar -Djava.awt.headless=true
|
19
pom.xml
19
pom.xml
@ -72,6 +72,25 @@
|
||||
<version>3.14.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Tests -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo.spring3x</artifactId>
|
||||
<version>4.12.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,5 +1,7 @@
|
||||
package cc.fascinated;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@ -13,6 +15,10 @@ import java.util.Objects;
|
||||
@Log4j2(topic = "Main")
|
||||
@SpringBootApplication
|
||||
public class Main {
|
||||
public static final Gson GSON = new GsonBuilder()
|
||||
.setDateFormat("MM-dd-yyyy HH:mm:ss")
|
||||
.create();
|
||||
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) {
|
||||
File config = new File("application.yml");
|
||||
|
@ -4,7 +4,6 @@ import cc.fascinated.common.IPUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
|
@ -20,4 +20,11 @@ spring:
|
||||
# Paste Configuration
|
||||
paste:
|
||||
# The length of the ID for the paste
|
||||
id-length: 6
|
||||
id-length: 12
|
||||
|
||||
# Set the embedded MongoDB version
|
||||
de:
|
||||
flapdoodle:
|
||||
mongodb:
|
||||
embedded:
|
||||
version: 7.0.8
|
29
src/test/java/cc/fascinated/PasteControllerTests.java
Normal file
29
src/test/java/cc/fascinated/PasteControllerTests.java
Normal file
@ -0,0 +1,29 @@
|
||||
package cc.fascinated;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
class MojangControllerTests {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
public void ensureUploadSuccess() throws Exception {
|
||||
ResultActions result = mockMvc.perform(post("/upload")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("joe"))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user