Skip to content

Commit

Permalink
Maven multi module #359
Browse files Browse the repository at this point in the history
Two modules: mirror-importer and mirror-api-rest
Updated docs
Update CircleCI
Update deploy script and service name

Tested:
1. ./mvnw package
2. BUCKET=hedera-mainnet-streams docker-compose updocker-compose down

Signed-off-by: Apekshit Sharma <apekshit.sharma@hedera.com>
  • Loading branch information
apeksharma committed Nov 23, 2019
1 parent 55fafb1 commit 4ec2162
Show file tree
Hide file tree
Showing 248 changed files with 400 additions and 310 deletions.
62 changes: 33 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
version: 2

references:
workspace_root: &workspace_root
/tmp/workspace
workspace_root: &workspace_root /tmp/workspace
attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root
package_mirror_node: &package_mirror_node
package_mirror_importer: &package_mirror_importer
run:
name: Generating mirror-node.tgz
name: Generating mirror-importer.tgz
working_directory: /tmp/workspace/
command: |
_tagged_dir=mirror-node-${CIRCLE_TAG:-b$CIRCLE_BUILD_NUM}
mv mirror-node "${_tagged_dir}"
tar -czf /tmp/workspace/mirror-node.tgz "${_tagged_dir}"
_tagged_dir=mirror-importer-${CIRCLE_TAG:-b$CIRCLE_BUILD_NUM}
mv mirror-importer "${_tagged_dir}"
tar -czf /tmp/workspace/mirror-importer.tgz "${_tagged_dir}"
workflows:
version: 2
main:
jobs:
- build_mirror_node:
- build_mirror_importer:
filters: # required since `release_artifacts` has tag filters AND requires `this`
branches:
only: /.*/
Expand All @@ -33,7 +32,7 @@ workflows:
only: /.*/
- release_artifacts:
requires:
- build_mirror_node
- build_mirror_importer
- build_rest_api
filters:
branches:
Expand All @@ -42,7 +41,7 @@ workflows:
only: /^v.*/

jobs:
build_mirror_node:
build_mirror_importer:
docker:
- image: adoptopenjdk:11-jdk-hotspot
- image: postgres:9.6-alpine
Expand All @@ -54,31 +53,32 @@ jobs:
- checkout
- restore_cache:
keys:
- maven-v1-{{ .Branch }}-{{ checksum "pom.xml" }}-{{ checksum "mirror-importer/pom.xml" }}
- maven-v1-{{ .Branch }}-{{ checksum "pom.xml" }}
- maven-v1-{{ .Branch }}
- maven-v1-
- run:
name: Running maven (validate, compile, test, package)
command: ./mvnw package
command: ./mvnw package -pl mirror-importer -am
- save_cache:
key: maven-v1-{{ .Branch }}-{{ checksum "pom.xml" }}
key: maven-v1-{{ .Branch }}-{{ checksum "pom.xml" }}-{{ checksum "mirror-importer/pom.xml" }}
paths:
- ~/.m2
- ~/.m2
- store_test_results:
path: target/surefire-reports
path: mirror-importer/target/surefire-reports
- run:
name: Upload Code Coverage
command: bash <(curl -s https://codecov.io/bash)
- run:
name: Collecting mirror-node assets
name: Collecting mirror-importer assets
command: |
mkdir -p /tmp/workspace/mirror-node/
mv target/mirror-node-*.jar /tmp/workspace/mirror-node/mirror-node.jar
mv scripts /tmp/workspace/mirror-node/
mkdir -p /tmp/workspace/mirror-importer/
mv mirror-importer/target/mirror-importer-*.jar /tmp/workspace/mirror-importer/mirror-importer.jar
mv mirror-importer/scripts /tmp/workspace/mirror-importer/
- persist_to_workspace:
root: *workspace_root
paths:
- mirror-node
- mirror-importer

build_rest_api:
docker:
Expand All @@ -92,30 +92,30 @@ jobs:
- checkout:
- restore_cache:
keys:
- npm-v1-{{ .Branch }}-{{ checksum "rest-api/package-lock.json" }}
- npm-v1-{{ .Branch }}-{{ checksum "mirror-api-rest/rest-api/package-lock.json" }}
- npm-v1-{{ .Branch }}
- npm-v1-
- run:
working_directory: 'rest-api'
working_directory: "mirror-api-rest/rest-api"
name: Run npm ci (ensure node_modules is based on package-lock.json).
command: npm ci
- save_cache:
key: npm-v1-{{ .Branch }}-{{ checksum "rest-api/package-lock.json" }}
key: npm-v1-{{ .Branch }}-{{ checksum "mirror-api-rest/rest-api/package-lock.json" }}
paths:
- node_modules
- .node-flywaydb
- ~/.npm
- run:
working_directory: 'rest-api'
working_directory: "mirror-api-rest/rest-api"
name: Run npm test
command: npm test
environment:
TEST_DB_HOST: '127.0.0.1'
TEST_DB_NAME: 'mirror_node_integration'
TEST_DB_HOST: "127.0.0.1"
TEST_DB_NAME: "mirror_node_integration"
- store_test_results:
path: rest-api/target/jest-junit
path: mirror-api-rest/rest-api/target/jest-junit
- run:
working_directory: 'rest-api'
working_directory: "mirror-api-rest/rest-api"
name: Collecting rest-api assets
command: |
npm pack
Expand All @@ -131,8 +131,12 @@ jobs:
- image: adoptopenjdk:11-jdk-hotspot
steps:
- *attach_workspace
- *package_mirror_node
- *package_mirror_importer
- store_artifacts:
path: /tmp/workspace/mirror-node.tgz
path: /tmp/workspace/mirror-importer.tgz
- store_artifacts:
path: /tmp/workspace/rest-api.tgz

dependencies:
override:
- mvn install -DskipTests
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
*/target/**
.project
/data/
mirror-importer/data/
.classpath
output/
/db/
Expand Down
Loading

0 comments on commit 4ec2162

Please sign in to comment.