From e1fbca73a2017be90dd0c9ba74555307e5fb0e22 Mon Sep 17 00:00:00 2001 From: William Calderipe Date: Fri, 5 Jan 2024 10:16:54 +0100 Subject: [PATCH] Update README Add README for both applications. Run integration & e2e tests in band to avoid state leak. --- README.md | 30 ++++++++++++++++++++++++++++++ apps/authz-node/Makefile | 3 +++ apps/authz-node/README.md | 3 +++ apps/authz-node/project.json | 11 ++++++++--- apps/orchestration/Makefile | 3 +++ apps/orchestration/README.md | 22 ++++++++++++++++++++++ apps/orchestration/project.json | 11 ++++++++--- 7 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 apps/authz-node/README.md create mode 100644 apps/orchestration/README.md diff --git a/README.md b/README.md index 759728572..3041e0296 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,33 @@ ## Description TBD + +## Application + +- [AuthZ](./apps/authz-node/README.md) +- [Orchestration](./apps/orchestration/README.md) + +## Docker + +We use Docker & `docker-compose` to run the application's dependencies. + +```bash +make docker/up +make docker/stop +``` + +## Formatting + +We use [Prettier](https://prettier.io/) and [ESLint](https://eslint.org/) to +ensure code consistency. You can run the following commands to format and lint +the whole code base. + +```bash +# Format and lint all the code. +make format +make lint + +# Check for formatting and linting errors without fixing them. +make format/check +make lint/check +``` diff --git a/apps/authz-node/Makefile b/apps/authz-node/Makefile index d2d4b5224..c3efaecaf 100644 --- a/apps/authz-node/Makefile +++ b/apps/authz-node/Makefile @@ -1,6 +1,9 @@ AUTHZ_PROJECT_NAME := apps/authz-node AUTHZ_PROJECT_DIR := ./apps/authz-node +authz/copy-default-env: + cp ${AUTHZ_PROJECT_DIR}/.env.default ${AUTHZ_PROJECT_DIR}/.env + authz/test/copy-default-env: cp ${AUTHZ_PROJECT_DIR}/.env.test.default ${AUTHZ_PROJECT_DIR}/.env.test diff --git a/apps/authz-node/README.md b/apps/authz-node/README.md new file mode 100644 index 000000000..1d22c12cd --- /dev/null +++ b/apps/authz-node/README.md @@ -0,0 +1,3 @@ +# AuthZ + +TBD diff --git a/apps/authz-node/project.json b/apps/authz-node/project.json index 745b32963..eece331e5 100644 --- a/apps/authz-node/project.json +++ b/apps/authz-node/project.json @@ -55,21 +55,26 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/authz-node/jest.unit.ts" + "jestConfig": "apps/authz-node/jest.unit.ts", + "verbose": true } }, "test:integration": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/authz-node/jest.integration.ts" + "jestConfig": "apps/authz-node/jest.integration.ts", + "verbose": true, + "runInBand": true } }, "test:e2e": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/authz-node/jest.e2e.ts" + "jestConfig": "apps/authz-node/jest.e2e.ts", + "verbose": true, + "runInBand": true } } }, diff --git a/apps/orchestration/Makefile b/apps/orchestration/Makefile index 3d6e00279..52bc4dc37 100644 --- a/apps/orchestration/Makefile +++ b/apps/orchestration/Makefile @@ -2,6 +2,9 @@ ORCHESTRATION_PROJECT_NAME := apps/orchestration ORCHESTRATION_PROJECT_DIR := ./apps/orchestration ORCHESTRATION_DATABASE_SCHEMA := ${ORCHESTRATION_PROJECT_DIR}/src/persistence/schema/schema.prisma +orchestration/copy-default-env: + cp ${ORCHESTRATION_PROJECT_DIR}/.env.default ${ORCHESTRATION_PROJECT_DIR}/.env + orchestration/db/generate-types: npx prisma generate \ --schema ${ORCHESTRATION_DATABASE_SCHEMA} diff --git a/apps/orchestration/README.md b/apps/orchestration/README.md new file mode 100644 index 000000000..8768c8613 --- /dev/null +++ b/apps/orchestration/README.md @@ -0,0 +1,22 @@ +# Orchestration + +## Getting started + +```bash +# Boot PostgreSQL and Redis +make docker/up +make orchestration/copy-default-env +make orchestration/db/migrate +``` + +## Testing + +Firs time? Run `orchestration/test/copy-default-env` and `make +orchestration/test/db/setup` to setup the test database. + +```bash +make orchestration/test/type +make orchestration/test/unit +make orchestration/test/integration +make orchestration/test/e2e +``` diff --git a/apps/orchestration/project.json b/apps/orchestration/project.json index a4f550db8..65904ac00 100644 --- a/apps/orchestration/project.json +++ b/apps/orchestration/project.json @@ -54,21 +54,26 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/orchestration/jest.unit.ts" + "jestConfig": "apps/orchestration/jest.unit.ts", + "verbose": true } }, "test:integration": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/orchestration/jest.integration.ts" + "jestConfig": "apps/orchestration/jest.integration.ts", + "verbose": true, + "runInBand": true } }, "test:e2e": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/orchestration/jest.e2e.ts" + "jestConfig": "apps/orchestration/jest.e2e.ts", + "verbose": true, + "runInBand": true } } },