-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (115 loc) · 3.94 KB
/
Copy pathgithub-actions-ci.yml
File metadata and controls
134 lines (115 loc) · 3.94 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Github Actions CI
on: [push]
env:
NODE_VERSION: '16.x' # set this to the node version to use
jobs:
back-end-ci:
name: back-end-ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install & build
run: |
npm install
npm run build
- name: npm format:check
run: |
npm run format:check
- name: npm lint
run: |
npm run lint
- name: npm test:cov
run: |
npm run test:cov
- name: npm test:e2e local
run: |
npm run test:e2e
env:
CI: true
APP_NAME: Test Lazztech Hub
ACCESS_TOKEN_SECRET: SecretKey
FIREBASE_SERVER_KEY: test
PUSH_NOTIFICATION_ENDPOINT: test
EMAIL_FROM_ADDRESS: test
EMAIL_PASSWORD: test
DATABASE_TYPE: sqlite
FILE_STORAGE_TYPE: local
- name: start postgresql db
uses: harmon758/postgresql-action@v1
with:
postgresql version: '11' # See https://hub.docker.com/_/postgres for available versions
postgresql db: 'postgres-test'
postgresql user: 'test'
postgresql password: 'Password123'
- name: start minio s3 object storage
run: |
docker run -d -p 9000:9000 --name minio \
-e "MINIO_ACCESS_KEY=minioadmin" \
-e "MINIO_SECRET_KEY=minioadmin" \
-v /tmp/data:/data \
-v /tmp/config:/root/.minio \
minio/minio server /data
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
export AWS_EC2_METADATA_DISABLED=true
aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test-lazztech-hub
- name: npm test:e2e remote
run: |
npm run test:e2e
env:
CI: true
APP_NAME: Test Lazztech Hub
ACCESS_TOKEN_SECRET: SecretKey
FIREBASE_SERVER_KEY: test
PUSH_NOTIFICATION_ENDPOINT: test
EMAIL_FROM_ADDRESS: test
EMAIL_PASSWORD: test
DATABASE_TYPE: postgres
DATABASE_HOST: localhost
DATABASE_PORT: "5432"
DATABASE_USER: "test"
DATABASE_PASS: 'Password123'
DATABASE_SCHEMA: 'postgres-test'
DATABASE_SSL: "false"
FILE_STORAGE_TYPE: object
OBJECT_STORAGE_BUCKET_NAME: test-lazztech-hub
OBJECT_STORAGE_ACCESS_KEY_ID: minioadmin
OBJECT_STORAGE_SECRET_ACCESS_KEY: minioadmin
OBJECT_STORAGE_ENDPOINT: http://127.0.0.1:9000
- name: npm start & health check
# 'nohup npm run start:prod >> app.log 2>&1 &' runs the command as a background job: https://stackoverflow.com/a/46732894/848396
# 'timeout 30 bash -c 'until echo > /dev/tcp/localhost/13000; do sleep 0.5; done' wait for server to start up or timeout with error: https://unix.stackexchange.com/a/349138
# 'kill %1' kills background job: https://unix.stackexchange.com/a/104822
run: |
nohup npm run start:prod >> app.log 2>&1 &
timeout 30 bash -c 'until echo > /dev/tcp/localhost/8080; do cat app.log && sleep 0.5; done'
kill %1
env:
CI: true
APP_NAME: Test Lazztech Hub
ACCESS_TOKEN_SECRET: SecretKey
FIREBASE_SERVER_KEY: test
PUSH_NOTIFICATION_ENDPOINT: test
EMAIL_FROM_ADDRESS: test
EMAIL_PASSWORD: test
DATABASE_TYPE: sqlite
FILE_STORAGE_TYPE: local
# deploy:
# name: deploy-cd-master
# runs-on: ubuntu-latest
# needs: back-end-ci
# if: github.ref == 'refs/heads/master'
# steps:
# - uses: actions/checkout@master
# - name: Use Node.js ${{ env.NODE_VERSION }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ env.NODE_VERSION }}
# - name: npm install & build
# run: |
# npm install
# npm run build