Skip to content

Commit

Permalink
initial migration from befta repo
Browse files Browse the repository at this point in the history
  • Loading branch information
MSancaktutar committed May 24, 2021
1 parent 0642fc8 commit 980ad37
Show file tree
Hide file tree
Showing 943 changed files with 68,971 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Java CI

on:
pull_request:
branches:
- master
push:
branches:
- master
- refs/tags/*
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build
run: ./gradlew check
- name: Archive test reports
uses: actions/upload-artifact@v2
with:
name: test-reports
path: build/reports/tests/
- name: Release
run: |
echo "Triggering JitPack build"
PACKAGES_URL="https://jitpack.io/com/github/${GITHUB_REPOSITORY}/${GITHUB_REF#refs/tags/}/"
PACKAGES_FILE="packages.txt"
touch ${PACKAGES_FILE}
# Try the URL 6 times before failing
count=1
until [[ $count -gt 6 ]] || grep -q build.log ${PACKAGES_FILE} ; do
echo "Attempt ${count}/6"
STATUS=$(curl -s -o packages.txt -w "%{http_code}" --max-time 900 ${PACKAGES_URL})
let count+=1
if [[ "${STATUS}" -gt 399 ]]; then
sleep 30
fi
done
echo "::group::Files Available"
echo $(cat ${PACKAGES_FILE})
echo "::endgroup::"
if [[ ${STATUS} -gt 399 ]] ; then
echo "FAILURE: ${STATUS} response from JitPack"
exit 1
fi
if: startsWith(github.ref, 'refs/tags')
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 HM Courts & Tribunals Service

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
639 changes: 639 additions & 0 deletions README.md

Large diffs are not rendered by default.

163 changes: 163 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'maven'
}

apply plugin: 'java'

def buildNumber = System.getenv("RELEASE_VERSION")?.replace("refs/tags/", "") ?: "7.0.0-SNAPSHOT"

group 'uk.gov.hmcts.ccd'

version buildNumber

def gitRepo = "https://github.com/hmcts/ccd-test-definitions"

def pomConfig = {
licenses {
license {
name "MIT License"
url "http://www.opensource.org/licenses/mit-license.php"
distribution "repo"
}
}

scm {
url "https://github.com/hmcts/ccd-test-definitions"
}
}

// tag::repositories[]
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url 'https://jitpack.io'
}
}
// end::repositories[]

ext {
junitJupiterVersion = '5.2.0'
junitVintageVersion = '5.2.0'
definitionConverterMain = "uk.gov.hmcts.befta.dse.ccd.DefinitionConverter"
}

jar {
baseName = "ccd-test-definitions"
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
tasks.withType(Test) {
useJUnitPlatform()

testLogging {
exceptionFormat = 'full'
}
}

test {
failFast = true
testLogging.showStandardStreams = true
}

artifacts {
archives sourcesJar
archives javadocJar
}

task definitionsToJson(dependsOn: sourcesJar) {
group = "Execution"
description = "Runs DefinitionConverter for Excel to JSON"

doFirst() {
fileTree("${project.projectDir}/src/main/resources/uk/gov/hmcts/befta/dse/ccd/definitions/excel").matching {
include "*.xlsx"
exclude "~*.xlsx"
}.visit { FileVisitDetails details ->
def name = details.getName()
def inputPath = "${project.projectDir}/src/main/resources/uk/gov/hmcts/befta/dse/ccd/definitions/excel/${name}"
def outputFolderPath = "${project.projectDir}/src/main/resources/uk/gov/hmcts/befta/dse/ccd/definitions/valid/"
def useJurisdictionName = false;

// overrides for BEFTA Master
if (name == 'BEFTA_Master_Definition.xlsx') {
useJurisdictionName = true;
}

logger.quiet("\nConverting ${name} to JSON.\n")

javaexec {
classpath = sourceSets.main.runtimeClasspath
main = definitionConverterMain
args = [
"to-json",
inputPath,
outputFolderPath,
useJurisdictionName
]
}
}
}

outputs.upToDateWhen { false }
}

publishing {
publications {
Main(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId 'ccd-test-definitions'
version project.version

pom.withXml {
def root = asNode()
root.appendNode('description', 'CCD Test Definitions')
root.appendNode('name', 'CCD Test Definitions')
root.appendNode('url', gitRepo)
root.children().last() + pomConfig
}
}
}
}

wrapper.gradleVersion = '2.10'

dependencies {
compile group: 'com.github.hmcts', name: 'befta-fw', version: '7.0.0.4'
}
// end::dependencies[]

task elasticCurlCommands() {
group = "Help"
description = "Displays the curl commands required to delete BEFTA case type indexes from ElasticSearch"
doFirst() {
getCaseTypes().forEach{
println "curl -X DELETE http://localhost:9200/${it.toLowerCase()}_cases-000001"
}
}
}

def getCaseTypes() {
def caseTypes = []
new File("${projectDir}/src/main/resources/uk/gov/hmcts/befta/dse/ccd/definitions/valid/").eachDir {
new File(it.path).eachDir {
if (it.name != 'common') caseTypes << it.name
}
}
// TODO: Hardcode case types which are only available in spreadsheets and add to the list?
return caseTypes
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 980ad37

Please sign in to comment.