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