diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd7ca272726850ef97e9d41a835f1f8ef8d5b007..c74102a9839021f8f3ffd0c3eead36d0e7b93347 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,12 @@ variables: JUNIT_FILES: build/test-results/test/TEST-*.xml REPORTS_DIR: build/reports + # TODO remove once nshmp-lib is stable + FAULT_SECTIONS: nshm-fault-sections + FAULT_SECTIONS_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${FAULT_SECTIONS}.git + NSHMP_LIB: nshmp-lib + NSHMP_LIB_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${NSHMP_LIB}.git + stages: - test - publish @@ -29,6 +35,18 @@ stages: # - adjust-image-names: Update container image names #### .templates: + # TODO remove once nshmp-lib is stable + nshmp-lib: &nshmp-lib |- + cd ..; + rm -rf ${NSHMP_LIB}; + git clone ${NSHMP_LIB_GIT}; + cd ${CI_PROJECT_NAME}; + # TODO remove once nshmp-lib is stable + fault-sections: &fault-sections |- + cd ..; + rm -rf ${FAULT_SECTIONS}; + git clone ${FAULT_SECTIONS_GIT}; + cd ${CI_PROJECT_NAME}; adjust-image-names: &adjust-image-names |- IMAGE_NAME=${IMAGE_NAME/:master/:latest}; INTERNAL_IMAGE_NAME=${CI_REGISTRY_IMAGE}/${IMAGE_NAME}; @@ -92,6 +110,9 @@ Build Project: - branches - master@ghsc/nshmp/nshmp-ws - tags@ghsc/nshmp/nshmp-ws + before_script: + - *nshmp-lib + - *fault-sections script: - ./gradlew assemble @@ -106,6 +127,9 @@ Spotless Check: - branches - master@ghsc/nshmp/nshmp-ws - tags@ghsc/nshmp/nshmp-ws + before_script: + - *nshmp-lib + - *fault-sections script: - ./gradlew spotlessCheck; @@ -120,6 +144,9 @@ Spotbugs Main: - branches - master@ghsc/nshmp/nshmp-ws - tags@ghsc/nshmp/nshmp-ws + before_script: + - *nshmp-lib + - *fault-sections script: - ./gradlew spotbugsMain; @@ -134,6 +161,9 @@ Spotbugs Test: - branches - master@ghsc/nshmp/nshmp-ws - tags@ghsc/nshmp/nshmp-ws + before_script: + - *nshmp-lib + - *fault-sections script: - ./gradlew spotbugsTest; @@ -154,6 +184,9 @@ Unit Tests: - tags@ghsc/nshmp/nshmp-ws coverage: '/Total.*?([0-9]{1,3})%/' retry: 2 + before_script: + - *nshmp-lib + - *fault-sections script: - ./gradlew check; - cat ${JACOCO_HTML_DIR}/index.html; @@ -182,6 +215,10 @@ Build Image: - *adjust-image-names - rm -rf ${DOCKER_DIR} - apk add git; + - *nshmp-lib + - mv ../${NSHMP_LIB} . + - *fault-sections + - mv ../${FAULT_SECTIONS} . script: - mkdir ${DOCKER_DIR} - | diff --git a/Dockerfile b/Dockerfile index 675f527068482742591338d4a026b978972bb499..3dc5d148ef350c1e37ef3976e1faf2c2b1267b46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,13 @@ WORKDIR ${builder_workdir} COPY . . -RUN yum install -y java-11-openjdk which git \ - && ./gradlew --no-daemon assemble \ +RUN yum install -y java-11-openjdk which git + +# TODO remove once nshmp-lib is stable +RUN mv nshmp-lib ../. \ + && mv nshm-fault-sections /app/faults + +RUN ./gradlew --no-daemon assemble \ && mv ${libs_dir}/*-all.jar ${jar_file} #### diff --git a/README.md b/README.md index d4ee7888e13994ac9c694c54e33ab54879935b45..85a48380f695804c6f153763c2b97df3f44a3ad4 100644 --- a/README.md +++ b/README.md @@ -95,3 +95,23 @@ http://localhost:8080/nshmp/data/fault-sections ``` The `PORT` should be replaced with the same value to start the container. + +## Local Development +The [fault sections repository](https://code.usgs.gov/ghsc/nshmp/nshm-fault-sections) +repository is downloaded from a tagged version, see [gradle.properties](gradle.properties) +`nshmFaultSectionsTag` for tagged version used, and stored in the libs directory. + +To, instead, point to a local version of the fault sections repository update the +gradle.properties file, either in this project or under `$GRADLE_USER_HOME`/gradle.properties +(defaults to `$USER_HOME/.gradle`), with the following: +``` +faultSectionsEnv = DEV +``` + +Run `./gradlew clean` to clean up the libs directory and make a symbolinc link from the +fault sections repository to the libs directory. +Example: +``` +cd libs +ln -s ../nshm-fault-sections . +``` diff --git a/build.gradle b/build.gradle index fe9072d446607e7cce2d3ed9887cba5d92d0b523..922f1205bf4c44dfa5ae28a39166d236ae840694 100644 --- a/build.gradle +++ b/build.gradle @@ -19,15 +19,17 @@ repositories { jcenter() } -git { - implementation("https://code.usgs.gov/ghsc/nshmp/nshmp-lib.git", { - name "nshmp-ws-dep--nshmp-lib" - tag "v0.0.5" - }) -} +// TODO uncomment once nshmp-lib is stable +// git { +// implementation("https://code.usgs.gov/ghsc/nshmp/nshmp-lib.git", { +// name "nshmp-ws-dep--nshmp-lib" +// tag "v0.0.5" +// }) +// } ext { - nshmpLib = "libs/nshmp-ws-dep--nshmp-lib" + // nshmpLib = "libs/nshmp-ws-dep--nshmp-lib" + nshmpLib = "../nshmp-lib" nshmpLibGradleDir = "${nshmpLib}/gradle" spotbugsDir = "${nshmpLib}/gradle" spotlessDir = "${nshmpLib}/src/main/resources" @@ -38,6 +40,9 @@ apply from: "${nshmpLibGradleDir}/spotbugs.gradle" apply from: "${nshmpLibGradleDir}/spotless.gradle" dependencies { + // TODO remove once nshmp-lib is stable + implementation project(":nshmp-lib") + // Micronaut annotationProcessor platform("io.micronaut:micronaut-bom:${mnVersion}") annotationProcessor "io.micronaut:micronaut-inject-java" diff --git a/settings.gradle b/settings.gradle index 57fdf42952195e157b90391b8aa6b252c5803084..01a37ca85228cfab957ae064f9426614e88ff3c2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,18 +1,24 @@ -plugins { - id "com.alexvasilkov.git-dependencies" version "2.0.1" -} +// TODO uncomment once nshmp-lib is stable +// plugins { +// id "com.alexvasilkov.git-dependencies" version "2.0.1" +// } rootProject.name = "nshmp-ws" +// TODO remove once nshmp-lib is stable +include ':nshmp-lib' +project(':nshmp-lib').projectDir = new File(settingsDir, '../nshmp-lib') -def fetchFaults = properties.containsKey("faultSectionsEnv") && faultSectionsEnv == "DEV" - ? false : true -git { - defaultAuthGroup "nshmp" +// TODO uncomment once nshmp-lib is stable +// def fetchFaults = properties.containsKey("faultSectionsEnv") && faultSectionsEnv == "DEV" +// ? false : true - if (fetchFaults) { - fetch ("https://code.usgs.gov/ghsc/nshmp/nshm-fault-sections.git", { - tag nshmFaultSectionsTag - }) - } -} +// git { +// defaultAuthGroup "nshmp" + +// if (fetchFaults) { +// fetch ("https://code.usgs.gov/ghsc/nshmp/nshm-fault-sections.git", { +// tag nshmFaultSectionsTag +// }) +// } +// }