Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: [CCLS 2153] Integrate with common library #38

Merged
merged 4 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
@@ -44,6 +44,8 @@ jobs:
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
2 changes: 2 additions & 0 deletions .github/workflows/pr-merge-main.yml
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@ jobs:
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
2 changes: 2 additions & 0 deletions .github/workflows/push-branch.yml
Original file line number Diff line number Diff line change
@@ -30,6 +30,8 @@ jobs:
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
37 changes: 1 addition & 36 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@
plugins {
id 'java'
id 'io.spring.dependency-management' version '1.1.5'
id 'net.researchgate.release' version '3.0.2'
id 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin' version '0.0.1' apply false
}

subprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'

group = 'uk.gov.laa.ccms.caab'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(JAVA_VERSION)
}
}

repositories {
mavenCentral()
}

release {
tagTemplate = '$name-$version'
}
}

//used for deploying snapshot packages
task updateSnapshotVersion {
doLast {
def gitHash = "git rev-parse --short HEAD".execute().text.trim()
def propertiesFile = file('gradle.properties')
def properties = new Properties()
properties.load(new FileInputStream(propertiesFile))

def currentVersion = properties.getProperty('version')
def newVersion = currentVersion.replace('-SNAPSHOT', "-${gitHash}-SNAPSHOT")
properties.setProperty('version', newVersion)

properties.store(propertiesFile.newWriter(), null)
}
}
15 changes: 3 additions & 12 deletions caab-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
plugins {
id 'org.openapi.generator' version '7.0.1'
id 'org.springframework.boot' version '3.1.0'
}

apply plugin: "maven-publish"
apply plugin: 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin'

dependencies {

@@ -19,16 +18,6 @@ dependencies {
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url 'https://maven.pkg.github.com/ministryofjustice/laa-ccms-caab-api'
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
@@ -38,6 +27,8 @@ publishing {

sourceSets.main.java.srcDirs += ['generated/src/main/java']

checkstyleMain.exclude "*"

openApiGenerate {
generatorName = "spring"
inputSpec = "$rootDir/caab-api/open-api-specification.yml".toString() // Change this to the location of your OpenAPI specification
58 changes: 1 addition & 57 deletions caab-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,4 @@
plugins {
id 'org.springframework.boot' version '3.2.5'
id 'jacoco'
id 'checkstyle'
}

ext {
checkstyleVersion = '10.12.2'
}

sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
integrationTestImplementation.extendsFrom(testImplementation)
integrationTestRuntimeOnly.extendsFrom(testRuntimeOnly)
}
apply plugin: 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin'

dependencies {
implementation project(':caab-api')
@@ -56,16 +31,7 @@ test {
useJUnitPlatform()
}

task integrationTest(type: Test) {
useJUnitPlatform()
description = "Run integration tests"
group = "verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

jacocoTestReport {
sourceDirectories.from files('build/generated/sources/annotationProcessor/java/main')
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
@@ -74,12 +40,9 @@ jacocoTestReport {
'**/AuditorAwareImpl.class'])
}))
}

dependsOn tasks['test']
}

jacocoTestCoverageVerification {

afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
@@ -88,23 +51,4 @@ jacocoTestCoverageVerification {
'**/AuditorAwareImpl.class'])
}))
}

violationRules {
rule {
limit {
minimum = 0.80 // You can define your required coverage ratio here.
}
}
}

dependsOn tasks['test']
}

checkstyle {
maxWarnings = 0
toolVersion = "${checkstyleVersion}"
sourceSets = [sourceSets.main]
showViolations = true
}


2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
version=0.0.25-SNAPSHOT
group='uk.gov.laa.ccms'

JAVA_VERSION = 21
15 changes: 15 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
pluginManagement {
repositories {
maven {
name = "gitHubPackages"
url uri('https://maven.pkg.github.com/ministryofjustice/laa-ccms-spring-boot-common')
credentials {
username = System.getenv("GITHUB_ACTOR")?.trim() ?: settings.ext.find('project.ext.gitPackageUser')
password = System.getenv("GITHUB_TOKEN")?.trim() ?: settings.ext.find('project.ext.gitPackageKey')
}
}
maven { url "https://plugins.gradle.org/m2/" }
gradlePluginPortal()
}
}

rootProject.name = 'laa-ccms-caab-api'

include 'caab-api'