diff --git a/.dockerignore b/.dockerignore index 59ae73b..9ec3f9d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,6 @@ node_modules/ .helm/ .github/ -build/ .idea/ .gradle/ -tmp/ \ No newline at end of file +tmp/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a77d1fb --- /dev/null +++ b/.editorconfig @@ -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 \ No newline at end of file diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 77ca788..5c023f2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -3,7 +3,8 @@ name: Build / Test / Check on: [push, pull_request] env: - NODE_VERSION: 12.x + NODE_VERSION: 20.13.1 + GRADLE_VERSION: 8.8 jobs: build: @@ -11,19 +12,18 @@ jobs: 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: 'corretto' - 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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 273a529..940e6f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,36 +9,50 @@ 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: 'corretto' - 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: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 env: + RELEASE_VERSION: ${{ env.RELEASE_VERSION }} ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + with: + platforms: linux/amd64,linux/arm64 + 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 @@ -64,14 +78,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 diff --git a/.gitignore b/.gitignore index 12a1ae2..1db0c4d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /.gradle /.idea -**/wrapper/gradle-wrapper.jar /build /keys /allure @@ -14,7 +13,6 @@ webpack.config.js webpack.generated.js # Gradle -gradlew gradlew.bat # Compiled class file @@ -30,7 +28,6 @@ gradlew.bat .mtj.tmp/ # Package Files # -*.jar *.war *.nar *.ear @@ -52,4 +49,8 @@ allure-server-store/ tmp/ pg-secret.yaml -CA.pem \ No newline at end of file +CA.pem + +**/generated/** +*generated* +*-private* diff --git a/.helm/allure-server/values.yaml b/.helm/allure-server/values.yaml index 482b2f8..20bc44c 100644 --- a/.helm/allure-server/values.yaml +++ b/.helm/allure-server/values.yaml @@ -4,7 +4,7 @@ image: repository: kochetkovma/allure-server pullPolicy: IfNotPresent ## Don't use 'latest' ;) - tag: 2.12.0 + tag: 2.13.4 ## Add 'key: value collection' and delete '{ }' if need ## Uncomment and remove '{ }' if need diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs deleted file mode 100644 index af00669..0000000 --- a/.pnpmfile.cjs +++ /dev/null @@ -1,42 +0,0 @@ -/** - * NOTICE: this is an auto-generated file - * - * This file has been generated for `pnpm install` task. - * It is used to pin client side dependencies. - * This file will be overwritten on every run. - */ - -const fs = require('fs'); - -const versionsFile = require('path').resolve(__dirname, 'build/frontend/versions.json'); - -if (!fs.existsSync(versionsFile)) { - return; -} -const versions = JSON.parse(fs.readFileSync(versionsFile, 'utf-8')); - -module.exports = { - hooks: { - readPackage - } -}; - -function readPackage(pkg) { - const { dependencies } = pkg; - - if (dependencies) { - for (let k in versions) { - if (dependencies[k] && dependencies[k] !== versions[k]) { - pkg.dependencies[k] = versions[k]; - } - } - } - - // Forcing chokidar version for now until new babel version is available - // check out https://github.com/babel/babel/issues/11488 - if (pkg.dependencies.chokidar) { - pkg.dependencies.chokidar = '^3.4.0'; - } - - return pkg; -} diff --git a/Dockerfile b/Dockerfile index d5af8ac..b15dad8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 amazoncorretto:21-alpine +COPY build/libs/*.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"] \ No newline at end of file +ENTRYPOINT ["java", "-Dloader.path=/ext", "-jar", "allure-server-docker.jar", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE:default}"] diff --git a/README.md b/README.md index 9a2441b..ad314ec 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.gradle b/build.gradle index f0cae98..e5b89d8 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -33,20 +29,22 @@ 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 { @@ -54,6 +52,84 @@ classes { 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") + } } } -} \ No newline at end of file +} + +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' + } +} + +wrapper { + gradleVersion = '8.8' + distributionType = Wrapper.DistributionType.ALL +} diff --git a/docker-compose-h2.yml b/docker-compose-h2.yml index bb9754a..e7081a7 100644 --- a/docker-compose-h2.yml +++ b/docker-compose-h2.yml @@ -3,11 +3,11 @@ services: allure-server: # For local debug # # build: . - image: kochetkovma/allure-server:2.12.0 + image: kochetkovma/allure-server:2.13.5 ports: - 8080:8080 volumes: - ./tmp/allure:/allure/:rw environment: SPRING_PROFILES_ACTIVE: oauth - # BASIC_AUTH_ENABLE: true \ No newline at end of file + # BASIC_AUTH_ENABLE: true diff --git a/docker-compose.yml b/docker-compose.yml index 96fc36a..04c0bd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: allure-server: # For local debug # # build: . - image: kochetkovma/allure-server:2.12.0 + image: kochetkovma/allure-server:2.13.5 environment: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/allure SPRING_DATASOURCE_USERNAME: postgres @@ -26,4 +26,4 @@ services: POSTGRES_USER: postgres POSTGRES_DB: allure ports: - - 5432:5432 \ No newline at end of file + - 5432:5432 diff --git a/frontend/brands.js b/frontend/brands.js deleted file mode 100644 index c59fd34..0000000 --- a/frontend/brands.js +++ /dev/null @@ -1,25 +0,0 @@ -import '@polymer/iron-icon/iron-icon.js'; -import '@polymer/iron-iconset-svg/iron-iconset-svg.js'; - -import {html} from '@polymer/polymer/lib/utils/html-tag.js'; - -const template = html` - - - - - - - - - - - - - -`; - -document.head.appendChild(template.content); \ No newline at end of file diff --git a/frontend/generated/index.ts b/frontend/generated/index.ts deleted file mode 100644 index 0c1182f..0000000 --- a/frontend/generated/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -/****************************************************************************** - * This file is auto-generated by Vaadin. - * If you want to customize the entry point, you can copy this file or create - * your own `index.ts` in your frontend directory. - * By default, the `index.ts` file should be in `./frontend/` folder. - * - * NOTE: - * - You need to restart the dev-server after adding the new `index.ts` file. - * After that, all modifications to `index.ts` are recompiled automatically. - * - `index.js` is also supported if you don't want to use TypeScript. - ******************************************************************************/ - -// import Vaadin client-router to handle client-side and server-side navigation -import { Router } from '@vaadin/router'; - -// import Flow module to enable navigation to Vaadin server-side views -import { Flow } from '@vaadin/flow-frontend/Flow'; - -const { serverSideRoutes } = new Flow({ - imports: () => import('../../build/frontend/generated-flow-imports') -}); - -const routes = [ - // for client-side, place routes below (more info https://vaadin.com/docs/v15/flow/typescript/creating-routes.html) - - // for server-side, the next magic line sends all unmatched routes: - ...serverSideRoutes // IMPORTANT: this must be the last entry in the array -]; - -// Vaadin router needs an outlet in the index.html page to display views -const router = new Router(document.querySelector('#outlet')); -router.setRoutes(routes); diff --git a/frontend/generated/vaadin-featureflags.ts b/frontend/generated/vaadin-featureflags.ts deleted file mode 100644 index 0f81f16..0000000 --- a/frontend/generated/vaadin-featureflags.ts +++ /dev/null @@ -1,10 +0,0 @@ -// @ts-nocheck -window.Vaadin = window.Vaadin || {}; -window.Vaadin.featureFlags = window.Vaadin.featureFlags || {}; -window.Vaadin.featureFlags.exampleFeatureFlag = false; -window.Vaadin.featureFlags.viteForFrontendBuild = false; -window.Vaadin.featureFlags.mapComponent = false; -window.Vaadin.featureFlags.spreadsheetComponent = false; -window.Vaadin.featureFlags.hillaPush = false; -window.Vaadin.featureFlags.newLicenseChecker = false; -window.Vaadin.featureFlags.collaborationEngineBackend = false; \ No newline at end of file diff --git a/frontend/generated/vaadin.ts b/frontend/generated/vaadin.ts deleted file mode 100644 index fa8c0b6..0000000 --- a/frontend/generated/vaadin.ts +++ /dev/null @@ -1,3 +0,0 @@ -import './vaadin-featureflags.ts'; - -import './index'; diff --git a/frontend/index.html b/frontend/index.html index c7bb9d8..d36e593 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,10 +3,10 @@ This file is auto-generated by Vaadin. --> - + - - + +