Image for post
Image for post

You have an Express application with DynamoDB database and want to set up continuous integration and deployment? This article for you.

Setting up a testing environment

example of development env vars

Since AWS SDK has a global config object before any interaction with the database I should run AWS config code. It will specify credentials and point out that I want to use local DynamoDB rather than a remote one in a testing environment.

Before tests start I launch local dynamoDB database and create tables. When all tests are done I delete tables. In order to run these functions, I need to specify paths to them in package.json. According to Jest documentation, both functions should return a promise.

jest setting in a package.json
function that will run before all tests
function that will run after all tests

Update

https://gist.github.com/RodionChachura/6f1f8e5912863b6bc7ddb3abfd94ba61

CI/CD

the first version of pipelines

In order to optimize pipelines execution time, I decided to make Docker image with required packages.

Dockerfile for image

I was lazy to download and configure docker on a local machine. But there is a nice service on the Google cloud platform — Container Registry.

new pipelines

If you interested in making migrations in dynamoDB, take a look at this article.

Reach the next level of focus and productivity with increaser.org.

Image for post
Image for post
Increaser

Written by

Software engineer, creator of increaser.org. More at geekrodion.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store