forked from TBoileau/iletaitunefoisundev
-
Notifications
You must be signed in to change notification settings - Fork 0
263 lines (228 loc) · 7.8 KB
/
continuous_integration.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: Continuous Integration
on: [push]
jobs:
back-env:
name: Backend environment setup
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
strategy:
fail-fast: true
matrix:
php-versions: ['8.1']
env:
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
key: back-cache-1
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist
back-quality:
needs:
- back-env
name: Backend code quality
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
strategy:
fail-fast: true
matrix:
php-versions: ['8.1']
env:
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
key: back-cache-1
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist
- name: Check if composer is valid
run: composer valid
- name: Container linter
run: bin/console lint:container
- name: Check if doctrine schema is valid
run: bin/console doctrine:schema:valid --skip-sync
- name: Copy Paste detector
run: vendor/bin/phpcpd src --exclude src/Admin/Controller
- name: PHPStan
run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=4G
back-test:
needs:
- back-env
name: Backend code tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: symfony
MYSQL_DATABASE: symfony
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=1s --health-timeout=5s --health-retries=30
neo4j:
image: neo4j:3.5
env:
NEO4J_dbms_memory_pagecache_size: 1G
NEO4J_dbms.memory.heap.initial_size: 1G
NEO4J_dbms_memory_heap_max__size: 1G
NEO4J_AUTH: none
ports:
- 7687:7687
defaults:
run:
working-directory: server
strategy:
fail-fast: true
matrix:
php-versions: ['8.1']
env:
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
key: back-cache-1
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist
- name: Creating database
run: |
bin/console doctrine:database:drop --if-exists --force --env=test
bin/console doctrine:database:create --env=test
bin/console doctrine:schema:update --force --env=test
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony
- name: Load fixtures
run: |
bin/console doctrine:fixtures:load -n --env=test
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony
NEO4J_URL : bolt://localhost:${{ job.services.neo4j.ports['7687'] }}
- name: Create key pair
run: bin/console lexik:jwt:generate-keypair --overwrite -n --env=test
- name: Run tests
run: php bin/phpunit
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony
NEO4J_URL: bolt://localhost:${{ job.services.neo4j.ports['7687'] }}
- uses: codecov/codecov-action@v2
with:
files: ./server/var/coverage/clover.xml
flags: tests
front-env:
name: Frontend environment setup and tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: client/package-lock.json
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm i
- name: Build
run: npm run build --if-present
- name: Test
run: npm run test-ci
- name: Lint
run: npm run lint