-
Notifications
You must be signed in to change notification settings - Fork 43
/
.gitlab-ci.yml
103 lines (95 loc) · 2.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
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
variables:
APP_ENV: test
APP_SECRET: a448d1dfcaa563fce56c2fd9981f662b
DATABASE_URL: "mysql://root:root@mysql:3306/su_demo_test?serverVersion=8.0"
ELASTICSEARCH_HOST: elasticsearch:9200
EMAIL_FROM_ADDRESS: admin@localhost
COMPOSER_PROCESS_TIMEOUT: "1200" # int is not supported by local gitlab-runner
MYSQL_ROOT_PASSWORD: root
stages:
- trigger
- install
- test
prepare-deployemnt:
stage: trigger
image: curlimages/curl:latest
script:
# trigger pipeline of deployment project: https://docs.gitlab.com/ee/ci/triggers/README.html#ci-job-token
- curl --request POST --form "token=$CI_JOB_TOKEN" --form "ref=master" "$CI_API_V4_URL/projects/46/trigger/pipeline"
only:
- master
composer:
stage: install
image: composer:latest
before_script:
- composer config -g cache-dir "$(pwd)/.composer-cache"
script:
- composer install --no-interaction --prefer-dist --no-scripts
- curl --show-error --silent https://getcomposer.org/installer | php
artifacts:
name: composer-dependencies
expire_in: 8 hours
paths:
- vendor
- bin/.phpunit
- composer.phar
cache:
key: composer
paths:
- .composer-cache/
lint:
stage: test
image: sulu/php:8.2-cli
services:
- mysql:8.0
before_script:
- php bin/adminconsole doctrine:database:create --if-not-exists
- php bin/adminconsole doctrine:schema:update --force
script:
- php composer.phar lint
test:
stage: test
image: sulu/php:8.2-cli
services:
- mysql:8.0
before_script:
- php composer.phar bootstrap-test-environment
script:
- php composer.phar test
build:
stage: test
image: sulu/php:8.2-cli
services:
- mysql:8.0
- name: elasticsearch:7.13.2
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
script:
- php bin/console sulu:build dev --destroy
js-css-website:
stage: test
image: node:18
dependencies: []
variables:
NODE_OPTIONS: --max-old-space-size=1536
before_script:
- npm config set cache "$(pwd)/.npm-cache"
- yarn config set cache-folder "$(pwd)/.yarn-cache"
script:
- cd assets/website
- yarn install --frozen-lockfile
- yarn run lint
- yarn run build
cache:
key: yarn_npm
paths:
- .npm-cache/
- .yarn-cache/
security-check:
stage: test
image: sulu/php:8.2-cli
before_script:
- curl -sS https://get.symfony.com/cli/installer | bash
- mv /root/.symfony5/bin/symfony /usr/local/bin/symfony
script:
- php composer.phar security-check
allow_failure: true