-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fb1153
commit 8afc601
Showing
47 changed files
with
2,955 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Github CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
runs-on: home-laboratory-runner | ||
|
||
services: | ||
postgres: | ||
image: postgres:15.2 | ||
env: | ||
POSTGRES_DB: finwavebot | ||
POSTGRES_USER: finwavebot | ||
POSTGRES_PASSWORD: change_me | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
with: | ||
arguments: build | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: FinWave Telegram Bot | ||
path: build/libs/*.jar | ||
build-docker: | ||
needs: build | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: FinWave Telegram Bot | ||
|
||
- name: Extract version | ||
id: get_version | ||
run: echo "::set-output name=VERSION::$(grep "version =" build.gradle | awk -F\' '{print $2}')" | ||
|
||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/finwave-telegram-bot/bot:latest | ||
ghcr.io/finwave-telegram-bot/bot:${{ steps.get_version.outputs.VERSION }} | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.html_url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM openjdk:17-alpine | ||
MAINTAINER isKONSTANTIN <[email protected]> | ||
|
||
WORKDIR /finwave-bot | ||
|
||
COPY ./FinWave-Bot.jar ./ | ||
|
||
ENTRYPOINT ["java", "-jar", "FinWave-Bot.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# FinWave Telegram Bot | ||
|
||
This is the Telegram bot of a web application for financial accounting. The application is designed to help users track and manage their financial data. | ||
|
||
## Build & Run Requirements | ||
|
||
Make sure to install the dependencies: | ||
|
||
1. Java 17 | ||
2. Docker & Docker Compose | ||
|
||
Docker is needed for a local database. It is required to generate jooq classes | ||
|
||
### To start development server: | ||
|
||
```bash | ||
cd localhost-utils | ||
sudo docker-compose up -d | ||
cd .. | ||
./gradlew run | ||
``` | ||
|
||
### For .jar build: | ||
|
||
```bash | ||
cd localhost-utils | ||
sudo docker-compose up -d | ||
cd .. | ||
./gradlew jar | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
plugins { | ||
id 'java' | ||
id 'application' | ||
id 'nu.studer.jooq' version '8.2' | ||
id 'org.flywaydb.flyway' version '9.22.0' | ||
} | ||
|
||
group = 'app.finwave.telegrambot' | ||
version = '1.0.0' | ||
mainClassName = group + ".Main" | ||
archivesBaseName = 'FinWave-Bot' | ||
|
||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { | ||
url "https://nexus.finwave.app/repository/maven-public" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'app.finwave.api:finwave-java-api:1.2.1' | ||
implementation 'app.finwave.tat:telegram-abstractions-tools:2.0.3' | ||
implementation 'app.finwave.scw:finwave-scw:0.4.1' | ||
|
||
implementation 'com.github.pengrad:java-telegram-bot-api:7.4.0' | ||
implementation 'io.github.stefanbratanov:jvm-openai:0.9.3' | ||
|
||
implementation 'org.java-websocket:Java-WebSocket:1.5.2' | ||
|
||
implementation 'org.jsoup:jsoup:1.15.3' | ||
implementation 'org.flywaydb:flyway-core:9.22.0' | ||
|
||
implementation 'org.jooq:jooq:3.18.3' | ||
implementation 'org.jooq:jooq-codegen-maven:3.18.3' | ||
implementation 'org.jooq:jooq-meta:3.18.3' | ||
implementation 'org.jooq:jooq-postgres-extensions:3.18.3' | ||
|
||
implementation 'org.apache.commons:commons-text:1.9' | ||
|
||
implementation 'com.google.inject:guice:5.1.0' | ||
implementation 'com.google.code.gson:gson:2.10.1' | ||
implementation 'com.google.guava:guava:33.2.1-jre' | ||
|
||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7' | ||
|
||
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.3' | ||
jooqGenerator 'org.postgresql:postgresql:42.7.3' | ||
|
||
testImplementation platform('org.junit:junit-bom:5.9.1') | ||
testImplementation 'org.junit.jupiter:junit-jupiter' | ||
} | ||
|
||
|
||
flyway { | ||
url = 'jdbc:postgresql://postgres:5432/finwavebot' | ||
user = 'finwavebot' | ||
password = 'change_me' | ||
schemas = ['public'] | ||
driver = 'org.postgresql.Driver' | ||
baselineOnMigrate = true | ||
locations = ['filesystem:src/main/resources/db/migration'] | ||
} | ||
|
||
jooq { | ||
configurations { | ||
main { | ||
generateSchemaSourceOnCompilation = true | ||
|
||
generationTool { | ||
jdbc { | ||
driver = 'org.postgresql.Driver' | ||
url = 'jdbc:postgresql://postgres:5432/finwavebot' | ||
user = 'finwavebot' | ||
password = 'change_me' | ||
properties { | ||
property { | ||
key = 'ssl' | ||
value = 'false' | ||
} | ||
} | ||
} | ||
generator { | ||
name = 'org.jooq.codegen.DefaultGenerator' | ||
database { | ||
name = 'org.jooq.meta.postgres.PostgresDatabase' | ||
inputSchema = 'public' | ||
forcedTypes { | ||
forcedType { | ||
name = 'varchar' | ||
includeExpression = '.*' | ||
includeTypes = 'JSONB?' | ||
} | ||
forcedType { | ||
name = 'varchar' | ||
includeExpression = '.*' | ||
includeTypes = 'INET' | ||
} | ||
} | ||
} | ||
generate { | ||
deprecated = false | ||
records = true | ||
immutablePojos = true | ||
fluentSetters = true | ||
} | ||
target { | ||
packageName = 'app.finwave.telegrambot.jooq' | ||
directory = 'build/generated-src/jooq/main' | ||
} | ||
strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
configurations.implementation.setCanBeResolved(true) | ||
|
||
tasks.getByName("generateJooq").dependsOn("flywayMigrate") | ||
|
||
jar { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
|
||
from(configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) }) { | ||
exclude 'META-INF', 'META-INF/**' | ||
} | ||
|
||
manifest { | ||
attributes 'Main-Class': mainClassName | ||
attributes 'Implementation-Version': archiveVersion | ||
} | ||
|
||
archiveFileName.set(archivesBaseName + '.jar') | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Fri Jun 14 06:06:58 MSK 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.