-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
81 lines (76 loc) · 2.1 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
stages:
- manual-clean
- preparation
- testing
- deploy
variables:
SSH_COMMAND: $SSH_COMMAND
composer:
stage: preparation
tags:
- microservice
script:
- php -v
- ls -la
- cp -n docker-compose.yaml.dist docker-compose.yaml
- cp -n .env.local.example .env.local
- cp -n .env.local.example .env.test.local
- docker-compose -f docker-compose.ci.yaml down
- docker-compose -f docker-compose.ci.yaml up -d
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm chmod -R g+rw ./
artifacts:
paths:
- vendor/
expire_in: 1 week
when: always
cache:
key: ${CI_COMMIT_REF_SLUG}-composer
paths:
- vendor/
tests:
stage: testing
tags:
- microservice
dependencies:
- composer
script:
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm php bin/console doctrine:migrations:migrate --env test --no-interaction
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm php vendor/codeception/codeception/codecept run
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm php vendor/codeception/codeception/codecept clean
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm rm -rf var/log var/cache vendor/
clean:
stage: manual-clean
tags:
- microservice
script:
- docker-compose -f docker-compose.ci.yaml up -d
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm chmod -R g+rw ./
- docker-compose -f docker-compose.ci.yaml exec -T php-fpm rm -rf var/log var/cache vendor/
when: manual
deploy_prod:
stage: deploy
tags:
- microservice
script:
- df -h /
- |
ssh -T "$SSH_COMMAND" /bin/bash -s << EOT
cd notify-microservice/
git checkout main
git fetch --all
git reset --hard HEAD
git status
git pull
df -H /
make up
make composer-install
make migration
docker-compose exec -T php-fpm php bin/console rabbitmq:setup-fabric
make restart
make ps
EOT
environment:
name: deploy
only:
- main