|
|
@@ -1,10 +1,4 @@
|
|
1
|
1
|
---
|
|
2
|
|
-################
|
|
3
|
|
-# SECRETS #
|
|
4
|
|
-################
|
|
5
|
|
-
|
|
6
|
|
-# push_deploy_key: id_rsa from DRONE host machine
|
|
7
|
|
----
|
|
8
|
2
|
#################
|
|
9
|
3
|
# Frontend Test #
|
|
10
|
4
|
################
|
|
|
@@ -15,24 +9,24 @@ name: frontend_run_tests
|
|
15
|
9
|
steps:
|
|
16
|
10
|
# Test the vue frontend
|
|
17
|
11
|
- name: test-frontend
|
|
18
|
|
- image: node
|
|
19
|
|
- commands:
|
|
20
|
|
- - pwd
|
|
21
|
|
- - cd ./frontend
|
|
22
|
|
- - npm install
|
|
23
|
|
- - npm test
|
|
24
|
|
- volumes:
|
|
25
|
|
- # Link node_modules cache from host filesystem into container at the expected location
|
|
26
|
|
- - name: frontend_node_cache
|
|
|
12
|
+ image: node
|
|
|
13
|
+ commands:
|
|
|
14
|
+ - pwd
|
|
|
15
|
+ - cd ./frontend
|
|
|
16
|
+ - npm install
|
|
|
17
|
+ - npm test
|
|
|
18
|
+ volumes:
|
|
|
19
|
+ # Link node_modules cache from host filesystem into container at the expected location
|
|
|
20
|
+ - name: frontend_node_cache
|
|
27
|
21
|
path: /drone/src/frontend/node_modules
|
|
28
|
22
|
|
|
29
|
23
|
volumes:
|
|
30
|
24
|
- name: frontend_node_cache
|
|
31
|
|
- host:
|
|
32
|
|
- path: /tmp/cache/drone/frontend/node_modules
|
|
|
25
|
+ host:
|
|
|
26
|
+ path: /tmp/cache/drone/frontend/node_modules
|
|
33
|
27
|
- name: frontend_build
|
|
34
|
|
- host:
|
|
35
|
|
- path: /tmp/cache/drone/frontend/build
|
|
|
28
|
+ host:
|
|
|
29
|
+ path: /tmp/cache/drone/frontend/build
|
|
36
|
30
|
---
|
|
37
|
31
|
##################
|
|
38
|
32
|
# Frontend Build #
|
|
|
@@ -40,6 +34,8 @@ volumes:
|
|
40
|
34
|
|
|
41
|
35
|
kind: pipeline
|
|
42
|
36
|
name: frontend_run_build
|
|
|
37
|
+depends_on:
|
|
|
38
|
+ - frontend_run_tests
|
|
43
|
39
|
trigger:
|
|
44
|
40
|
status:
|
|
45
|
41
|
# Only runs if the first pipeline was fully successful
|
|
|
@@ -49,29 +45,29 @@ trigger:
|
|
49
|
45
|
|
|
50
|
46
|
steps:
|
|
51
|
47
|
- name: build-frontend
|
|
52
|
|
- image: node
|
|
53
|
|
- commands:
|
|
54
|
|
- - cd ./frontend
|
|
55
|
|
- - rm -Rf ./build/*
|
|
56
|
|
- - npx browserslist@latest --update-db
|
|
57
|
|
- - npm run build
|
|
58
|
|
- - ls ./build
|
|
59
|
|
- environment:
|
|
60
|
|
- NODE_OPTIONS: --openssl-legacy-provider
|
|
61
|
|
- volumes:
|
|
62
|
|
- # Link node_modules cache from host filesystem into container at the expected location
|
|
63
|
|
- - name: frontend_node_cache
|
|
|
48
|
+ image: node
|
|
|
49
|
+ commands:
|
|
|
50
|
+ - cd ./frontend
|
|
|
51
|
+ - rm -Rf ./build/*
|
|
|
52
|
+ - npx browserslist@latest --update-db
|
|
|
53
|
+ - npm run build
|
|
|
54
|
+ - ls ./build
|
|
|
55
|
+ environment:
|
|
|
56
|
+ NODE_OPTIONS: --openssl-legacy-provider
|
|
|
57
|
+ volumes:
|
|
|
58
|
+ # Link node_modules cache from host filesystem into container at the expected location
|
|
|
59
|
+ - name: frontend_node_cache
|
|
64
|
60
|
path: /drone/src/frontend/node_modules
|
|
65
|
|
- - name: frontend_build
|
|
|
61
|
+ - name: frontend_build
|
|
66
|
62
|
path: /drone/src/frontend/build
|
|
67
|
63
|
|
|
68
|
64
|
volumes:
|
|
69
|
65
|
- name: frontend_node_cache
|
|
70
|
|
- host:
|
|
71
|
|
- path: /tmp/cache/drone/frontend/node_modules
|
|
|
66
|
+ host:
|
|
|
67
|
+ path: /tmp/cache/drone/frontend/node_modules
|
|
72
|
68
|
- name: frontend_build
|
|
73
|
|
- host:
|
|
74
|
|
- path: /tmp/cache/drone/frontend/build
|
|
|
69
|
+ host:
|
|
|
70
|
+ path: /tmp/cache/drone/frontend/build
|
|
75
|
71
|
---
|
|
76
|
72
|
#################
|
|
77
|
73
|
# Backend Tests #
|
|
|
@@ -83,24 +79,24 @@ name: backend_run_tests
|
|
83
|
79
|
steps:
|
|
84
|
80
|
# Test the vue frontend
|
|
85
|
81
|
- name: test-backend
|
|
86
|
|
- image: node
|
|
87
|
|
- commands:
|
|
88
|
|
- - pwd
|
|
89
|
|
- - cd ./backend
|
|
90
|
|
- - npm install
|
|
91
|
|
- - npm test
|
|
92
|
|
- volumes:
|
|
93
|
|
- # Link node_modules cache from host filesystem into container at the expected location
|
|
94
|
|
- - name: backend_node_cache
|
|
95
|
|
- path: /drone/src/backend/node_modules
|
|
|
82
|
+ image: node
|
|
|
83
|
+ commands:
|
|
|
84
|
+ - pwd
|
|
|
85
|
+ - cd ./backend
|
|
|
86
|
+ - npm install
|
|
|
87
|
+ - npm test
|
|
|
88
|
+ volumes:
|
|
|
89
|
+ # Link node_modules cache from host filesystem into container at the expected location
|
|
|
90
|
+ - name: backend_node_cache
|
|
|
91
|
+ path: /drone/src/backend/node_modules
|
|
96
|
92
|
|
|
97
|
93
|
volumes:
|
|
98
|
94
|
- name: backend_node_cache
|
|
99
|
|
- host:
|
|
100
|
|
- path: /tmp/cache/drone/backend/node_modules
|
|
|
95
|
+ host:
|
|
|
96
|
+ path: /tmp/cache/drone/backend/node_modules
|
|
101
|
97
|
- name: backend_build
|
|
102
|
|
- host:
|
|
103
|
|
- path: /tmp/cache/drone/backend/build
|
|
|
98
|
+ host:
|
|
|
99
|
+ path: /tmp/cache/drone/backend/build
|
|
104
|
100
|
---
|
|
105
|
101
|
########################
|
|
106
|
102
|
# Deploy to Production #
|
|
|
@@ -111,6 +107,7 @@ name: deploy
|
|
111
|
107
|
depends_on:
|
|
112
|
108
|
# Must run after the first pipeline
|
|
113
|
109
|
- frontend_run_tests
|
|
|
110
|
+ - frontend_run_build
|
|
114
|
111
|
- backend_run_tests
|
|
115
|
112
|
trigger:
|
|
116
|
113
|
status:
|
|
|
@@ -118,26 +115,27 @@ trigger:
|
|
118
|
115
|
- success
|
|
119
|
116
|
branch:
|
|
120
|
117
|
- master
|
|
|
118
|
+
|
|
121
|
119
|
steps:
|
|
122
|
120
|
# post-receive hook
|
|
123
|
121
|
- name: push commit
|
|
124
|
|
- image: appleboy/drone-git-push:0.2.0-linux-amd64
|
|
125
|
|
- settings:
|
|
126
|
|
- branch: master
|
|
127
|
|
- remote: maeda@165.232.128.85:/opt/staging/siimee.git
|
|
128
|
|
- remote_name: staging
|
|
129
|
|
- force: true
|
|
130
|
|
- ssh_key:
|
|
131
|
|
- # !: id_rsa from DRONE machine
|
|
132
|
|
- from_secret: push_deploy_key
|
|
|
122
|
+ image: appleboy/drone-git-push:0.2.0-linux-amd64
|
|
|
123
|
+ settings:
|
|
|
124
|
+ branch: master
|
|
|
125
|
+ remote: maeda@165.232.128.85:/opt/staging/siimee.git
|
|
|
126
|
+ remote_name: staging
|
|
|
127
|
+ force: true
|
|
|
128
|
+ ssh_key:
|
|
|
129
|
+ # !: id_rsa from DRONE machine
|
|
|
130
|
+ from_secret: push_deploy_key
|
|
133
|
131
|
|
|
134
|
132
|
volumes:
|
|
135
|
133
|
- name: frontend_node_cache
|
|
136
|
|
- host:
|
|
137
|
|
- path: /tmp/cache/drone/frontend/node_modules
|
|
|
134
|
+ host:
|
|
|
135
|
+ path: /tmp/cache/drone/frontend/node_modules
|
|
138
|
136
|
- name: frontend_build
|
|
139
|
|
- host:
|
|
140
|
|
- path: /tmp/cache/drone/frontend/build
|
|
|
137
|
+ host:
|
|
|
138
|
+ path: /tmp/cache/drone/frontend/build
|
|
141
|
139
|
- name: backend_node_cache
|
|
142
|
|
- host:
|
|
143
|
|
- path: /tmp/cache/drone/backend/node_modules
|
|
|
140
|
+ host:
|
|
|
141
|
+ path: /tmp/cache/drone/backend/node_modules
|