-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
105 lines (97 loc) · 2.46 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
stages:
- build
- test
- release
- deploy
variables:
POSTGRES_DB: homestead
POSTGRES_USER: homestead
POSTGRES_PASSWORD: root
image: registry.macellan.net/docker-images/php-nginx:8.1-bullseye
#########################
# Build
#########################
install dependencies:
stage: build
tags:
- docker_runner
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- npm ci
- npm run production
after_script:
- cat ~/.npm/_logs/*.log
artifacts:
paths:
- vendor/
- node_modules/
- public/dist/
- public/mix-manifest.json
expire_in: 1 day
when: always
cache:
paths:
- vendor/
- node_modules/
# #########################
# # Test: Code Quality
# #########################
# code quality:
# stage: test
# tags:
# - docker_runner
# script:
# - vendor/bin/phpcs -n --runtime-set ignore_warnings_on_exit true --standard=phpcs.xml .
#########################
# Test: PHPUnit
#########################
.phpunit_template: &phpunit_template_definition
stage: test
tags:
- docker_runner
dependencies:
- install dependencies
after_script:
- cat ./storage/logs/laravel.log
phpunit postgres:
<<: *phpunit_template_definition
services:
- name: postgres:latest
alias: postgres
script:
- cp .gitlab/.env.testing-postgres .env.testing
- php artisan key:generate --force --env=testing
- php artisan optimize:clear --env=testing
- php artisan test --env=testing
#########################
# Release Process
#########################
build docker image:
stage: release
tags:
- shell_runner
only:
- tags
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- echo ${CI_COMMIT_TAG} > VERSION
- docker build --pull
-t registry.macellan.net/macellan/macellan-short:${CI_COMMIT_TAG}
-t registry.macellan.net/macellan/macellan-short:latest .
- docker push --all-tags registry.macellan.net/macellan/macellan-short
after_script:
- docker rmi -f $(docker images -q registry.macellan.net/macellan/macellan-short) || true
#########################
# Deployment
#########################
deploy altpay-prod:
stage: deploy
environment:
name: altpay-prod
only: [tags]
tags:
- altpay_prod_runner
when: manual
script:
- bash ./.gitlab/deploy-production.sh "${SERVER_ALTPAY_PROD_2_IP}" "${CI_COMMIT_TAG}" altpay_services_short