overmindbots / core

Core monorepo with our apps and packages
1 stars 0 forks source link

Setup instructions

To run locally

Install Lerna

Install dependencies of all packages

Create .env in repos

Install cli tools to access our remote cluster

Google Cloud CLI

Kubectx

Managing the remote cluster

You can also visit Our cluster in the browser

Deploying remote

You should have access to Our CircleCI. You can see how the deployments are doing there

Deploying to local Kubernetes cluster

Setting up local kubernetes (osx)

Installing Helm

Setting Kubernetes Secrets

Local deploy

Usage

Commiting Use yarn commit to trigger the commitizen prompt. A pre-commit hook will ensure that the message is compliant with the conventional-commits standard.

Continuous Delivery and Branching Model

Releases feature is pending since it was causing deployments to fail

Extra notes

Updated dependencies in app-bots-web-panel-web-client. If anything fails, these were the old ones:

"relay-compiler": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/relay-compiler-1.5.0-plugin.3.tgz",
"relay-runtime": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/relay-runtime-1.5.0-plugin.3.tgz",
"babel-plugin-relay": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/babel-plugin-relay-1.5.0-plugin.3.tgz",
"react-relay": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/react-relay-1.5.0-plugin.3.tgz"

Testing

For the sake of simplicity we are going to refer to service/package as S/P.

To add tests to your S/P:

Example jest config file

// jest.config.js
const baseConfig = require('../../jest.base');

module.exports = {
  ...baseConfig,
  // Code to extend base config goes here
};

Conventions

This is a work in progress, but these are the base testing conventions ATM:

See service-bot-manager test folder for further info.

Run tests

To run just your service/package's tests:

If you want to run your tests each time a file changes, remember to add --watch flag to yarn test command.

You can also run your S/P tests from the root by calling:

lerna run --scope @overmindbots/my-service test

If you want to run tests of every service/package on the repo, run this command from the root:

lerna run test

Remember you can also pass scope flag multiple times in order to run one or multiple tests like lerna run --scope @overmindbots/service-bot-manager --scope @overmindbots/bot-* test

Config env vars

IMPORTANT: All the following instructions considers that we are standing on the S/P folder.

You will need to create a .env.test file. Then, we need to create a setupTests.ts file inside your test folder with the following content:

import dotenv from 'dotenv';

dotenv.config();
dotenv.config({ path: '.env.test' });

// You can also mute winston by adding:
// import logger from 'winston';
// logger.remove(logger.transports.Console);

Now that we created our setup file, we need to tell jest to load this setup file before running any test, this will be achieved by adding the setupTestFrameworkScriptFile config.

Example:

const baseConfig = require('../../jest.base');

module.exports = {
  ...baseConfig,
  setupTestFrameworkScriptFile: '<rootDir>/test/setupTests.ts', // <-
};