-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
104 lines (94 loc) · 2.17 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
stages:
- preparation
- testing
- deploy
image: thecodingmachine/php:8.1-v4-cli
# Variables
variables:
PHP_EXTENSIONS: pdo_sqlite posix gd
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
composer:
stage: preparation
script:
- php -v
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.example .env
- php artisan key:generate
- php artisan storage:link
artifacts:
paths:
- vendor/
- .env
expire_in: 1 days
when: always
cache:
paths:
- vendor/
phpunit:
stage: testing
dependencies:
- composer
script:
- php artisan storage:link
- php artisan test --parallel
artifacts:
paths:
- ./storage/app
- ./storage/logs
expire_in: 1 days
when: on_failure
codestyle:
stage: testing
script:
- ./vendor/bin/pint --test
dependencies:
- composer
security-checker:
stage: testing
needs:
- job: composer
artifacts: true
script:
- composer audit
deploy_dev:
stage: deploy
needs:
- job: composer
artifacts: true
script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ./vendor/bin/envoy run deploy -vvv
only:
- dev
deploy_prod:
stage: deploy
needs:
- job: composer
artifacts: true
script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ./vendor/bin/envoy run deploy --server=prod
only:
- master
when: manual
merge-master-to-mirrored:
stage: deploy
only:
- master
script:
- git clone --single-branch --branch=mirrored $OAUTH2_REPO_URL
- cd manuscript
- git config remote.origin.fetch "+refs/heads/master:refs/remotes/origin/master"
- git fetch origin
- git config --global user.email "[email protected]"
- git config --global user.name "Pipeline"
- MESSAGE=$(git log -n 1 origin/master)
- git merge origin/master -m "${MESSAGE}"
- git push origin mirrored