generated from 8iq/nodejs-hackathon-boilerplate-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 30
102 lines (83 loc) · 2.93 KB
/
nodejs.condo.cypress.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: RUN CYPRESS TESTS
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
jobs:
test:
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@v2
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@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: install packages
run: |
npm i -g turbo
yarn install --immutable
pip3 install django
pip3 install psycopg2-binary
- name: run build
run: |
set -x
echo "# Build time .env config!" > .env
echo "COOKIE_SECRET=undefined" >> .env
echo "DATABASE_URL=undefined" >> .env
echo "REDIS_URL=undefined" >> .env
echo "NODE_ENV=production" >> .env
yarn workspace @app/condo build:deps
yarn workspace @app/condo build
- name: start server in production mode
run: |
set -x
cp .env.example .env
echo 'NODE_ENV=test' >> .env
echo 'DATABASE_URL=postgresql://postgres:[email protected]/main' >> .env
echo 'REDIS_URL=redis://127.0.0.1:6379' >> .env
echo 'COOKIE_SECRET=random' >> .env
export NODE_ENV=development
export NOTIFICATION__SEND_ALL_MESSAGES_TO_CONSOLE=true
export NOTIFICATION__DISABLE_LOGGING=true
export WORKER_CONCURRENCY=50
export APOLLO_BATCHING_ENABLED=true
yarn workspace @app/condo migrate
yarn workspace @app/condo node ./bin/generate-initial-data.js
echo 'ADDRESS_SERVICE_CLIENT_MODE=fake' >> .env
echo 'DISABLE_CAPTCHA_CHECK=true' >> .env
yarn workspace @app/condo start &
bash ./.github/workflows/waitForLocalhostApiReady.sh
- name: run cypress tests
run: |
yarn workspace @app/condo cypress run --record --key ${{ secrets.CYPRESS_RECORD_KEY }} -b chrome -C ./cypress/cypress.config.ts
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: Upload screenshots artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots
path: |
./apps/condo/cypress/screenshots
retention-days: 2