Set up develop branch build and test locally
In this tutorial, we are going to setup the develop branch build and test for networknt GitHub organization on github.com on my MacBook Pro laptop. The configuration is designed for networknt projects and light-examples-4j demo applications; however, it is straightforward enough to customize the develop-build.yml to make it for your Java modules and microservices. If you want to learn how to use it with your microservices, please refer to microservices develop
Preparation
To build all projects we need to have the following installed on your local.
- Java JDK 11 - JDK to compile Java source code
- Maven 3.5.X - light-4j frameworks are built with Maven
- Git - Clone source code from github.com
- Docker - Running some of the dependencies for end-to-end testing
To perform integration test and end-to-end test, we need to have the following Docker containers up and running.
- Kafka 1.0.0 - used by light-eventuate-4j, light-tram-4j and light-saga-4j
- Zookeeper - used by Kafka
- Mysql - used by light-eventuate-4j, light-tram-4j, light-saga-4j and some examples
- Redis - used by light-session-4j for distributed session
- cdcserver - for light-tram-4j and examples
- cdcserver - for light-eventuate-4j and examples
It is straightforward to start all services with a docker-compose in the light-docker repo. However, we need to setup DOCKER_HOST_IP environment variable on a MacBook Pro or a Linux Desktop first by following this tutorial
Let’s assume we have a workspace called networknt under your user home directory. And we are in the same terminal that has set up the DOCKER_HOST_IP export.
cd ~/networknt
git clone https://github.com/networknt/light-docker.git
cd light-docker
docker-compose -f docker-compose-integration-test.yml up -d
Depending on how fast your computer is and if you have all the docker images cached locally, it might take about 30 seconds to 5 minutes to get everything started.
Clone and build light-bot
Now we can clone and build light-bot repository based on the build light-bot tutorial.
Run the develop branch build with default config
cd ~/networknt/light-bot/bot-cli/build/libs
java -jar bot-cli-fat-1.0.jar -t develop-build
If the build failed, you can check bot.log in the same directory as default email server is not set up with a correct password, there would be no email will be sent out if build or test is failed.
Run the develop branch build with customized config
** Note that customized config contains tokenization service which is located in a private git server and it is not open source. If you don’t have access and still want try it out, please comment tokenization from each step in the develop-build.yml file. **
cd ~/networknt
git clone https://github.com/networknt/light-config-test.git
cd light-config-test/light-bot/develop-build/build-test-all
./run.sh