Skip to content

Commit

Permalink
CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillSmirnow committed Mar 9, 2024
1 parent f30ec96 commit e6fa668
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 7 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
- push

jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: 17
- uses: actions/checkout@v2
- run: docker compose up -d mongo
working-directory: docker
- run: ./mvnw verify
deploy:
if: github.ref_name == 'main'
needs: qa
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- run: ./mvnw package -DskipTests
- run: cp crypto-messenger-server/target/*.jar docker/
- run: docker compose -p crypto-messenger up -d --build
working-directory: docker
build-for-debian:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: 17
- uses: actions/checkout@v2
- run: ./mvnw install -DskipTests
- uses: actions/upload-artifact@v3
with:
name: debian-${{ github.run_id }}
path: crypto-messenger-desktop/target/*.deb
build-for-windows:
runs-on: windows-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: 17
- uses: actions/checkout@v2
- run: ./mvnw install -DiconType=ico -DskipTests
- uses: actions/upload-artifact@v3
with:
name: windows-${{ github.run_id }}
path: crypto-messenger-desktop/target/*.exe
build-for-macos:
runs-on: macos-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: 17
- uses: actions/checkout@v2
- run: ./mvnw install -DskipTests
- uses: actions/upload-artifact@v3
with:
name: macos-${{ github.run_id }}
path: crypto-messenger-desktop/target/*.dmg
2 changes: 1 addition & 1 deletion crypto-messenger-coder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.example</groupId>
<artifactId>crypto-messenger</artifactId>
<version>1.0-SNAPSHOT</version>
<version>0.1.0</version>
</parent>

<artifactId>crypto-messenger-coder</artifactId>
Expand Down
41 changes: 40 additions & 1 deletion crypto-messenger-desktop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
<parent>
<groupId>org.example</groupId>
<artifactId>crypto-messenger</artifactId>
<version>1.0-SNAPSHOT</version>
<version>0.1.0</version>
</parent>

<artifactId>crypto-messenger-desktop</artifactId>

<properties>
<iconType>png</iconType>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
Expand Down Expand Up @@ -47,6 +51,41 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/app</outputDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.panteleyev</groupId>
<artifactId>jpackage-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>jpackage</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Build -->
<input>${project.build.directory}/app</input>
<mainJar>${project.build.finalName}.jar</mainJar>
<destination>${project.build.directory}</destination>

<!-- App -->
<name>CryptoMessenger</name>
<icon>src/main/resources/graphics/lock.${iconType}</icon>
<vendor>Kirill</vendor>

<!-- Windows -->
<winDirChooser>true</winDirChooser>
<winShortcutPrompt>true</winShortcutPrompt>
<winShortcut>true</winShortcut>
<winMenu>true</winMenu>
<winMenuGroup>Kirill</winMenuGroup>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public JavaFxApplication() {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("CryptoMessenger");
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/graphics/lock.jpg")));
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/graphics/lock.png")));
primaryStage.setScene(sceneLoader.load("MainScene"));
primaryStage.show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SendMessageDialog {
public void show(Runnable onSuccess) {
var stage = new Stage();
stage.setTitle("Send Message");
stage.getIcons().add(new Image(getClass().getResourceAsStream("/graphics/lock.jpg")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/graphics/lock.png")));
stage.initModality(Modality.APPLICATION_MODAL);
var sceneProperties = SceneProperties.of(
entry("onSent", (Runnable) () -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app:
server-base-url: http://localhost:8080
server-base-url: http://164.90.184.120
spring:
main:
web-application-type: none
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion crypto-messenger-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.example</groupId>
<artifactId>crypto-messenger</artifactId>
<version>1.0-SNAPSHOT</version>
<version>0.1.0</version>
</parent>

<artifactId>crypto-messenger-server</artifactId>
Expand Down
1 change: 1 addition & 0 deletions crypto-messenger-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
spring:
data:
mongodb:
host: mongo
database: main
auto-index-creation: true
Empty file.
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:17-jre-alpine
WORKDIR /opt
COPY *.jar .
ENTRYPOINT exec java -Xmx200M -jar *.jar
16 changes: 16 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3'
services:
app:
build: .
restart: always
ports:
- 0.0.0.0:80:8080
mongo:
image: mongo
restart: always
ports:
- 127.0.0.1:27017:27017
volumes:
- mongo:/data/db
volumes:
mongo:
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.example</groupId>
<artifactId>crypto-messenger</artifactId>
<version>1.0-SNAPSHOT</version>
<version>0.1.0</version>
<packaging>pom</packaging>

<modules>
Expand Down

0 comments on commit e6fa668

Please sign in to comment.