Skip to content

Commit

Permalink
add: delete old format support
Browse files Browse the repository at this point in the history
add: fix build
add: new plugin system
add: spring boot 3, update allure, update all libs version,
update vaadin, update gradle, update nodejs
  • Loading branch information
kochetkov-ma committed Jul 1, 2024
1 parent 650449c commit f2dc42a
Show file tree
Hide file tree
Showing 153 changed files with 20,247 additions and 26,024 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
.helm/
.github/
build/
.idea/
.gradle/
tmp/
tmp/
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 200

[*.java]
max_line_length = 180

[*.yml}]
indent_size = 2

[*.yaml]
indent_size = 2
18 changes: 9 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ name: Build / Test / Check
on: [push, pull_request]

env:
NODE_VERSION: 12.x
NODE_VERSION: 20.13.1
GRADLE_VERSION: 8.8

jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Fast checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: '11'
java-package: jdk
architecture: x64
java-version: '21'
distribution: 'temurin'
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build with Gradle
uses: eskatos/gradle-command-action@v1
uses: eskatos/gradle-command-action@v3
with:
gradle-version: 6.9.2
gradle-version: ${{ env.GRADLE_VERSION }}
arguments: '--stacktrace --info build'
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,47 @@ jobs:
build:
runs-on: ubuntu-latest
steps:

## Build prepare ##
- name: Fast checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set RELEASE_VERSION
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:11}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: '11'
java-package: jdk
architecture: x64
java-version: '21'
distribution: 'temurin'
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

## Build Image ##
- name: Build with Gradle
uses: eskatos/gradle-command-action@v1
uses: eskatos/gradle-command-action@v3
with:
gradle-version: 6.9.2
gradle-version: ${{ env.GRADLE_VERSION }}
arguments: ' -Pversion=${{ env.RELEASE_VERSION }} --stacktrace bootJar'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: allure-server-${{ env.RELEASE_VERSION }}.jar
path: build/libs/allure-server-${{ env.RELEASE_VERSION }}.jar

## Release in DockerHub ##
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
env:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
name: kochetkovma/allure-server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ env.RELEASE_VERSION }}"
buildargs: RELEASE_VERSION

## Release in GitHub ##
- name: Create Release
id: create_release
uses: actions/create-release@latest
Expand All @@ -64,14 +75,3 @@ jobs:
asset_path: build/libs/allure-server-${{ env.RELEASE_VERSION }}.jar
asset_name: allure-server.jar
asset_content_type: application/jar
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
env:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
name: kochetkovma/allure-server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ env.RELEASE_VERSION }}"
buildargs: RELEASE_VERSION
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ allure-server-store/
tmp/

pg-secret.yaml
CA.pem
CA.pem

**/generated/**
*generated*
*-private*
42 changes: 0 additions & 42 deletions .pnpmfile.cjs

This file was deleted.

11 changes: 3 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
FROM gradle:6.9.2-jdk11 as build
COPY . .
ARG RELEASE_VERSION=${RELEASE_VERSION:-0.0.0}
RUN gradle -Pversion=docker -i -s --no-daemon bootJar

FROM openjdk:11.0.15-jre-slim-bullseye as production
COPY --from=build /home/gradle/build/libs/allure-server-docker.jar /allure-server-docker.jar
FROM openjdk:21-slim
COPY build/libs/allure-server.jar /allure-server-docker.jar
# Set port
EXPOSE ${PORT:-8080}
# Run application
ENV JAVA_OPTS="-Xms256m -Xmx2048m"
ENTRYPOINT ["java", "-Dloader.path=/ext", "-cp", "allure-server-docker.jar", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE:default}", "org.springframework.boot.loader.PropertiesLauncher"]
ENTRYPOINT ["java", "-Dloader.path=/ext", "-jar", "allure-server-docker.jar", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE:default}"]
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ Allure Portal (Allure Report Server)
=================================
![Build / Test / Check](https://github.com/kochetkov-ma/allure-server/workflows/Build%20/%20Test%20/%20Check/badge.svg?branch=master)

[![jdk11](https://camo.githubusercontent.com/f3886a668d85acf93f6fec0beadcbb40a5446014/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a646b2d31312d7265642e737667)](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)
[![gradle](https://camo.githubusercontent.com/f7b6b0146f2ee4c36d3da9fa18d709301d91f811/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f6f6c2d677261646c652d626c75652e737667)](https://gradle.org/)
[![junit](https://camo.githubusercontent.com/d2ba89c41121d7c6223c1ad926380235cf95ef82/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a756e69742d706c6174666f726d2d627269676874677265656e2e737667)](https://github.com/junit-team/junit4/blob/master/doc/ReleaseNotes4.13.md)
![Static Badge](https://img.shields.io/badge/java-21-brightgreen)
![Static Badge](https://img.shields.io/badge/gradle-8.8-brightgreen)

![Docker Image Version](https://img.shields.io/docker/v/kochetkovma/allure-server?label=DockerHub)
![Docker Pulls](https://img.shields.io/docker/pulls/kochetkovma/allure-server?link=https)


[![checkstyle](https://img.shields.io/badge/checkstyle-google-blue)](https://github.com/checkstyle/checkstyle)
[![pmd](https://img.shields.io/badge/pmd-passed-green)](https://github.com/pmd/pmd)
[![spotbugs](https://img.shields.io/badge/spotbugs-passed-green)](https://github.com/spotbugs/spotbugs)

## About

https://allurereport.org/docs

Allure server for store / aggregate / manage Allure results and generate / manage Allure Reports.

There is simple API with Swagger(OpenAPI) Description.
Expand Down
107 changes: 89 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import java.util.regex.Pattern

plugins {
id 'java'
id 'jacoco'
id 'idea'
id 'pmd'
id 'checkstyle'

id 'com.github.spotbugs' version '4.6.0'
id 'io.freefair.lombok' version '5.3.3.3'
id 'com.github.ben-manes.versions' version '0.42.0'
id 'io.freefair.lombok' version '8.6'
id 'com.github.ben-manes.versions' version '0.51.0'

// https://docs.spring.io/spring-boot/docs/current/reference/html/dependency-versions.html
id 'org.springframework.boot' version '2.7.1'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'org.springframework.boot' version '3.3.1'
id 'io.spring.dependency-management' version '1.1.5'

id "com.vaadin" version "23.1.3"
id "com.vaadin" version "24.4.4"
id "org.openapi.generator" version '7.6.0'
}
apply from: './gradle/dependencies.gradle'
apply from: './gradle/checking.gradle'
apply from: './gradle/testing.gradle'

generateLombokConfig.enabled = false

group = theGroup
archivesBaseName = theArchivesBaseName
idea {
Expand All @@ -33,27 +29,102 @@ compileJava {
options.encoding = 'UTF-8'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = '6.9.2'
gradleVersion = '8.8'
doLast {
delete "$projectDir/gradlew.bat", "$projectDir/gradlew"
}
}
vaadin {
nodeVersion = 'v16.15.0'
pnpmEnable = false
nodeAutoUpdate = false
nodeVersion = 'v20.13.1'
pnpmEnable = true
productionMode = true
forceProductionBuild
}
classes {
doLast {
def resourcesDir = sourceSets.main.output.resourcesDir as File
def releaseVersion = System.env.RELEASE_VERSION as String
if (releaseVersion) {
new File(resourcesDir, "version.info").text = releaseVersion
} else {
new File(resourcesDir, "version.info").text = version
}
}
}
springBoot {
mainClass = "ru.iopump.qa.allure.Application"
}

tasks.named("bootJar") {
manifest {
attributes 'Main-Class': 'org.springframework.boot.loader.launch.PropertiesLauncher'
}
}

//// OPENAPI ////

// https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin
// https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators.md
// https://openapi-generator.tech/docs/generators/spring/
openApiGenerate {
generatorName = "spring"
library = "spring-boot"

inputSpec = "$rootDir/src/test/resources/tms/openapi-youtrack.json"
outputDir = "$projectDir/build/generated"

apiPackage = "org.brewcode.api.youtrack"
invokerPackage = "org.brewcode.api.youtrack.invoker"
modelPackage = "org.brewcode.api.youtrack.model"
modelNameSuffix = "Dto"

importMappings = [
SavedQueryDto: "org.brewcode.api.youtrack.model.SavedQueryDto",
]

configOptions = [
useBeanValidation : "false",
useJakartaEe : "true",
serializationLibrary : "jackson",
annotationLibrary : "swagger2",
generatedConstructorWithRequiredArgs: "true",
dateLibrary : "java8",
useSpringBoot3 : "true",
interfaceOnly : "true",
openApiNullable : "false",
useResponseEntity : "false", // Не использовать ResponseEntity<Е>, а сразу вернуть Е
skipDefaultInterface : "true" // Не добавлять в интерфейс default реализацию
]
}

tasks.named("openApiGenerate") {
doLast {
def directory = file("build/generated/src/main/java/org/brewcode/api/youtrack/model")
directory.eachFile {
def pattern = Pattern.compile('Type\\(value = (.+).class')
def matcher = pattern.matcher(it.text)
if (matcher.find())
it.text = matcher.replaceAll { match -> 'Type(value = org.brewcode.api.youtrack.model.%s.class'.formatted(match.group(1)) }

if (it.name == 'BaseBundleDto.java') {
it.text = it.text.readLines().withIndex().findAll { line, index -> index < 72 || index > 98 }.collect { it[0] }.join("\n")
}
}
}
}
}

compileJava.dependsOn tasks.openApiGenerate
compileTestJava.dependsOn tasks.openApiGenerate
sourceSets.main.java.srcDirs += tasks.openApiGenerate

bootJar {
manifest {
attributes 'Main-Class': 'org.springframework.boot.loader.launch.PropertiesLauncher'
}
}
Loading

0 comments on commit f2dc42a

Please sign in to comment.