Skip to content

Commit

Permalink
Merge pull request #49 from Lukinhasssss/feature/tests-with-virtual-t…
Browse files Browse the repository at this point in the history
…hreads

Automated PR from feature/tests-with-virtual-threads
  • Loading branch information
Lukinhasssss authored Jun 1, 2024
2 parents ee995fc + 8c78d76 commit 8ddb7f9
Show file tree
Hide file tree
Showing 67 changed files with 879 additions and 962 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AMQP_RABBIT_USERNAME=adm_videos
AMQP_RABBIT_PASSWORD=123456

KEYCLOAK_REALM=codeflix
KEYCLOAK_HOST=http://keycloak-admin-do-catalogo:8443
KEYCLOAK_HOST=http://keycloak.internal:8443

GOOGLE_CLOUD_PROJECT_ID=project-id
GOOGLE_CLOUD_CREDENTIALS=credential
1 change: 0 additions & 1 deletion .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:

test:
name: Gradle Test
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/open-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Open Pull Request

on:
push:
branches:
- 'feature/*'
- 'develop'

jobs:
open_pull_request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Extract branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV

- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: "${{ github.ref }}"
destination_branch: ${{ startsWith(github.ref, 'refs/heads/feature/') && 'develop' || 'main' }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "Automated PR from ${{ env.BRANCH_NAME }}"
pr_body: "New changes to ${{ env.BRANCH_NAME }}. Check the files changed and merge if everything is ok."
pr_label: 'automated-pr'
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To build and run:

# build stage
FROM gradle:8.5-jdk21-alpine AS builder
FROM gradle:8.7-jdk21-alpine AS builder

WORKDIR /app

Expand All @@ -12,16 +12,18 @@ RUN gradle bootJar
# build runtime
FROM eclipse-temurin:21-jre-alpine

# Install curl
RUN apk add --no-cache curl

ARG JAR_FILE=/app/build/libs/app*.jar

COPY --from=builder $JAR_FILE /app.jar

# Download do OpenTelemetry Java Agent
#RUN wget -O /opentelemetry-javaagent.jar https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.31.0/opentelemetry-javaagent.jar
RUN wget -O /opentelemetry-javaagent.jar https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
RUN wget -O /opentelemetry-javaagent.jar https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.4.0/opentelemetry-javaagent.jar

# Download do Elastic APM Java Agent
#RUN wget -O /apm-agent.jar https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.46.0/elastic-apm-agent-1.46.0.jar
#RUN wget -O /apm-agent.jar https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.49.0/elastic-apm-agent-1.49.0.jar
COPY --from=docker.elastic.co/observability/apm-agent-java:latest /usr/agent/elastic-apm-agent.jar /apm-agent.jar

RUN addgroup -S spring && adduser -S spring -G spring
Expand All @@ -31,11 +33,13 @@ ENTRYPOINT [ "java", \
"-javaagent:/apm-agent.jar", \
"-Delastic.apm.service_name=admin-do-catalogo", \
"-Delastic.apm.server_url=http://apm-codeflix:8200", \
"-Delastic.apm.environment=codeflix", \
"-Delastic.apm.application_packages=com.lukinhasssss", \
"-Delastic.apm.capture_body=all", \
"-Delastic.apm.environment=codeflix", \
"-javaagent:/opentelemetry-javaagent.jar", \
"-Dotel.service.name=admin-do-catalogo", \
"-Dotel.exporter.otlp.endpoint=http://otel-collector-codeflix:4318", \
"-Dotel.exporter.otlp.protocol=http/protobuf", \
"-Dotel.exporter.otlp.endpoint=http://jaeger-codeflix:4318", \
"-Dotel.trace.exporter=zipkin", \
"-Dotel.trace.exporter.zipkin.endpoint=http://jaeger-codeflix:9411/api/v2/spans", \
"-jar", "/app.jar" \
]
31 changes: 31 additions & 0 deletions application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@ dependencies {
testImplementation("io.mockk:mockk:1.13.4")
}

// Define version for plugins with vulnerabilities
configurations.all {
resolutionStrategy {
// failOnVersionConflict()

eachDependency {
if (requested.name == "kotlin-reflect") {
useVersion(Version.KOTLIN)
}
if (requested.name == "kotlin-stdlib") {
useVersion(Version.KOTLIN)
}
if (requested.name == "kotlin-stdlib-jdk7") {
useVersion(Version.KOTLIN)
}
if (requested.name == "kotlin-stdlib-jdk8") {
useVersion(Version.KOTLIN)
}
if (requested.name == "kotlin-stdlib-common") {
useVersion(Version.KOTLIN)
}
if (requested.name.startsWith("junit-jupiter")) {
useVersion("5.9.2")
}
if (requested.name == "slf4j-api") {
useVersion("2.0.5")
}
}
}
}

tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
Expand Down
89 changes: 16 additions & 73 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ repositories {
mavenCentral()
}

// Define version for plugins with vulnerabilities
configurations.all {
resolutionStrategy {
// failOnVersionConflict()

eachDependency {
if (requested.name == "kotlin-reflect") {
useVersion(Version.KOTLIN)
}
if (requested.name == "kotlin-stdlib-jdk7") {
useVersion(Version.KOTLIN)
}
}
}
}

// START OF DETEKT AND KTLINT CONFIGURATION
detekt {
toolVersion = Version.DETEKT
Expand Down Expand Up @@ -77,76 +93,3 @@ subprojects {
}
}
}
// END OF SONAR MULTI-MODULE CONFIGURATION

/*** SOMENTE PARA APRENDIZADO ***/

// START OF JACOCO MULTI-PROJECT CONFIGURATION
// tasks.register<JacocoReport>("codeCoverageReport") {
// subprojects {
// this@subprojects.plugins.withType<JacocoPlugin>().configureEach {
// this@subprojects.tasks.matching {
// it.extensions.findByType<JacocoTaskExtension>() != null
// }.configureEach {
// sourceSets(this@subprojects.the<SourceSetContainer>().named("main").get())
// executionData(this)
// }
// }
// }
//
// reports {
// xml.required.set(true)
// html.required.set(true)
// }
// }
// END OF JACOCO MULTI-PROJECT CONFIGURATION

// tasks.withType<KotlinCompile> {
// kotlinOptions {
// useK2 = false
// javaParameters = true
// jvmTarget = JavaVersion.VERSION_17.toString()
// freeCompilerArgs = listOf("-Xjsr305=strict")
// }
// }
//
// tasks.withType<Test> {
// useJUnitPlatform()
// }
//
// jacoco {
// toolVersion = "0.8.8"
// }
//
// tasks.register<Test>("unitTests") {
// description = "Runs unit tests"
// group = "verification"
//
// useJUnitPlatform {
// includeTags("unitTest")
// }
//
// shouldRunAfter(tasks.test)
// }
//
// tasks.register<Test>("integrationTests") {
// description = "Runs integration tests"
// group = "verification"
//
// useJUnitPlatform {
// includeTags("integrationTest")
// }
//
// shouldRunAfter(tasks.test)
// }
//
// tasks.register<Test>("e2eTests") {
// description = "Runs e2e tests"
// group = "verification"
//
// useJUnitPlatform {
// includeTags("e2eTest")
// }
//
// shouldRunAfter(tasks.test)
// }
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
object Version {
const val PROJECT = "1.0.0"
const val KOTLIN = "1.9.21"
const val DETEKT = "1.23.4"
const val KOTLIN = "1.9.23"
const val DETEKT = "1.23.6"
const val KTLINT = "11.3.1"
const val JACOCO = "0.8.10"
const val FLYWAY = "9.18.0"
const val FLYWAY = "10.13.0"
const val SONARQUBE = "4.0.0.2929"
const val SPRING_BOOT = "3.2.1"
const val SPRING_DEPENDENCY_MANAGEMENT = "1.1.0"
const val TEST_CONTAINERS = "1.19.3"
const val SPRING_BOOT = "3.3.0"
const val SPRING_DEPENDENCY_MANAGEMENT = "1.1.4"
const val TEST_CONTAINERS = "1.19.7"
const val VAVR = "0.10.2"
const val GATLING = "3.9.3.1"
}
Loading

0 comments on commit 8ddb7f9

Please sign in to comment.