Skip to content

Commit

Permalink
REFACTOR + FURTHER TESTING
Browse files Browse the repository at this point in the history
  • Loading branch information
wlodarcp committed Aug 19, 2021
1 parent 0688374 commit 3bb4147
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 100 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
#if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -58,23 +58,23 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build judge-d-server docker image
run: ./gradlew judge-d-server:docker
- name: Push judge-d docker image to DockerHub
run: docker push hltech/judge-d
- name: Push to heroku registry
run: |
docker login -u _ -p $HEROKU_API_KEY registry.heroku.com
docker tag hltech/judge-d registry.heroku.com/judge-d/web
docker push registry.heroku.com/judge-d/web
env:
HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}}
- name: Release judge-d on Heroku
run: |
heroku container:login
heroku container:release web -a $HEROKU_APP_NAME
env:
HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}}
HEROKU_APP_NAME : "judge-d"
# - name: Push judge-d docker image to DockerHub
# run: docker push hltech/judge-d
# - name: Push to heroku registry
# run: |
# docker login -u _ -p $HEROKU_API_KEY registry.heroku.com
# docker tag hltech/judge-d registry.heroku.com/judge-d/web
# docker push registry.heroku.com/judge-d/web
# env:
# HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}}
# - name: Release judge-d on Heroku
# run: |
# heroku container:login
# heroku container:release web -a $HEROKU_APP_NAME
# env:
# HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}}
# HEROKU_APP_NAME : "judge-d"
- name: Build docker image for agent
run: ./gradlew judge-d-agent:docker
- name: Publish judge-d-agent docker image to DockerHub
run: docker push hltech/judge-d-agent
# - name: Publish judge-d-agent docker image to DockerHub
# run: docker push hltech/judge-d-agent
98 changes: 21 additions & 77 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,59 @@ buildscript {
lombokVersion = '1.18.20'
feignVersion = '11.6'
vauntVersion = '1.0.28'
awaitilityVersion = '4.1.0'
testContainersVersion = '1.16.0'
restAssuredVersion = '4.4.0'
jdbcVersion = '5.3.9'
liquidbaseVersion = '4.4.1'
openApiVersion = '1.5.9'
requestValidatorPactVersion = '2.19.4'
postgresVersion = '42.2.23'
h2Version = '1.4.200'
spockVersion = '2.0-groovy-3.0'
groovyVersion = '3.0.8'
archutnitVersion = '0.20.1'
kubernetesClientVersion = '3.2.0'
httpClientVersion = '4.5.13'
consulApiVersion = '1.4.5'
cglibVersion = '3.3.0'
pactGenVersion = '1.4.0'
kubernetesServerMockVersion = '3.2.0'
coverallsVersion = '2.12.0'
palantirDockerVersion = '0.27.0'
grgitVersion = '4.1.0'
}
}

plugins {
id 'java'
id 'idea'
id 'application'
id 'jacoco'
id 'maven-publish'
id 'groovy'
id 'jacoco'
id 'application'
id 'org.springframework.boot' version "${springBootVersion}"
id 'com.github.kt3k.coveralls' version '2.12.0'
id "com.palantir.docker" version "0.27.0"
id 'org.ajoberstar.grgit' version '4.1.0'
id 'com.github.kt3k.coveralls' version "${coverallsVersion}"
id "com.palantir.docker" version "${palantirDockerVersion}"
id 'org.ajoberstar.grgit' version "${grgitVersion}"
}

repositories(repos)
allprojects {
repositories(repos)

group = 'com.hltech.judged'
version = buildVersion()

jacoco {
toolVersion = "0.8.6"
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'groovy'
apply plugin: 'com.palantir.docker'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'io.spring.dependency-management'
apply plugin: "com.palantir.docker"
apply plugin: 'org.ajoberstar.grgit'

group = 'com.hltech.judged'
version = buildVersion()
apply from: '../gradle/test.gradle'
apply from: '../gradle/docker.gradle'

compileJava {
options.release = 11
}

repositories(repos)

dependencies {
implementation platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")

Expand All @@ -77,51 +74,6 @@ subprojects {

compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"

testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.spockframework:spock-core:${spockVersion}"
testImplementation "org.spockframework:spock-spring:${spockVersion}"
testImplementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
testImplementation "org.springframework.cloud:spring-cloud-contract-wiremock:${springCloudVersion}"
}

docker {
name "hltech/${project.name}"
tags "${project.version}", 'latest'
dockerfile file('src/main/docker/Dockerfile')
files jar.archiveFile, 'src/main/docker/entrypoint.sh'
buildArgs(['JAR_FILE': "${jar.archiveFileName}"])
pull true
noCache true
}

jacoco {
toolVersion = "0.8.6"
}

sourceSets {
test.groovy.srcDirs(
"src/test/unit",
"src/test/integration",
"src/test/functional"
)
}

idea {
module {
test
}
}

test {
useJUnitPlatform()
}

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
}

Expand All @@ -142,16 +94,9 @@ coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/codeCoverageReport/codeCoverageReport.xml"
}

jacoco {
toolVersion = "0.8.6"
}

task codeCoverageReport(type: JacocoReport) {

// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")

// Add all relevant sourcesets from the subprojects
subprojects.each {
sourceSets it.sourceSets.main
}
Expand All @@ -163,7 +108,6 @@ task codeCoverageReport(type: JacocoReport) {
}
}

// always run the tests before generating the report
codeCoverageReport.dependsOn {
subprojects*.test
}
Expand Down
9 changes: 9 additions & 0 deletions gradle/docker.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
docker {
name "hltech/${project.name}:${project.version}"
tag 'latest', "hltech/${project.name}:latest"
dockerfile file('src/main/docker/Dockerfile')
files jar.archiveFile, 'src/main/docker/entrypoint.sh'
buildArgs(['JAR_FILE': "${jar.archiveFileName}"])
pull true
noCache true
}
51 changes: 51 additions & 0 deletions gradle/test.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
buildscript {
ext {
repos = {
gradlePluginPortal()
mavenCentral()
}
awaitilityVersion = '4.1.0'
testContainersVersion = '1.16.0'
restAssuredVersion = '4.4.0'
h2Version = '1.4.200'
spockVersion = '2.0-groovy-3.0'
groovyVersion = '3.0.8'
archutnitVersion = '0.20.1'
cglibVersion = '3.3.0'
pactGenVersion = '1.4.0'
kubernetesServerMockVersion = '3.2.0'
}
}

dependencies {
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.spockframework:spock-core:${spockVersion}"
testImplementation "org.spockframework:spock-spring:${spockVersion}"
testImplementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
testImplementation "org.springframework.cloud:spring-cloud-contract-wiremock:${springCloudVersion}"
}

sourceSets {
test.groovy.srcDirs(
"src/test/unit",
"src/test/integration",
"src/test/functional"
)
}

idea {
module {
test
}
}

test {
useJUnitPlatform()
}

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Aug 07 23:22:36 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand Down
2 changes: 1 addition & 1 deletion judge-d-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies {
implementation "org.springframework.cloud:spring-cloud-openfeign-core:${springCloudVersion}"
implementation "org.springframework.cloud:spring-cloud-commons:${springCloudVersion}"

implementation "io.fabric8:kubernetes-client:${kubernetesServerMockVersion}"
implementation "io.fabric8:kubernetes-client:${kubernetesClientVersion}"
implementation "org.apache.httpcomponents:httpclient:${httpClientVersion}"
implementation "com.ecwid.consul:consul-api:${consulApiVersion}"

Expand Down

0 comments on commit 3bb4147

Please sign in to comment.