-
Notifications
You must be signed in to change notification settings - Fork 13
/
config.yml
122 lines (111 loc) · 2.87 KB
/
config.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
version: 2.1
workflows:
version: 2
### Unit Testing Staging ###
unit_testing_staging:
jobs:
- run_test:
filters:
branches:
only: dev-staging
### Unit Testing Production ###
unit_testing_production:
jobs:
- run_test:
filters:
branches:
only: dev-master
### Deploy Staging ###
deploy_staging:
jobs:
- preparation
- run_staging:
requires:
- preparation
filters:
branches:
only: dev-staging
- hold:
type: approval
requires:
- run_staging
filters:
branches:
only:
- dev-master
- dev-staging
### Deploy Production ###
deploy_production:
jobs:
- preparation
- run_production:
requires:
- preparation
filters:
branches:
only: dev-production
- hold:
type: approval
requires:
- run_production
filters:
branches:
only: dev-production
jobs:
preparation:
docker:
- image: ruby:2.7.1-slim-buster
steps:
- run:
name: Preparation
command: |
### SETUP SSH ###
apt-get update -qq
apt-get install -qq git build-essential
'which ssh-agent || ( apt-get install -qq openssh-client )'
mkdir -p ~/.ssh
echo "${MYAPP_SSH_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
echo "${MYAPP_KNOWN_HOSTS}" | tr -d '\r' > ~/.ssh/known_hosts
chmod 700 ~/.ssh/id_rsa
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
### INSTALL LIBRARY ###
- gem install bundler
- bundle install
run_test:
docker:
- image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
- image: mariadb:10.3.11
environment:
MYSQL_DATABASE: "laravel"
MYSQL_ROOT_PASSWORD: "secret"
MYSQL_PASSWORD: "secret"
steps:
- run:
name: Running Test
command: |
cp src/.env.pipeline.gitlab src/.env
make fixing-cache
make composer-install-cicd
make key-generate
make composer-dumpautoload
make run-migrate-all
make clear-all
run_staging:
docker:
- image: ruby:2.7.1-slim-buster
steps:
- run:
name: Deploy Staging Environment
command: |
make deploy-staging
run_production:
docker:
- image: ruby:2.7.1-slim-buster
steps:
- run:
name: Deploy Production Environment
command: |
make deploy-production