-
Notifications
You must be signed in to change notification settings - Fork 9
113 lines (95 loc) · 3.66 KB
/
integrate.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
name: "PHPUnit/PHPStan"
on:
push:
branches:
pull_request:
branches:
- "main"
- "develop"
permissions:
contents: "read"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
unit_tests:
name: "Unit and functional tests"
env:
APP_ENV: test
services:
mysql:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dam_test
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
#fail-fast: false
matrix:
php-version:
- "8.2"
runs-on: "ubuntu-latest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
- name: "Checkout code"
uses: "actions/checkout@v4"
- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
working-directory: "app"
- name: Run Migration
working-directory: "app"
run: |
php bin/console --env=test doctrine:migrations:migrate --no-interaction
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/dam
- name: "Execute unit tests"
working-directory: "app"
run: "vendor/bin/phpunit --testdox"
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/dam
static_analysis:
name: "Static Analysis"
runs-on: "ubuntu-latest"
env:
APP_ENV: test
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.2"
coverage: "none"
- name: "Checkout code"
uses: "actions/checkout@v3"
- name: "Check JSON files"
run: |
find . -type f -name '*.json' | xargs -t -L 1 -- php -r 'json_decode(file_get_contents($argv[1]), null, 512, JSON_THROW_ON_ERROR);'
- name: "Validate Composer configuration"
working-directory: "app"
run: "composer validate --no-interaction"
- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
working-directory: "app"
- name: "Install code style dependencies"
uses: "ramsey/composer-install@v3"
with:
working-directory: "app/tools/php-cs-fixer"
- name: "Check PSR-4 mapping"
working-directory: "app"
run: "composer dump-autoload --no-interaction --optimize --strict-psr"
- name: "Perform static analysis"
working-directory: "app"
run: "vendor/bin/phpstan analyse src tests -c phpstan.neon -l 9"
- name: "Code Style Check"
working-directory: "app"
run: "tools/php-cs-fixer/vendor/bin/php-cs-fixer check src --rules=@Symfony"
- name: "Validate Twig"
working-directory: "app"
run: "bin/console lint:twig templates"