-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
65 lines (55 loc) · 3.28 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
cache:
key: ${CI_COMMIT_REF_SLUG}
before_script:
- >
echo > auth.json -e '{
"http-basic":{
"gitlab.retailcrm.tech": {
"username":"gitlab-ci-token",
"password": "'${CI_JOB_TOKEN}'"
}
}
}'
- sed "s/xxxxxxxxxxxxxxxxxxxx/${CI_JOB_TOKEN}/g" .npmrc.dist > .npmrc
stages:
- test
- build
phpunit:
stage: test
script:
- echo "prod"
- docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d --build
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps -u root php /usr/local/bin/composer --no-interaction install --prefer-dist -o --no-ansi
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps node yarn install
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps php bin/console assets:install public
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps -u root php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps php php vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.dist --using-cache=no --show-progress=none -v
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps node yarn build --no-progress
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps php bin/console do:da:cr
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps php bin/console do:mi:mi --no-interaction
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps php bin/console do:sc:va
- cp phpunit.xml.dist phpunit.xml
- docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm --no-deps -u root php php bin/phpunit
release:
stage: build
when: manual
only:
- master
variables:
CI_REGISTRY_IMAGE: hub.retailcrm.pro/retailcrm/stripe
CI_REGISTRY: hub.retailcrm.pro
script:
- sed "s/xxxxxxxxxxxxxxxxxxxx/${CI_JOB_TOKEN}/g" .npmrc.dist > .npmrc
- docker-compose build php node
- docker-compose run -e APP_ENV=prod -e APP_DEBUG=0 --rm --no-deps -u root php /usr/local/bin/composer --no-interaction install --prefer-dist --no-dev
- docker-compose run -e APP_ENV=prod -e APP_DEBUG=0 --rm --no-deps -u root php bin/console --env=prod fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
# build static
- docker-compose run --rm --no-deps node sh -c 'yarn install && yarn build'
# set/fix permissions
- docker-compose run --rm --no-deps -u root php chmod -R a-w /var/www/stripe
- docker-compose run --rm --no-deps -u root php id
- docker-compose run --rm --no-deps -u root php ls -l | grep webpack
- docker-compose run --rm --no-deps -u root php chown -R www-data:www-data /var/www/stripe
- docker build -t $CI_REGISTRY_IMAGE -f services/php_prod/Dockerfile ./
- echo ${DOCKER_HUB_PASS} | docker login -u ${DOCKER_HUB_USER} --password-stdin ${CI_REGISTRY}
- docker push $CI_REGISTRY_IMAGE:latest