Skip to content

Commit

Permalink
Merge pull request #3805 from bloom-housing/prisma-change-over-featur…
Browse files Browse the repository at this point in the history
…e-branch

Prisma change over feature branch
  • Loading branch information
YazeedLoonat authored Feb 8, 2024
2 parents 5f4c303 + 3685fa6 commit e0638ee
Show file tree
Hide file tree
Showing 578 changed files with 73,133 additions and 2,758 deletions.
221 changes: 132 additions & 89 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
version: 2.1
orbs:
cypress: cypress-io/[email protected]
node: circleci/node@5

executors:
standard-node:
docker:
- image: "cimg/node:18.14.2"
- image: "cimg/postgres:12.10"
environment:
POSTGRES_USER: bloom-ci
# Never do this in production or with any sensitive / non-test data:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: bloom
cypress-node:
docker:
- image: "cypress/base:18.14.1"
Expand All @@ -21,15 +12,29 @@ executors:
# Never do this in production or with any sensitive / non-test data:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: bloom
JURISDICTION_NAME: Bloomington
environment:
PORT: "3100"
EMAIL_API_KEY: "SG.SOME-LONG-SECRET-KEY"
APP_SECRET: "CI-LONG-SECRET-KEY"
NODE_ENV: "development"
# DB URL for migration and seeds:
DATABASE_URL: "postgres://bloom-ci@localhost:5432/bloom"
# DB URL for the jest tests per ormconfig.test.ts
TEST_DATABASE_URL: "postgres://bloom-ci@localhost:5432/bloom"
PARTNERS_PORTAL_URL: "http://localhost:3001"
JURISDICTION_NAME: Bloomington
standard-node:
docker:
- image: "cimg/node:18.14.2"
- image: "cimg/postgres:12.10"
environment:
POSTGRES_USER: bloom-ci
# Never do this in production or with any sensitive / non-test data:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: bloom_prisma
JURISDICTION_NAME: Bloomington

jobs:
setup:
executor: standard-node
Expand All @@ -40,48 +45,95 @@ jobs:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/
setup-with-db:
executor: standard-node
steps:
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn test:backend:core:dbsetup
lint:
setup-backend:
executor: standard-node
steps:
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn lint
jest-shared-helpers:
executor: standard-node
- checkout
- run: yarn backend:new:install
- save_cache:
key: build-cache-new-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/
cypress-public:
executor: cypress-node
resource_class: large
steps:
- checkout
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn test:shared:helpers
jest-backend:
executor: standard-node
- node/install-packages:
app-dir: sites/public
pkg-manager: yarn
cache-version: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- node/install-packages:
app-dir: api
pkg-manager: yarn
cache-version: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: setup db and seed
command: yarn test:backend:new:dbsetup:withseed
- run:
name: run backend
command: yarn dev
background: true
working_directory: api
- run:
name: build and run public
command: yarn dev:server-wait-new && yarn build && yarn start
background: true
working_directory: sites/public
- run:
name: wait
command: yarn dev:public-wait
working_directory: sites/public
- run:
name: Run Cypress
command: npx cypress run
working_directory: sites/public
- store_artifacts:
path: sites/public/cypress/videos
- store_artifacts:
path: sites/public/cypress/screenshots
cypress-partners:
executor: cypress-node
resource_class: large
steps:
- checkout
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- node/install-packages:
app-dir: sites/partners
pkg-manager: yarn
cache-version: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- node/install-packages:
app-dir: api
pkg-manager: yarn
cache-version: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: DB Setup + Backend Core Tests
command: |
yarn test:backend:core:dbsetup
yarn test:backend:core
yarn test:e2e:backend:core
environment:
PORT: "3100"
EMAIL_API_KEY: "SG.SOME-LONG-SECRET-KEY"
APP_SECRET: "CI-LONG-SECRET-KEY"
# DB URL for migration and seeds:
DATABASE_URL: "postgres://bloom-ci@localhost:5432/bloom"
# DB URL for the jest tests per ormconfig.test.ts
TEST_DATABASE_URL: "postgres://bloom-ci@localhost:5432/bloom"
CLOUDINARY_SIGNED_PRESET: "fake_secret"
CLOUDINARY_KEY: "fake_key"
CLOUDINARY_CLOUD_NAME: "exygy"
CLOUDINARY_SECRET: "fake_secret"
PARTNERS_PORTAL_URL: "http://localhost:3001"
name: setup db and seed
command: yarn test:backend:new:dbsetup:withseed
- run:
name: run backend
command: yarn dev
background: true
working_directory: api
- run:
name: build and run partners
command: yarn dev:server-wait-new && yarn build && yarn start
background: true
working_directory: sites/partners
- run:
name: wait
command: yarn dev:partners-wait
working_directory: sites/partners
- run:
name: Run Cypress
command: npx cypress run
working_directory: sites/partners
- store_artifacts:
path: sites/partners/cypress/videos
- store_artifacts:
path: sites/partners/cypress/screenshots
build-public:
executor: standard-node
steps:
Expand All @@ -106,21 +158,50 @@ jobs:
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn test:app:public:unit
lint:
executor: standard-node
steps:
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn lint
jest-shared-helpers:
executor: standard-node
steps:
- restore_cache:
key: build-cache-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn test:shared:helpers
jest-backend:
executor: standard-node
steps:
- checkout
- restore_cache:
key: build-cache-new-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: DB Setup + New Backend Core Tests
working_directory: api
command: |
yarn install
yarn test:cov-ci
environment:
PORT: "3100"
EMAIL_API_KEY: "SG.SOME-LONG-SECRET-KEY"
APP_SECRET: "CI-LONG-SECRET-KEY"
# DB URL for migration and seeds:
DATABASE_URL: "postgres://bloom-ci@localhost:5432/bloom_prisma"


workflows:
version: 2
build:
jobs:
- setup
- setup-backend
- lint:
requires:
- setup
- jest-shared-helpers:
requires:
- setup
- jest-backend:
requires:
- setup
- jest-backend
- build-public:
requires:
- setup
Expand All @@ -133,49 +214,11 @@ workflows:
- unit-test-partners:
requires:
- setup
- cypress/run:
name: "cypress-public"
- cypress-public:
requires:
- setup
executor: cypress-node
working_directory: sites/public
yarn: true
build: |
yarn test:backend:core:dbsetup
start: yarn dev:all-cypress
wait-on: "http://0.0.0.0:3000"
store_artifacts: true
- cypress/run:
name: "cypress-partners"
- setup-backend
- cypress-partners:
requires:
- setup
executor: cypress-node
working_directory: sites/partners
yarn: true
build: |
echo 'export FEATURE_LISTINGS_APPROVAL=FALSE' >> "$BASH_ENV"
source "$BASH_ENV"
yarn test:backend:core:dbsetup
start: |
yarn dev:all-cypress
command: |
npx cypress run --spec cypress/e2e/default/**/*.{js,jsx,ts,tsx}
wait-on: "http://0.0.0.0:3001"
store_artifacts: true
- cypress/run:
name: "cypress-partners-listings-approval"
requires:
- setup
executor: cypress-node
working_directory: sites/partners
yarn: true
build: |
echo 'export FEATURE_LISTINGS_APPROVAL=TRUE' >> "$BASH_ENV"
source "$BASH_ENV"
yarn test:backend:core:dbsetup
start: |
yarn dev:all-cypress
command: |
npx cypress run --spec cypress/e2e/listings-approval/**/*.{js,jsx,ts,tsx}
wait-on: "http://0.0.0.0:3001"
store_artifacts: true
- setup-backend
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
"plugin:import/typescript",
"plugin:react-hooks/recommended", // Make sure we follow https://reactjs.org/docs/hooks-rules.html
"plugin:jsx-a11y/recommended",
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
Expand All @@ -26,6 +25,7 @@ module.exports = {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-var-requires": "off",
"react/jsx-uses-vars": "warn",
"react/jsx-uses-react": "warn",
"@typescript-eslint/restrict-template-expressions": [
Expand All @@ -43,12 +43,14 @@ module.exports = {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
ignorePatterns: [
"node_modules",
"storybook-static",
".next",
"dist",
"api",
"migration/",
"**/*.stories.tsx",
"**/.eslintrc.js",
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ The backend can be simultaenously deployed to PaaS-style hosts such as Heroku. I

### Structure

Bloom uses a monorepo-style repository containing multiple user-facing applications and backend services. The three main high-level packages are `backend/core`, `sites`, and `shared-helpers`. Additionally, Bloom's UI leverages the in-house npm package `@bloom-housing/ui-components`.
Bloom uses a monorepo-style repository containing multiple user-facing applications and backend services. The three main high-level packages are `api`, `sites`, and `shared-helpers`. Additionally, Bloom's UI leverages the in-house npm package `@bloom-housing/ui-components`.

The `sites` package contains reference implementations for the two user-facing applications in the system:

---

- `sites/public` is the applicant-facing site available to the general public. It provides the ability to browse available listings and to apply for listings either using the Common Application (which we build and maintain) or an external link to a third-party online or paper application.
- Visit [sites/public/README](https://github.com/bloom-housing/bloom/blob/dev/sites/public/README.md) for more details.
- Visit [sites/public/README](https://github.com/bloom-housing/bloom/blob/main/sites/public/README.md) for more details.

- `sites/partners` is the site designed for housing developers, property managers, and city/county (jurisdiction) employees. For application management, it offers the ability to view, edit, and export applications for listings and other administrative tasks. For listing management, it offers the ability to create, edit, and publish listings. A login is required to use the Partners Portal.
- Visit [sites/partners/README](https://github.com/bloom-housing/bloom/blob/dev/sites/partners/README.md) for more details.
- Visit [sites/partners/README](https://github.com/bloom-housing/bloom/blob/main/sites/partners/README.md) for more details.

In some cases the sites diverge slightly to accomodate jurisdictional customizations. The [housingbayarea Bloom fork](https://github.com/housingbayarea/bloom) is a fork of Bloom core for Bay Area jurisdictions which is loosely customized for that location. In this fork, our jurisdictions are each a separate branch.

---

- `backend/core` is the container for the key backend services (e.g. listings, applications, users). Information is stored in a Postgres database and served over HTTPS to the front-end (either at build time for things that can be server-rendered, or at run time). Most services are part of a NestJS application which allows for consolidated operation in one runtime environment. Services expose a REST API, and aren't expected to have any UI other than for debugging.
- Visit [backend/core/README](https://github.com/bloom-housing/bloom/blob/dev/backend/core/README.md) for more details.
- `api` is the container for the key backend services (e.g. listings, applications, users). Information is stored in a Postgres database and served over HTTPS to the front-end (either at build time for things that can be server-rendered, or at run time). Most services are part of a NestJS application which allows for consolidated operation in one runtime environment. Services expose a REST API, and aren't expected to have any UI other than for debugging.
- Visit [api/README](https://github.com/bloom-housing/bloom/blob/main/api/README.md) for more details.

---

- `shared-helpers` contains types and functions intended for shared use between the public and partners sites.
- Visit [shared-helpers/README](https://github.com/bloom-housing/bloom/blob/dev/shared-helpers/README.md) for more details.
- Visit [shared-helpers/README](https://github.com/bloom-housing/bloom/blob/main/shared-helpers/README.md) for more details.

---

- `@bloom-housing/ui-components` is our component library based on our internal design system. It is comprised of React components that we consume as an npm package and also build to be configurable for outside consumers. We use [Storybook](https://storybook.js.org/), an environment to provide documentation and display iterations. Our published storybook can be found[here](https://storybook.bloom.exygy.dev/) and for further details visit the [ui-components repository](https://github.com/bloom-housing/ui-components).

## Getting Started for Developers

If this is your first time working with Bloom, please be sure to check out the `sites/public`, `sites/partners` and `backend/core` README files for important configuration information specific to those pieces.
If this is your first time working with Bloom, please be sure to check out the `sites/public`, `sites/partners` and `api` README files for important configuration information specific to those pieces.

## General Local Setup

Expand All @@ -66,7 +66,13 @@ This runs 3 processes for both apps and the backend services on 3 different port

- 3000 for the public app
- 3001 for the partners app
- 3100 for backend/core
- 3100 for api

There is a chance that this won't work on your machine. If that is the case you can run each individually on separate terminals with the following command in each directory.

```
yarn dev
```

### Bloom's UI-Component Development
- Because Bloom's ui-components package is a separate open source repository, developing within both repos locally requires linking the folders with the following steps:
Expand Down Expand Up @@ -103,11 +109,7 @@ On commit, two steps automatically run: (1) linting and (2) a verification of th

In addition to commits needing to be formatted as conventional commits, if you are making different levels of version change across multiple packages, your commits must also be separated by package in order to avoid improperly versioning a package.

On every merge to dev, our Netlify `development` environment is updated and a pre-release of the ui-components package is automatically published to npm.

On every merge to master (roughly bi-weekly), a release of the backend/core and ui-components packages are automatically published to npm and our Netlify `staging` environment is updated.

Once staging has been QAed, we manually update `production`.
On every merge to `main`, our Netlify and Heroku environment automatically deploys.

### Pull Requests

Expand Down
Loading

0 comments on commit e0638ee

Please sign in to comment.