-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.65 KB
/
backend.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
name: backend
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
lint-and-tests:
runs-on: ubuntu-latest
env:
# DATABASE_URL: "mysql://user1:[email protected]:3306/auto_entreprise_test?serverVersion=10.9.6-MariaDB"
DIRECTORY: ./backend
services:
mariadb:
image: mariadb:10.9
env:
MARIADB_ROOT_PASSWORD: secret
MARIADB_USER: user1
MARIADB_PASSWORD: password1
MARIADB_DATABASE: auto_entreprise_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: ctype, iconv, mbstring, intl, pdo_sqlite, mysql
tools: composer:v2
coverage: xdebug
- name: Install Dependencies
working-directory: ${{ env.DIRECTORY }}
run: composer install -q --no-ansi --no-interaction --no-suggest --no-scripts --no-progress --prefer-dist --optimize-autoloader
- name: PHP cs fixer
working-directory: ${{ env.DIRECTORY }}
run: composer cs
- name: PHPStan
working-directory: ${{ env.DIRECTORY }}
run: composer ps
- name: Create database
working-directory: ${{ env.DIRECTORY }}
run: php bin/console doc:database:create --no-interaction -e test
env:
# DATABASE_URL: "mysql://user1:[email protected]:{{ job.services.mariadb.ports[3306] }}/auto_entreprise_test?serverVersion=10.9.6-MariaDB"
DATABASE_URL: ${{ format('mysql://user1:[email protected]:{0}/auto_entreprise_test?serverVersion=10.9.6-MariaDB', job.services.mariadb.ports[3306]) }}
- name: Migrate database
working-directory: ${{ env.DIRECTORY }}
run: php bin/console doc:mig:mig --no-interaction -e test
env:
DATABASE_URL: ${{ format('mysql://user1:[email protected]:{0}/auto_entreprise_test?serverVersion=10.9.6-MariaDB', job.services.mariadb.ports[3306]) }}
- name: Exec tests
working-directory: ${{ env.DIRECTORY }}
run: composer tuci
env:
DATABASE_URL: ${{ format('mysql://user1:[email protected]:{0}/auto_entreprise_test?serverVersion=10.9.6-MariaDB', job.services.mariadb.ports[3306]) }}
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
file: ${{ format('{0}/coverage.xml', env.DIRECTORY) }}
flags: backend
token: ${{ secrets.CODECOV_TOKEN }}