Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read
packages: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-24.04
name: Build

steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build project
run: ./gradlew bootJar

test:
runs-on: ubuntu-24.04
name: Test
needs: build

steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run tests
run: ./gradlew test

- name: Run tests with coverage
run: ./gradlew jacocoTestReport

- name: Jacoco Report to PR
id: jacoco
uses: madrapps/jacoco-report@v1.7.1
with:
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}

min-coverage-overall: 40
min-coverage-changed-files: 60
title: Code Coverage
update-comment: true

lint:
runs-on: ubuntu-24.04
name: Style
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run static code analysis
run: ./gradlew checkstyleMain

package:
runs-on: ubuntu-24.04
name: Package
needs: [test, lint]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GTHB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/fintech.Dockerfile
push: true
tags: ghcr.io/alexandergarifullin/fintech:latest
25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.3.4'
id 'io.spring.dependency-management' version '1.1.6'
id 'jacoco'
id 'checkstyle'
}

group = 'com.cf'
Expand All @@ -17,6 +19,11 @@ repositories {
mavenCentral()
}

checkstyle {
toolVersion = '10.3'
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
}

dependencies {
// spring
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand All @@ -32,9 +39,25 @@ dependencies {

// test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.testcontainers:junit-jupiter:1.20.1'
testImplementation 'org.wiremock:wiremock-standalone:3.9.1'
testImplementation 'org.wiremock.integrations.testcontainers:wiremock-testcontainers-module:1.0-alpha-14'
testImplementation 'org.testcontainers:postgresql:1.20.3'
testImplementation 'org.liquibase:liquibase-core:4.29.2'
}

tasks.named('test') {
useJUnitPlatform()
}

tasks.test {
jvmArgs '-XX:+EnableDynamicAgentLoading'
systemProperty "spring.profiles.active", "test"
}

jacocoTestReport {
reports {
html.required = true
xml.required = true
}
}
Loading