-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
71 lines (65 loc) · 1.8 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
.prepara_variaveis: &prepara_variaveis
- export DOCKER_TAG=`echo ${CI_BUILD_REF_NAME} | sed s/dev/latest/`
- export SHORT_SHA=`echo ${CI_COMMIT_SHA} | cut -c1-8`
- export IMG_NAME=`echo ${CI_REGISTRY}/micro/graphql-client:${DOCKER_TAG}`
image: docker:dind
# Definindo os estagios
stages:
- build-and-push
- tests
# Criando imagem e enviando para o hub
build-test:
stage: build-and-push
image: docker:dind
before_script:
- *prepara_variaveis
script:
- >
if [ "$BUILD_TEST_IMG" == "S" ]; then
echo "Logando no hub"
echo ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
echo "Criando imagem"
docker build --no-cache -t ${CI_PROJECT_NAME}:${DOCKER_TAG} -f Dockerfile .
docker tag ${CI_PROJECT_NAME}:${DOCKER_TAG} ${IMG_NAME}
echo "Enviando para o hub"
docker push ${IMG_NAME}
docker logout ${CI_REGISTRY}
else
echo "Build desabilitado, pulando etapa...";
fi
when: on_success
only:
- test
# Executando o estagio de testes
#PHP Unit
tests-phpunit:
stage: tests
image: hub.dds.ufvjm.edu.br/micro/graphql-client:test
before_script:
- export APP_ENV='testing'
script:
- echo "Instalando dependências"
- composer install
- echo "Executando testes"
# PHP Unit
- ./phpunit.sh
when: on_success
only:
- test
# Code Sniffer, Security check, Mess Detector
tests-other:
stage: tests
image: hub.dds.ufvjm.edu.br/micro/graphql-client:test
before_script:
- export APP_ENV='testing'
script:
- echo "Instalando dependências"
- composer install
- echo "Executando testes"
# Padrao de codificacao
- ./phpcs.sh
# Verificador de erros/sujeira PHP Mess Detector
- ./phpmd.sh
when: on_success
only:
- test