-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (153 loc) · 5.04 KB
/
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
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
name: CI
on: [ pull_request, push ]
jobs:
lint:
name: PHP Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: PHP Lint
uses: overtrue/phplint@9.1.2
ecs:
name: ECS Check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-ecs-${{ hashFiles('tools/ecs/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-ecs-
- name: Install vendors
working-directory: tools/ecs
run: composer install --no-interaction
- name: ECS
working-directory: app
run: $GITHUB_WORKSPACE/tools/ecs/vendor/bin/ecs check --config $GITHUB_WORKSPACE/tools/ecs/ecs.php --output-format=checkstyle
# rector:
# name: Rector
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
#
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: '8.3'
#
# - name: Cache Composer dependencies
# uses: actions/cache@v4
# with:
# path: ~/.composer/cache
# key: ${{ runner.os }}-composer-rector-${{ hashFiles('tools/rector/composer.lock') }}
# restore-keys: |
# ${{ runner.os }}-composer-rector-
#
# - name: Install vendors
# working-directory: tools/rector
# run: composer install --no-interaction
#
# - name: Rector
# working-directory: tools/rector
# run: $GITHUB_WORKSPACE/tools/rector/vendor/bin/rector process --dry-run --clear-cache --config=$GITHUB_WORKSPACE/tools/rector/rector.php
phpstan:
name: PHPStan
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-phpstan-${{ hashFiles('tools/phpstan/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-phpstan-
- name: Install dependencies
working-directory: app
run: composer install --no-interaction --no-scripts
- name: Install vendors
working-directory: tools/phpstan
run: composer install --no-interaction
- name: PHPStan
working-directory: app
run: $GITHUB_WORKSPACE/tools/phpstan/vendor/bin/phpstan analyse --configuration $GITHUB_WORKSPACE/tools/phpstan/phpstan.neon --memory-limit=1G --error-format=github
tests:
name: Run Tests
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: symfony
POSTGRES_PASSWORD: symfony
POSTGRES_DB: symfony_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-app-test-${{ hashFiles('app/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-app-test-
- name: Install vendors
working-directory: app
run: composer install --no-interaction
- name: Run Tests Setup
env:
APP_ENV: test
DATABASE_URL: "postgresql://symfony:symfony@127.0.0.1:5432/symfony_test?serverVersion=13"
working-directory: app
run: php bin/console doctrine:database:create --env=test
- name: Run Tests
working-directory: app
env:
APP_ENV: test
DATABASE_URL: "postgresql://symfony:symfony@127.0.0.1:5432/symfony_test?serverVersion=13"
run: $GITHUB_WORKSPACE/app/vendor/bin/phpunit --coverage-cobertura=coverage.xml
- name: Code Coverage Report
if: github.event_name == 'pull_request'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: ./app/coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Upload Coverage Report
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: app/coverage.xml
- name: Add Coverage PR Comment
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md