Skip to content

Commit

Permalink
feat: swap maven to gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
BulatRuslanovich committed Oct 14, 2024
1 parent a2b3fb3 commit a08df88
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 495 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/deploy.yaml

This file was deleted.

73 changes: 3 additions & 70 deletions .github/workflows/dispatcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
paths: [ .github/workflows/dispatcher.yaml, dispatcher/** ]

jobs:
compile:
build:
runs-on: ubuntu-latest

steps:
Expand All @@ -23,72 +23,5 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Run compile
run: mvn -f dispatcher/pom.xml clean compile --no-transfer-progress
check_style:
needs: [ compile ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Run Checkstyle
run: mvn -f dispatcher/pom.xml clean checkstyle:check
test:
needs: [ check_style ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Run tests
run: mvn -f dispatcher/pom.xml clean test
package:
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Package the application
run: mvn -f dispatcher/pom.xml package

# deploy:
# runs-on: ubuntu-latest
# needs: build
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Set up SSH agent
# uses: webfactory/ssh-agent@v0.8.1
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
#
# - name: Deploy and Run Docker Compose
# run: |
# ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} << 'EOF'
# cd /path/to/your/docker-compose/directory
# docker-compose pull
# docker-compose down
# docker-compose up -d --build
# EOF
- name: Run Build
run: gradle clean build -p ./dispatcher
51 changes: 3 additions & 48 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
paths: [ .github/workflows/node.yaml, node/** ]

jobs:
compile:
build:
runs-on: ubuntu-latest

steps:
Expand All @@ -23,50 +23,5 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Run compile
run: mvn -f node/pom.xml clean compile --no-transfer-progress
check_style:
needs: [ compile ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Run Checkstyle
run: mvn -f node/pom.xml clean checkstyle:check
test:
needs: [ check_style ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Run tests
run: mvn -f node/pom.xml clean test
package:
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Package the application
run: mvn -f node/pom.xml package
- name: Run build
run: gradle clean build -p ./node
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
**/.gradle/**
**/gradlew
**/gradlew.bat
**/gradle/**

# Compiled class file
*.class
*.iml
Expand Down
13 changes: 4 additions & 9 deletions dispatcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
FROM maven:3.8-openjdk-17-slim
FROM gradle:7.6-jdk17 AS build

ENV HOME=/home/app
ENV MVN_SETTINGS=/usr/share/maven/ref/settings.xml

RUN mkdir -p ${HOME} \
&& mkdir -p /usr/share/maven/ref \
&& mkdir -p ${HOME}/dispatcher

ADD ./properties/settings.xml /usr/share/maven/ref/
RUN mkdir -p ${HOME} && mkdir -p ${HOME}/dispatcher

ADD ./dispatcher ${HOME}/dispatcher
RUN mvn -f ${HOME}/dispatcher/pom.xml -s ${MVN_SETTINGS} clean package
RUN gradle clean build -p ${HOME}/dispatcher

CMD ["java", "-jar", "/home/app/dispatcher/target/dispatcher-0.0.1.jar"]
CMD ["java", "-jar", "/home/app/dispatcher/build/libs/dispatcher-0.0.1.jar"]
59 changes: 59 additions & 0 deletions dispatcher/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.0'
id "io.spring.dependency-management" version "1.1.3"
}

group = 'com.bipbup'
version = '0.0.1'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}

configureEach {
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
}

repositories {
mavenCentral()
}

dependencies {
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}

implementation('org.telegram:telegrambots-spring-boot-starter:6.9.7.1') {
exclude group: 'commons-logging', module: 'commons-logging'
}

implementation 'org.springframework.kafka:spring-kafka'

implementation 'org.springframework.boot:spring-boot-starter-log4j2'

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}

dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}

test {
useJUnitPlatform()
}



53 changes: 0 additions & 53 deletions dispatcher/demo.gradle

This file was deleted.

Loading

0 comments on commit a08df88

Please sign in to comment.