-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
163 lines (152 loc) · 3.61 KB
/
.gitlab-ci.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
image: node:latest
stages: # List of stages for jobs, and their order of execution
- npm
- lint
- unit-test-backend
- unit-test-frontend
- integration-test-backend
- deploy
npm-backend:
stage: npm
script:
- cd functions
- echo "Running npm install for backend"
- npm install
- echo "npm install is complete"
cache:
paths:
- functions/node_modules/
artifacts:
expire_in: 1 days
when: on_success
paths:
- functions/node_modules/
npm-frontend:
stage: npm
script:
- cd app/traste
- echo "Running npm install for frontend"
- npm install
- echo "npm install is complete"
cache:
paths:
- app/traste/node_modules/
artifacts:
expire_in: 1 days
when: on_success
paths:
- app/traste/node_modules/
eslint-backend:
stage: lint
dependencies:
- npm-backend
script:
# Install ESLint in this docker container
- npm install -g eslint
- cd functions
- echo "Starting eslint check for all files in the backend"
- eslint .
- echo "Done"
eslint-frontend:
stage: lint
dependencies:
- npm-frontend
script:
# Install ESLint in this docker container
- npm install -g eslint
- cd app/traste
- echo "Starting eslint check for all files in the frontend"
- eslint .
- echo "Done"
unit-test-backend:
stage: unit-test-backend
dependencies:
- npm-backend
script:
- cd functions
- echo "Running unit tests for backend"
- npm run coverage-unit
- echo "Unit tests for backend are complete"
coverage: '/Code coverage: \d+\.\d+/'
artifacts:
expire_in: 1 year
when: on_success
paths:
- functions/coverage/
unit-test-frontend:
stage: unit-test-frontend
dependencies:
- npm-frontend
script:
- cd app/traste
- echo "Running unit tests for frontend"
- npm run test -- --coverage
- echo "Unit tests for frontend are complete"
coverage: '/Code coverage: \d+\.\d+/'
artifacts:
expire_in: 1 year
when: on_success
paths:
- app/traste/coverage/
integration-test-backend:
stage: integration-test-backend
dependencies:
- npm-backend
script:
- cd functions
- echo "Running integration tests for backend"
- npm run coverage-int
- echo "Integrations tests for backend are complete"
coverage: '/Code coverage: \d+\.\d+/'
artifacts:
expire_in: 1 year
when: on_success
paths:
- functions/coverage/
deploy-firestore:
stage: deploy
before_script:
- npm i -g firebase-tools
script:
- echo "Deploying firestore..."
- firebase deploy --only firestore --token $FIREBASE_TOKEN
- echo "Firestore successfully deployed."
only:
refs:
- main
changes:
- firestore.rules
- firestore.indexes.json
deploy-functions: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
dependencies:
- npm-backend
before_script:
- npm i -g firebase-tools
script:
- echo "Deploying functions..."
- cd functions
- npm install
- cd ..
- firebase deploy --only functions --token $FIREBASE_TOKEN
- echo "Functions successfully deployed."
only:
refs:
- main
deploy-hosting:
stage: deploy
dependencies:
- npm-frontend
before_script:
- npm i -g firebase-tools
script:
- cd app/traste
- echo "Building application"
- npm run build
- echo "Building is done"
- echo "Starting to deploy application"
- firebase deploy --only hosting --token $FIREBASE_TOKEN
- echo "Application is deployed"
only:
refs:
- main