-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
113 lines (107 loc) · 2.74 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
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
cache:
key: "${CI_PROJECT_ID}_build_cache"
paths:
- vendor/
- node_modules/
stages:
- build-test
- recette
#- production
# Build & Use Custom Docker images in your GitLab CI/CD pipeline https://www.youtube.com/watch?v=7I6tHw68DMQ
build-image:
stage: build-test
image: docker
services:
- docker:dind # docker in docker
before_script:
- '[ -f .env ] && export $(grep -v "^#" .env | xargs) || echo ".env file not found"'
script:
- echo $PHP_VERSION
- echo $NODE_VERSION
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker build --build-arg PHP_VERSION=$PHP_VERSION --build-arg NODE_VERSION=$NODE_VERSION -t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE
when: manual
test:
stage: build-test
image: $CI_REGISTRY_IMAGE
except:
- master
- main
services:
- mysql:8.0
variables:
MYSQL_DATABASE: ci-db
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: dev
MYSQL_PASSWORD: dev
MYSQL_ADDON_URI: mysql://dev:dev@mysql:3306/ci-db
MYSQL_ADDON_VERSION: '8.0'
XDEBUG_MODE: 'off'
coverage: /^\s*Lines:\s*\d+.\d+\%/
artifacts:
expire_in: 60min
when: on_success
paths:
- build/
reports:
junit: build/phpunit-report.xml
coverage_report:
coverage_format: cobertura
path: build/phpunit-cobertura.xml
script:
- make install-script
- make orm-status
- make coverage
- make qualimetry
deploy-recette:
stage: recette
environment:
name: recette
url: https://client-project-$CI_ENVIRONMENT_SLUG.smartbooster.io
image:
name: clevercloud/clever-tools:latest
entrypoint: [ "/bin/sh", "-c" ]
dependencies: []
when: manual
script:
- clever deploy -f -a client-project-$CI_ENVIRONMENT_SLUG
cache: {}
restart-recette:
stage: recette
environment:
name: recette
image:
name: clevercloud/clever-tools:latest
entrypoint: [ "/bin/sh", "-c" ]
dependencies: []
when: manual
script:
- clever restart --commit $CI_COMMIT_SHA -a client-project-$CI_ENVIRONMENT_SLUG
cache: {}
#deploy-production:
# stage: production
# environment:
# name: production
# url: https://client-project-$CI_ENVIRONMENT_SLUG.smartbooster.io
# image:
# name: clevercloud/clever-tools:latest
# entrypoint: [ "/bin/sh", "-c" ]
# dependencies: []
# when: manual
# script:
# - clever deploy -f -a client-project-$CI_ENVIRONMENT_SLUG
# cache: {}
#
#restart-production:
# stage: production
# environment:
# name: production
# image:
# name: clevercloud/clever-tools:latest
# entrypoint: [ "/bin/sh", "-c" ]
# dependencies: []
# when: manual
# script:
# - clever restart --commit $CI_COMMIT_SHA -a client-project-$CI_ENVIRONMENT_SLUG
# cache: {}