-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy path.travis.yml
99 lines (99 loc) ยท 5.05 KB
/
.travis.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
stages:
- name: TEST
- name: PRE_DEPLOY
if: type = push AND branch = develop
- name: DEPLOY
if: type = push AND branch = master
sudo: required
language: node_js
node_js:
- 12.13
branches:
only:
- master
- develop
services:
- docker
env:
global:
- FE_IMAGE_TAG=1.0.2
- BE_IMAGE_TAG=1.0.2
- RESERVE_IMAGE_TAG=1.0.2
- FE_IMAGE_NAME=bu-front
- BE_IMAGE_NAME=bu-back
- RESERVE_IMAGE_NAME=bu-reserve
- DOCKER_USER=jdd04026
- secure: G9ePamZpTrvw0r11Md6Ydq88XjKvQkV5wInwbTgdnIQq9v6BY53ingtwjiKFvCiIzkPpZlmmw7UGKLZG/JYav6p7ZiFg4eaf8M992Pd4xXemT8ycegdtwkZeK7cbYQs0P45HUcfob9/mO0nGLbLGevkdjQf99EsFXLCihLgV5MX6cp/0a5bmA6Ht/dSp6P+kZRAt2l8zbTQZnjLS/3NNEIXzWGvpT+5wHDoyFMenkXrVcH9mFUla9oNKiUqKjo5GzM5keDJFdm1aUj60OemwpgnLWJKIIR5LaaY6rh9zCJTj5+hk85T2AXKI9cmyE/2zFRKVDoUYaquWVgA52zGOhcO0K3ragm8brgnr5a581YkrU/PKm/gzGaz2jQsSog7yyBdJbnSpN9NAzFpH9IukAt9aEgP2dTJumydkUL8sI5p9MWA1K999O6VXSba5VQ9f0Rn5Pj7rTHpQpVX8Hra27q006QqoUY/ImBxyk7LV/4e/J/b9MEP35sUIaootmbmAYvHoeRNxbD8OiHD4lXWjvooWigXWCRSjK0uIm6h1Qsjg2yp36aX/uhcL3W6dDio61AQFs+ZtseCeiHsNUxjiZl3WIOctHmpftM9UBN/y4Sxr4JHa3ACg5mYFzUR2JxspbeA+clGxywWhltWs5B39h1lub0zobFlrG+a/7v4onLE=
- DB_USER=user
- DB_NAME=bookus
- secure: C9PIv3PAVNasIpkZ7xXqiMjQGozvE0t+2qNo63Xwwr52fgJehtyNpOLw3uYbdDQ0OtwLGEx42TYkyuZKklWsc9KDpDfafzghueoHmdYkcIOsjxajxKn4F89VLbNQJw6jZxXqRRoYyqGMl6BBAK72dGrdq8h3zuV9Kx0nJD4pO3w/J3zsuVqrSVw2vPz7jcwCp+M6cL1HeNJfvPKmy0ss8choX6dZi5aESm2gTB3Al4O8tCNJfBws3N4xxVYN0C81lzKnnOgGqIDPr/Mg9X5Bt3BQr95YL8CGNX20jKsRCWa003fWU0TzK57NSVmYQUlXDoy9JU8YyT4Zqkfh34I45HamTl4rCuzerQFwSjxLbP5QVmOY+ulH/8lzn+8q2B+ANVB8DEHdyUyAsBKlLVuEqdYNWEA5rQ7sMNKDdGlCr8RLHxUbjZV+tK1li3vA8NA983gAJmuMYR8q4InjBODsaJYJy3AoeAP+HuWWz6yHlTReQWnFLHXUGVHDsISnPe+eK1p/8hhIBJGKufBqF4J5Dgh10xchPFREZRdVZNiIpceRskGV5rjjhs6ZfaIb4pVwvF1e3oJGersuaeo2bqCyDGj/ICsjY9Gh42/qgHe/fY+i3Suc7nsz4BWFEStZKiho5gBeSkdI+qhzmdSL8v410xBmHMNY3Om0jkYHJdb+B1A=
before_install:
- openssl aes-256-cbc -K $encrypted_06ff6f52811b_key -iv $encrypted_06ff6f52811b_iv
-in secrets.tar.enc -out secrets.tar -d
- tar xvf secrets.tar
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
jobs:
include:
- stage: TEST
name: Reserve Server
install:
- docker run --name mysql -d -e MYSQL_ROOT_PASSWORD=$DB_PW -e MYSQL_DATABASE=$DB_NAME
-e MYSQL_USER=$DB_USER -e MYSQL_PASSWORD=$DB_PW -p 3306:3306 jdd04026/mariadb-locale:latest
- docker run --name redis -d -p 6379:6379 redis:5.0.7-alpine
before_script:
- yarn
script:
- yarn workspace server db:migrate
- yarn workspace server db:seed
- yarn workspace server redis:migrate
- yarn test:reserve-server
- name: Server
install:
- docker run --name mysql -d -e MYSQL_ROOT_PASSWORD=$DB_PW -e MYSQL_DATABASE=$DB_NAME
-e MYSQL_USER=$DB_USER -e MYSQL_PASSWORD=$DB_PW -p 3306:3306 jdd04026/mariadb-locale:latest
- docker run --name redis -d -p 6379:6379 redis:5.0.7-alpine
before_script:
- yarn
script:
- yarn workspace server db:migrate
- yarn workspace server db:seed
- yarn workspace server redis:migrate
- yarn test:server seed
- yarn workspace server test:noseed
- name: Client
before_script:
- yarn
script:
- yarn test:client
- stage: PRE_DEPLOY
name: Reserve Server
script:
- docker build -t "${DOCKER_USER}/${RESERVE_IMAGE_NAME}":pre_release ./reserve-server
- docker push "${DOCKER_USER}/${RESERVE_IMAGE_NAME}":pre_release
- name: Server
script:
- docker build -t "${DOCKER_USER}/${BE_IMAGE_NAME}":pre_release ./server
- docker push "${DOCKER_USER}/${BE_IMAGE_NAME}":pre_release
- name: Client
script:
- yarn workspace client build
- docker build -t "${DOCKER_USER}/${FE_IMAGE_NAME}":pre_release ./client
- docker push "${DOCKER_USER}/${FE_IMAGE_NAME}":pre_release
- stage: DEPLOY
name: Reserve Server
script:
- docker build -t "${DOCKER_USER}/${RESERVE_IMAGE_NAME}:${RESERVE_IMAGE_TAG}"
./reserve-server
- docker tag "${DOCKER_USER}/${RESERVE_IMAGE_NAME}:${RESERVE_IMAGE_TAG}" "${DOCKER_USER}/${RESERVE_IMAGE_NAME}:latest"
- docker push "${DOCKER_USER}/${RESERVE_IMAGE_NAME}:latest" && docker push "${DOCKER_USER}/${RESERVE_IMAGE_NAME}:${RESERVE_IMAGE_TAG}"
- name: Server
script:
- docker build -t "${DOCKER_USER}/${BE_IMAGE_NAME}:${BE_IMAGE_TAG}" ./server
- docker tag "${DOCKER_USER}/${BE_IMAGE_NAME}:${BE_IMAGE_TAG}" "${DOCKER_USER}/${BE_IMAGE_NAME}:latest"
- docker push "${DOCKER_USER}/${BE_IMAGE_NAME}:latest" && docker push "${DOCKER_USER}/${BE_IMAGE_NAME}:${BE_IMAGE_TAG}"
- name: Client
script:
- yarn workspace client build
- docker build -t "${DOCKER_USER}/${FE_IMAGE_NAME}:${FE_IMAGE_TAG}" ./client
- docker tag "${DOCKER_USER}/${FE_IMAGE_NAME}:${FE_IMAGE_TAG}" "${DOCKER_USER}/${FE_IMAGE_NAME}:latest"
- docker push "${DOCKER_USER}/${FE_IMAGE_NAME}:latest" && docker push "${DOCKER_USER}/${FE_IMAGE_NAME}:${FE_IMAGE_TAG}"