Skip to content

Commit

Permalink
Migrated to th2 gradle plugin: 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro committed Apr 30, 2024
1 parent 8525c1a commit 573cf50
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
name: Build and release Java distributions to sonatype.
name: Build and publish dev release Docker image to Github Container Registry ghcr.io and publish dev release jar to sonatype

on:
push:
tags:
- \d+.\d+.\d+-dev
on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Docker'
runsOn: ubuntu-latest
gradleVersion: '7'
docker-username: ${{ github.actor }}
build-target: 'Sonatype,Docker'
devRelease: true
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 19 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish release Docker image to Github Container Registry ghcr.io and publish release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: false
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
24 changes: 24 additions & 0 deletions .github/workflows/build-sanpshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and publish Docker image to Github Container Registry ghcr.io and publish snapshot jar to sonatype

on:
push:
branches-ignore:
- master
- version-*
- dependabot**
paths-ignore:
- README.md

jobs:
build-job:
uses: th2-net/.github/.github/workflows/compound-java-dev.yml@main
with:
build-target: 'Sonatype,Docker'
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 0 additions & 19 deletions .github/workflows/dev-docker-publish.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/docker-publish.yml

This file was deleted.

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Codec v0.4.0
# HTTP Codec v0.5.0

This microservice can encode and decode HTTP messages

Expand Down Expand Up @@ -122,6 +122,15 @@ spec:
# Release notes
## 0.5.0
+ Migrated to th2 gradle plugin: `0.0.6`
+ Updated:
+ bom `4.6.1`
+ common: `5.10.1-dev`
+ common-utils: `2.2.3-dev`
+ codec: `5.5.0-dev`
+ rawhttp-core: `2.6.0`

## 0.4.0

+ th2 transport protocol support
Expand Down
91 changes: 20 additions & 71 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
plugins {
id 'com.palantir.docker' version '0.25.0'
id 'org.jetbrains.kotlin.jvm' version "${kotlin_version}"
id 'application'
id 'org.jetbrains.kotlin.kapt' version "${kotlin_version}"
id "org.owasp.dependencycheck" version "8.2.1"
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
id "org.jetbrains.kotlin.kapt" version "$kotlin_version"
id("java-library")
id("maven-publish")

id "com.exactpro.th2.gradle.publish" version "0.0.6"
id "com.exactpro.th2.gradle.component" version "0.0.6"
}

group = 'com.exactpro.th2'
version = release_version

sourceCompatibility = 11
targetCompatibility = 11
kotlin {
jvmToolchain(11)
}

repositories {
mavenCentral()
Expand All @@ -30,85 +33,31 @@ repositories {
}
}

jar {
manifest {
attributes(
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
'Specification-Title': '',
'Specification-Vendor': 'Exactpro Systems LLC',
'Implementation-Title': project.archivesBaseName,
'Implementation-Vendor': 'Exactpro Systems LLC',
'Implementation-Vendor-Id': 'com.exactpro',
'Implementation-Version': project.version
)
}
}

dependencies {
api platform("com.exactpro.th2:bom:4.5.0")

implementation "com.exactpro.th2:common:5.7.2-dev"
implementation "com.exactpro.th2:common-utils:2.2.2-dev"
implementation "com.exactpro.th2:codec:5.4.1-dev"
implementation "com.exactpro.th2:common:5.10.1-dev"
implementation "com.exactpro.th2:common-utils:2.2.3-dev"
implementation "com.exactpro.th2:codec:5.5.0-th2-gradle-plugin-+"

compileOnly "com.google.auto.service:auto-service:1.1.1"
annotationProcessor "com.google.auto.service:auto-service:1.1.1"
kapt "com.google.auto.service:auto-service:1.1.1"

implementation "io.github.microutils:kotlin-logging:3.0.5"
implementation "com.athaydes.rawhttp:rawhttp-core:2.4.1"
implementation "com.athaydes.rawhttp:rawhttp-core:2.6.0"

testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
testImplementation "org.junit.jupiter:junit-jupiter:5.10.0"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.3.1'
testImplementation 'io.strikt:strikt-core:0.34.1'
}

application {
mainClassName 'com.exactpro.th2.codec.MainKt'
}

applicationName = 'service'

distTar {
archiveName "${applicationName}.tar"
}

dockerPrepare {
dependsOn distTar
}

docker {
copySpec.from(tarTree("$buildDir/distributions/${applicationName}.tar"))
}

compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
mainClass.set("com.exactpro.th2.codec.MainKt")
}

test {
useJUnitPlatform()
}

configurations {
compileClasspath {
resolutionStrategy.activateDependencyLocking()
}
}

dependencyCheck {
formats = ['SARIF', 'JSON', 'HTML']
failBuildOnCVSS = 5
suppressionFile = file('suppressions.xml')
analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kotlin.code.style=official
kotlin_version=1.8.22
release_version=0.4.0
release_version=0.5.0
6 changes: 3 additions & 3 deletions src/test/kotlin/com/exactpro/th2/codec/http/DecodeTest.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 Exactpro (Exactpro Systems Limited)
* Copyright 2020-2024 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -123,7 +123,7 @@ class DecodeTest {
assertEquals(3, decodedBody.size)
assertEquals(200, decodedBody["statusCode"])
assertEquals("OK", decodedBody["reason"])
val decodedHeaders = decodedBody["headers"] as Map<String, String>
val decodedHeaders = decodedBody["headers"] as Map<*, *>
assertEquals(2, decodedHeaders.size)
assertEquals("text/plain", decodedHeaders["Content-Type"])
assertEquals("0", decodedHeaders["Content-Length"])
Expand Down Expand Up @@ -165,7 +165,7 @@ class DecodeTest {
assertEquals("Request", decodedMessage.type)
assertEquals("GET", decodedBody["method"])
assertEquals(URI("http://www.test.com/hello.txt"), decodedBody["uri"])
val decodedHeaders = decodedBody["headers"] as Map<String, String>
val decodedHeaders = decodedBody["headers"] as Map<*, *>
assertEquals(3, decodedHeaders.size)
assertEquals("OpenSSL/0.9.7l", decodedHeaders["User-Agent"])
assertEquals("www.test.com", decodedHeaders["Host"])
Expand Down
6 changes: 6 additions & 0 deletions suppressions.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<suppress base="true">
<notes><![CDATA[FP per issue https://github.com/jeremylong/DependencyCheck/issues/2995]]>
</notes>
<packageUrl regex="true">^pkg:maven/com\.exactpro\.th2/grpc-.*@.*$</packageUrl>
<cpe>cpe:/a:grpc:grpc</cpe>
</suppress>
<suppress>
<notes><![CDATA[FP per issue https://github.com/jeremylong/DependencyCheck/issues/2995]]>
</notes>
Expand Down

0 comments on commit 573cf50

Please sign in to comment.