Skip to content

Commit ee892e1

Browse files
committed
Add GitLab's CI Configuration
1 parent 3b4666c commit ee892e1

File tree

2 files changed

+178
-0
lines changed

2 files changed

+178
-0
lines changed

.gitlab-ci.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Environment Definitions
2+
3+
.api: &api
4+
image: thecodingmachine/php:7.4-v4-cli
5+
variables:
6+
PHP_EXTENSIONS: gd pdo_mysql xdebug imap intl
7+
PHP_INI_MEMORY_LIMIT: 1G
8+
DEFAULT_LOCALE: "en"
9+
MONOLOG_LOGGING_PATH: "php://stderr"
10+
MYSQL_ROOT_PASSWORD: root
11+
MYSQL_DATABASE: "foo"
12+
MYSQL_USER: "foo"
13+
MYSQL_PASSWORD: "foo"
14+
TESTS_DATABASE_URL: "mysql://$MYSQL_USER:$MYSQL_PASSWORD@mysql:3306/$MYSQL_DATABASE?server_version=8.0"
15+
before_script:
16+
- cd src/api
17+
- cp .env.dist .env
18+
- composer install
19+
cache:
20+
key:
21+
prefix: "api"
22+
files:
23+
- src/api/composer.lock
24+
paths:
25+
- src/api/vendor
26+
policy: pull
27+
28+
.webapp: &webapp
29+
image: thecodingmachine/nodejs:14
30+
before_script:
31+
- cd src/webapp
32+
- yarn
33+
cache:
34+
key:
35+
prefix: "webapp"
36+
files:
37+
- src/webapp/composer.json
38+
paths:
39+
- src/webapp/node_modules
40+
policy: pull
41+
42+
# Jobs descriptions
43+
44+
.build: &build
45+
stage: build
46+
script:
47+
- exit 0
48+
cache:
49+
policy: pull-push
50+
51+
.00_composer_static_analysis: &00_composer_static_analysis
52+
stage: test
53+
script:
54+
- composer phpstan
55+
56+
.01_composer_test: &01_composer_test
57+
stage: test
58+
script:
59+
- composer pest
60+
coverage: '/^.*Cov:.*?(\d+.\d+\%)/'
61+
62+
.02_composer_codestyle: &02_composer_codestyle
63+
stage: test
64+
script:
65+
- composer cscheck
66+
67+
.00_yarn_static_analysis: &00_yarn_static_analysis
68+
stage: test
69+
script:
70+
- yarn lint
71+
72+
.01_yarn_test: &01_yarn_test
73+
stage: test
74+
script:
75+
- yarn build
76+
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
77+
78+
# Jobs in their environment
79+
80+
api:build:
81+
extends:
82+
- .api
83+
- .build
84+
85+
api:00_composer_static_analysis:
86+
extends:
87+
- .api
88+
- .00_composer_static_analysis
89+
needs:
90+
- api:build
91+
92+
api:01_composer_test:
93+
services:
94+
- name: mysql:8.0
95+
alias: mysql
96+
command: ["--default-authentication-plugin=mysql_native_password"]
97+
extends:
98+
- .api
99+
- .01_composer_test
100+
needs:
101+
- api:build
102+
103+
api:02_composer_codestyle:
104+
extends:
105+
- .api
106+
- .02_composer_codestyle
107+
needs:
108+
- api:build
109+
110+
webapp:build:
111+
extends:
112+
- .webapp
113+
- .build
114+
115+
webapp:00_yarn_static_analysis:
116+
extends:
117+
- .webapp
118+
- .00_yarn_static_analysis
119+
needs:
120+
- webapp:build
121+
122+
webapp:01_yarn_test:
123+
extends:
124+
- .webapp
125+
- .01_yarn_test
126+
needs:
127+
- webapp:build

src/api/.env.dist

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
#
13+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
14+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
15+
16+
###> symfony/framework-bundle ###
17+
APP_ENV=dev
18+
APP_SECRET=60d39a7440d83a0c9fa9d3391688db31
19+
###< symfony/framework-bundle ###
20+
21+
###> doctrine/doctrine-bundle ###
22+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
23+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
24+
#
25+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
26+
DATABASE_URL="mysql://root:root@127.0.0.1:3306/db_name?serverVersion=5.7"
27+
#DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
28+
###< doctrine/doctrine-bundle ###
29+
30+
###> nelmio/cors-bundle ###
31+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
32+
###< nelmio/cors-bundle ###
33+
34+
# This file should always be updated with the environment variables used by the API.
35+
# Keys are available under the api service in the root docker-compose.yml file.
36+
APP_NAME='foo'
37+
APP_DEBUG='1'
38+
MONOLOG_LOGGING_PATH='php://stderr'
39+
MESSENGER_TRANSPORT_DSN='redis://foo@redis:6379/messages'
40+
STORAGE_PUBLIC_SOURCE='public.storage.s3'
41+
STORAGE_PRIVATE_SOURCE='private.storage.s3'
42+
STORAGE_ENDPOINT='http://minio:9000'
43+
STORAGE_PUBLIC_BUCKET='public'
44+
STORAGE_PRIVATE_BUCKET='private'
45+
STORAGE_ACCESS_KEY='foo'
46+
STORAGE_SECRET_KEY='foo'
47+
MAILER_DSN='smtp://null:null@mailhog:1025'
48+
MAIL_FROM_ADDRESS='no-reply@foo.localhost'
49+
MAIL_FROM_NAME='foo'
50+
MAIL_WEBAPP_URL='http://foo.localhost/'
51+
MAIL_WEBAPP_UPDATE_PASSWORD_ROUTE_FORMAT='%s/update-password/%s/%s'

0 commit comments

Comments
 (0)