Skip to content

feat(condo): DOMA-6736 schema MobileFeatureConfig with tests #18890

feat(condo): DOMA-6736 schema MobileFeatureConfig with tests

feat(condo): DOMA-6736 schema MobileFeatureConfig with tests #18890

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: RUN CONDO TESTS
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test-organization-related-domains:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x ]
database: [ "postgresql://postgres:[email protected]/main" ]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Docker compose up databases
run: |
cp .env.example .env
docker-compose up -d postgresdb redis
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
pip3 install django
pip3 install psycopg2-binary
- name: build deps
run: |
turbo build --filter=condo^...
- name: run tests for ${{ matrix.database }}
run: |
set -x
cp .env.example .env
export NODE_ENV=test
export DISABLE_LOGGING=false
export NOTIFICATION__SEND_ALL_MESSAGES_TO_CONSOLE=true
export NOTIFICATION__DISABLE_LOGGING=true
export FAKE_ADDRESS_SUGGESTIONS=true
export TESTS_LOG_REQUEST_RESPONSE=true
export WORKER_CONCURRENCY=50
export NODE_OPTIONS="--max_old_space_size=4096"
export METABASE_CONFIG='{"url": "https://metabase.example.com", "secret": "4879960c-a625-4096-9add-7a81d925774a"}'
export NEWS_ITEMS_SENDING_DELAY_SEC=2
node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))'
# NOTE(pahaz): Keystone not in dev mode trying to check dist/admin folder
mkdir -p ./apps/condo/dist/admin
[[ $DATABASE_URL == postgresql* ]] && yarn workspace @app/condo migrate
yarn workspace @app/condo dev 2>&1 > condo.dev.log &
bash ./.github/workflows/waitForLocalhostApiReady.sh
# check migrations
yarn workspace @app/condo makemigrations --check &> /dev/null
source bin/validate-db-schema-ts-to-match-graphql-api.sh
yarn workspace @app/condo worker 2>&1 > condo.worker.log &
sleep 3
# And check background processes!
[[ $(jobs | wc -l | tr -d ' ') != '2' ]] && exit 2
sleep 3
# TESTS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/domains/(organization|user|scope|property)/schema/(.*)[.]test.js$' 2>&1 > condo.1.test.organization-user-scope-property.log
# SPECS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/domains/(organization|user|scope|property)/(.*)[.]spec.js$' 2>&1 > condo.1.spec.organization-user-scope-property.log
# Note: we need to stop background worker! because packages tests use the same redis queue
kill $(jobs -p) || echo 'background worker and dev server is already killed!'
killall node || echo 'no node processes'
env:
DATABASE_URL: ${{ matrix.database }}
NODE_ENV: development
DISABLE_LOGGING: true
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
with:
dest: './docker-logs'
- name: Upload log artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: logs
path: |
*.log
./docker-logs
retention-days: 2
test-services-related-domains:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x ]
database: [ "postgresql://postgres:[email protected]/main" ]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Docker compose up databases
run: |
cp .env.example .env
docker-compose up -d postgresdb redis
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
pip3 install django
pip3 install psycopg2-binary
- name: build deps
run: |
turbo build --filter=condo^...
- name: run tests for ${{ matrix.database }}
run: |
set -x
cp .env.example .env
export NODE_ENV=test
export DISABLE_LOGGING=false
export NOTIFICATION__SEND_ALL_MESSAGES_TO_CONSOLE=true
export NOTIFICATION__DISABLE_LOGGING=true
export FAKE_ADDRESS_SUGGESTIONS=true
export TESTS_LOG_REQUEST_RESPONSE=true
export WORKER_CONCURRENCY=50
export NODE_OPTIONS="--max_old_space_size=4096"
export METABASE_CONFIG='{"url": "https://metabase.example.com", "secret": "4879960c-a625-4096-9add-7a81d925774a"}'
export NEWS_ITEMS_SENDING_DELAY_SEC=2
node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))'
# NOTE(pahaz): Keystone not in dev mode trying to check dist/admin folder
mkdir -p ./apps/condo/dist/admin
[[ $DATABASE_URL == postgresql* ]] && yarn workspace @app/condo migrate
yarn workspace @app/condo dev 2>&1 > condo.dev.log &
bash ./.github/workflows/waitForLocalhostApiReady.sh
# check migrations
yarn workspace @app/condo makemigrations --check &> /dev/null
source bin/validate-db-schema-ts-to-match-graphql-api.sh
yarn workspace @app/condo worker 2>&1 > condo.worker.log &
sleep 3
# And check background processes!
[[ $(jobs | wc -l | tr -d ' ') != '2' ]] && exit 2
sleep 3
# TESTS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/domains/(acquiring|billing|miniapp|banking)/schema/(.*)[.]test.js$' 2>&1 > condo.2.test.acquiring-billing-miniapps-banking.log
# SPECS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/domains/(acquiring|billing|miniapp|banking)/(.*)[.]spec.js$' 2>&1 > condo.2.spec.acquiring-billing-miniapps-banking.log
# Note: we need to stop background worker! because packages tests use the same redis queue
kill $(jobs -p) || echo 'background worker and dev server is already killed!'
killall node || echo 'no node processes'
env:
DATABASE_URL: ${{ matrix.database }}
NODE_ENV: development
DISABLE_LOGGING: true
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
with:
dest: './docker-logs'
- name: Upload log artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: logs
path: |
*.log
./docker-logs
retention-days: 2
test-ticket-related-domains:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x ]
database: [ "postgresql://postgres:[email protected]/main" ]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Docker compose up databases
run: |
cp .env.example .env
docker-compose up -d postgresdb redis
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
pip3 install django
pip3 install psycopg2-binary
- name: build deps
run: |
turbo build --filter=condo^...
- name: run tests for ${{ matrix.database }}
run: |
set -x
cp .env.example .env
export NODE_ENV=test
export DISABLE_LOGGING=false
export NOTIFICATION__SEND_ALL_MESSAGES_TO_CONSOLE=true
export NOTIFICATION__DISABLE_LOGGING=true
export FAKE_ADDRESS_SUGGESTIONS=true
export TESTS_LOG_REQUEST_RESPONSE=true
export WORKER_CONCURRENCY=50
export NODE_OPTIONS="--max_old_space_size=4096"
export METABASE_CONFIG='{"url": "https://metabase.example.com", "secret": "4879960c-a625-4096-9add-7a81d925774a"}'
export NEWS_ITEMS_SENDING_DELAY_SEC=2
node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))'
# NOTE(pahaz): Keystone not in dev mode trying to check dist/admin folder
mkdir -p ./apps/condo/dist/admin
[[ $DATABASE_URL == postgresql* ]] && yarn workspace @app/condo migrate
yarn workspace @app/condo dev 2>&1 > condo.dev.log &
bash ./.github/workflows/waitForLocalhostApiReady.sh
# check migrations
yarn workspace @app/condo makemigrations --check &> /dev/null
source bin/validate-db-schema-ts-to-match-graphql-api.sh
yarn workspace @app/condo worker 2>&1 > condo.worker.log &
sleep 3
# And check background processes!
[[ $(jobs | wc -l | tr -d ' ') != '2' ]] && exit 2
sleep 3
# TESTS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/domains/(ticket|meter|contact|resident)/schema/(.*)[.]test.js$' 2>&1 > condo.3.test.ticket-meter-contact-resident.log
# SPECS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/domains/(ticket|meter|contact|resident)/(.*)[.]spec.js$' 2>&1 > condo.3.spec.ticket-meter-contact-resident.log
# Note: we need to stop background worker! because packages tests use the same redis queue
kill $(jobs -p) || echo 'background worker and dev server is already killed!'
killall node || echo 'no node processes'
env:
DATABASE_URL: ${{ matrix.database }}
NODE_ENV: development
DISABLE_LOGGING: true
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
with:
dest: './docker-logs'
- name: Upload log artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: logs
path: |
*.log
./docker-logs
retention-days: 2
test-other-domains:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 16.x ]
database: [ "postgresql://postgres:[email protected]/main" ]
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Docker compose up databases
run: |
cp .env.example .env
docker-compose up -d postgresdb redis
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
pip3 install django
pip3 install psycopg2-binary
- name: build deps
run: |
turbo build --filter=condo^...
- name: run tests for ${{ matrix.database }}
run: |
set -x
cp .env.example .env
export NODE_ENV=test
export DISABLE_LOGGING=false
export NOTIFICATION__SEND_ALL_MESSAGES_TO_CONSOLE=true
export NOTIFICATION__DISABLE_LOGGING=true
export FAKE_ADDRESS_SUGGESTIONS=true
export TESTS_LOG_REQUEST_RESPONSE=true
export WORKER_CONCURRENCY=50
export NODE_OPTIONS="--max_old_space_size=4096"
export METABASE_CONFIG='{"url": "https://metabase.example.com", "secret": "4879960c-a625-4096-9add-7a81d925774a"}'
export NEWS_ITEMS_SENDING_DELAY_SEC=2
node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))'
# NOTE(pahaz): Keystone not in dev mode trying to check dist/admin folder
mkdir -p ./apps/condo/dist/admin
[[ $DATABASE_URL == postgresql* ]] && yarn workspace @app/condo migrate
yarn workspace @app/condo dev 2>&1 > condo.dev.log &
bash ./.github/workflows/waitForLocalhostApiReady.sh
# check migrations
yarn workspace @app/condo makemigrations --check &> /dev/null
source bin/validate-db-schema-ts-to-match-graphql-api.sh
yarn workspace @app/condo worker 2>&1 > condo.worker.log &
sleep 3
# And check background processes!
[[ $(jobs | wc -l | tr -d ' ') != '2' ]] && exit 2
sleep 3
# TESTS
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '/schema/(.*)[.]test.js$' --testPathIgnorePatterns='/domains/(organization|user|scope|property|acquiring|billing|miniapp|banking|ticket|meter|contact|resident)/' 2>&1 > condo.4.test.other-domains.log
yarn workspace @app/condo test --workerIdleMemoryLimit="50%" --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '(.*)[.]test.js$' --testPathIgnorePatterns='/schema/(.*)[.]test.js$' 2>&1 > condo.5.test.others.log
# SPECS
yarn workspace @app/condo test --testTimeout=15000 --runInBand --forceExit --silent=false --verbose --bail --testPathPattern '(.*)[.]spec.js$' --testPathIgnorePatterns='/domains/(organization|user|scope|property|acquiring|billing|miniapp|banking|ticket|meter|contact|resident)/' 2>&1 > condo.4.spec.others.log
# Note: we need to stop background worker! because packages tests use the same redis queue
kill $(jobs -p) || echo 'background worker and dev server is already killed!'
killall node || echo 'no node processes'
yarn jest ./packages/keystone --workerIdleMemoryLimit="50%" --maxWorkers=2
yarn workspace @app/condo lint-schema
env:
DATABASE_URL: ${{ matrix.database }}
NODE_ENV: development
DISABLE_LOGGING: true
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
with:
dest: './docker-logs'
- name: Upload log artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: logs
path: |
*.log
./docker-logs
retention-days: 2