Skip to content
Snippets Groups Projects

Add lib directory

Merged Clayton, Brandon Scott requested to merge (removed):spotless into master
All threads resolved!
1 file
+ 20
144
Compare changes
  • Side-by-side
  • Inline
+ 20
144
@@ -3,49 +3,20 @@
@@ -3,49 +3,20 @@
####
####
variables:
variables:
BUGS_INDEX: ${CI_PROJECT_DIR}/${ETC_HTDOCS_DIR}/bugs-index.html
DOCS_BUCKET: nshmp-lib.chs.usgs.gov
EC2_LATEST_URL: http://169.254.169.254/latest
ETC_HTDOCS_DIR: etc/ci-cd/htdocs
FAULT_SECTIONS: nshm-fault-sections
FAULT_SECTIONS: nshm-fault-sections
FAULT_SECTIONS_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${FAULT_SECTIONS}.git
FAULT_SECTIONS_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${FAULT_SECTIONS}.git
HTDOCS_CSS: ${CI_PROJECT_DIR}/${ETC_HTDOCS_DIR}/reports.css
HTDOCS_JS: ${CI_PROJECT_DIR}/${ETC_HTDOCS_DIR}/reports.js
JACOCO_HTML_DIR: ${REPORTS_DIR}/jacoco/test/html
JACOCO_HTML_DIR: ${REPORTS_DIR}/jacoco/test/html
JAVADOCS_DIR: build/docs/javadoc
JUNIT_FILES: build/test-results/test/TEST-*.xml
JUNIT_FILES: build/test-results/test/TEST-*.xml
MERGE_REQUEST_DIR: merge-request-docs
MERGE_REQUEST_KEY: merge-requests/${CI_BUILD_REF_NAME}
PROP_REGION: region
REPORTS_DIR: build/reports
REPORTS_DIR: build/reports
REPORTS_INDEX: ${CI_PROJECT_DIR}/${ETC_HTDOCS_DIR}/reports-index.html
SPOTBUGS_REPORTS_DIR: ${REPORTS_DIR}/spotbugs
TEST_REPORTS_DIR: ${REPORTS_DIR}/tests/test
####
####
# Stages for CI-CD pipline
# Stages for CI-CD pipline
####
####
stages:
stages:
- test
- test
- build-javadocs
- reports
- reports
- trigger
- trigger
####
# Setup for AWS CLI.
# Globals:
# (string) EC2_LATEST_URL - URL to get latest info from EC2
# (string) PROP_REGION - The AWS region property
####
.aws-config:
image: python:3
before_script:
- export PATH=${HOME}/.local/bin:${PATH}
- apt-get update
- apt-get install jq -y
- pip3 install awscli --upgrade --user
- export AWS_DEFAULT_REGION=`curl -s ${EC2_LATEST_URL}/dynamic/instance-identity/document | jq .${PROP_REGION} -r`
####
####
# Git clone nshm-fault-sections
# Git clone nshm-fault-sections
####
####
@@ -69,41 +40,6 @@ stages:
@@ -69,41 +40,6 @@ stages:
.gradle:
.gradle:
image: gradle:jdk11
image: gradle:jdk11
####
# Docs script anchor.
# Globals:
# (string) CI_PROJECT_DIR - Path to repo in pipeline
# (string) JACOCO_HTML_DIR - Path to the Jacoco reports
# (string) JAVADOCS_DIR - Path to Java docs
# (string) SPOTBUGS_REPORTS_DIR - Path to Spotbugs reports
# (string) TEST_REPORTS_DIR - Path to test reports
###
.docs:
reports: &get-reports |-
cp ${REPORTS_INDEX} index.html;
cp ${HTDOCS_CSS} .;
cp ${HTDOCS_JS} .;
# Jacoco reports
mkdir coverage;
cd coverage;
cp -r ${CI_PROJECT_DIR}/${JACOCO_HTML_DIR}/* .;
cd ..;
# Test reports
mkdir tests;
cd tests;
cp -r ${CI_PROJECT_DIR}/${TEST_REPORTS_DIR}/* .;
cd ..;
# Spotbugs Reports
mkdir bugs;
cd bugs;
cp -r ${CI_PROJECT_DIR}/${SPOTBUGS_REPORTS_DIR}/* .;
mkdir src test;
mv main.html src/index.html;
mv test.html test/index.html;
cp ${BUGS_INDEX} index.html;
cp ${HTDOCS_CSS} .;
cp ${HTDOCS_JS} .;
####
####
# Build jar file.
# Build jar file.
# Globals:
# Globals:
@@ -115,6 +51,10 @@ Build Project:
@@ -115,6 +51,10 @@ Build Project:
- .gradle
- .gradle
- .tags
- .tags
stage: test
stage: test
 
only:
 
- branches
 
- merge_requests
 
- master@ghsc/nshmp/nshmp-lib
script:
script:
- ./gradlew assemble;
- ./gradlew assemble;
cache:
cache:
@@ -129,6 +69,10 @@ Spotless Check:
@@ -129,6 +69,10 @@ Spotless Check:
- .gradle
- .gradle
- .tags
- .tags
stage: test
stage: test
 
only:
 
- branches
 
- merge_requests
 
- master@ghsc/nshmp/nshmp-lib
script:
script:
- ./gradlew spotlessCheck;
- ./gradlew spotlessCheck;
@@ -140,6 +84,10 @@ Spotbugs Main:
@@ -140,6 +84,10 @@ Spotbugs Main:
- .gradle
- .gradle
- .tags
- .tags
stage: test
stage: test
 
only:
 
- branches
 
- merge_requests
 
- master@ghsc/nshmp/nshmp-lib
script:
script:
- ./gradlew spotbugsMain;
- ./gradlew spotbugsMain;
@@ -151,6 +99,10 @@ Spotbugs Test:
@@ -151,6 +99,10 @@ Spotbugs Test:
- .gradle
- .gradle
- .tags
- .tags
stage: test
stage: test
 
only:
 
- branches
 
- merge_requests
 
- master@ghsc/nshmp/nshmp-lib
script:
script:
- ./gradlew spotbugsTest;
- ./gradlew spotbugsTest;
@@ -167,6 +119,10 @@ Unit Tests:
@@ -167,6 +119,10 @@ Unit Tests:
- .gradle
- .gradle
- .tags
- .tags
stage: test
stage: test
 
only:
 
- branches
 
- merge_requests
 
- master@ghsc/nshmp/nshmp-lib
coverage: '/Total.*?([0-9]{1,3})%/'
coverage: '/Total.*?([0-9]{1,3})%/'
script:
script:
- ./gradlew check;
- ./gradlew check;
@@ -176,83 +132,3 @@ Unit Tests:
@@ -176,83 +132,3 @@ Unit Tests:
- ${REPORTS_DIR}
- ${REPORTS_DIR}
reports:
reports:
junit: ${JUNIT_FILES}
junit: ${JUNIT_FILES}
# ####
# # Build Java docs
# # Globals:
# # (string) CI_PROJECT_NAME - The name of the project
# ####
# Build Javadocs:
# extends:
# - .tags
# - .gradle
# stage: build-javadocs
# only:
# - master@ghsc/nshmp/nshmp-lib
# script:
# - ./gradlew javadoc;
# artifacts:
# paths:
# - ${JAVADOCS_DIR}
# ####
# # Upload documents to S3 bucket static site -
# # http://nshmp-lib.chs.usgs.gov.s3-website-us-west-2.amazonaws.com/
# # Globals:
# # (string) CI_PROJECT_DIR - Path to repo in pipeline
# # (string) CI_PROJECT_NAME - The name of the project
# # (string) DOCS_BUCKET - The S3 bucket to put the docs
# # (string) JACOCO_HTML_DIR - Path to the Jacoco reports
# # (string) JAVADOCS_DIR - Path to Java docs
# ####
# Deploy Docs:
# extends:
# - .aws-config
# - .tags
# stage: reports
# dependencies:
# - Unit Tests
# - Build Javadocs
# only:
# - master@ghsc/nshmp/nshmp-lib
# script:
# # Clean S3 bucket
# - aws s3 rm s3://${DOCS_BUCKET} --recursive;
# - cd ${JAVADOCS_DIR};
# # Get reports
# - mkdir reports;
# - cd reports;
# - *get-reports
# # Move to S3 bucket
# - aws s3 cp ${CI_PROJECT_DIR}/${JAVADOCS_DIR} s3://${DOCS_BUCKET}/ --recursive;
####
# Add branch based reports to s3 at -
# http://nshmp-lib.chs.usgs.gov.s3-website-us-west-2.amazonaws.com/merge-requests/<branch-name>
# Globals:
# (string) CI_PROJECT_DIR - Path to repo in pipeline
# (string) CI_PROJECT_NAME - The name of the project
# (string) DOCS_BUCKET - The S3 bucket to put the docs
# (string) JACOCO_HTML_DIR - Path to the Jacoco reports
# (string) JAVADOCS_DIR - Path to Java docs
# (string) MERGE_REQUEST_DIR - Directory name for branch based reports
# (string) MERGE_REQUEST_KEY - Path for S3 branch based reports
####
Add Branch Based Reports:
extends:
- .aws-config
- .tags
stage: reports
dependencies:
- Unit Tests
only:
- merge_request
script:
- mkdir ${MERGE_REQUEST_DIR};
- cd ${MERGE_REQUEST_DIR};
- *get-reports
- |
aws s3 cp \
${CI_PROJECT_DIR}/${MERGE_REQUEST_DIR} \
s3://${DOCS_BUCKET}/${MERGE_REQUEST_KEY}/ \
--recursive;
Loading