-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
70 lines (65 loc) · 2.13 KB
/
.gitlab-ci.yml
File metadata and controls
70 lines (65 loc) · 2.13 KB
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
image: gitlab/dind
stages:
- test
- build
- deploy
test:
type: test
only:
- master
image: php:7.4-fpm
before_script:
- apt-get update && apt-get install -y zip libzip-dev unzip git curl libfreetype6-dev libjpeg62-turbo-dev libxslt-dev libpng-dev && docker-php-ext-install -j$(nproc) gd xsl intl zip
- apt install docker.io -y && service docker start
- curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer require symfony/messenger
- composer install
script:
- cp .env.test.dist .env.test
- docker run -d -p 1025:1025 -p 8025:8025 mailhog/mailhog
- php bin/phpunit
coverage:
image: sonarsource/sonar-scanner-cli
type: test
only:
- master
script:
- sonar-scanner -Dsonar.host.url=http://161.35.6.31:9000 -Dsonar.projectKey=atoute-api -Dsonar.sources=. -Dsonar.qualitygate.wait=true
allow_failure: true
variables:
SONAR_PROJECT_BASE_DIR: "${CI_PROJECT_DIR}"
build:
type: build
only:
- master
before_script:
# Setup SSH deploy keys
- echo "test issue"
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$PRIVATE_SSH_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# Connection to Docker Hub
- docker info
- docker login registry.gitlab.com -u lucasconsejo -p TdQLTdyVMnL_D-NzqVRW
script:
- docker build -f Dockerfile-prod -t registry.gitlab.com/quentg/atoute-back/api .
- docker push registry.gitlab.com/quentg/atoute-back/api
deploy:
type: deploy
only:
- master
before_script:
# Setup SSH deploy keys
- echo "test issue"
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$PRIVATE_SSH_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# Connection to Docker Hub
- docker info
- docker login registry.gitlab.com -u lucasconsejo -p TdQLTdyVMnL_D-NzqVRW
script:
- ssh root@142.93.52.107 "cd /atoute && ./deploy.sh && exit"