-
Notifications
You must be signed in to change notification settings - Fork 20
168 lines (135 loc) · 5.96 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
name: CI
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
CI: true
COVERAGE: true
TZ: UTC
PHP_VERSION: 7.4
NODE_VERSION: 10.x
COMPOSER_ALLOW_SUPERUSER: '1' # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
# Application
APP_ENV: test
APP_DEBUG: 0
DATABASE_SERVER_VERSION: 11 # update service "postgresql" if this value change
PANTHER_CHROME_DRIVER_BINARY: /usr/bin/chromedriver
jobs:
php:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11 # update env variable "DATABASE_SERVER_VERSION" if the version change
env:
POSTGRES_PASSWORD: password
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: set DATABASE_URL environment variable
run: echo "DATABASE_URL=pgsql://postgres:password@127.0.0.1:${PGSQL_PORT}/postgres" >> $GITHUB_ENV
env:
PGSQL_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: pcov
extensions: ctype, iconv, intl
ini-values: date.timezone=UTC, memory_limit=-1, session.gc_probability=0, opcache.enable=1, opcache.enable_cli=1, opcache.memory_consumption=256, opcache.max_accelerated_files=20000, opcache.validate_timestamps=0, realpath_cache_size=4096K, realpath_cache_ttl=600
tools: cs2pr, symfony
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: get-composer-cache-dir
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer
uses: actions/cache@v1
with:
path: ${{ steps.get-composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- run: composer validate
if: always()
- name: Install composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Cache node_modules
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- run: yarn install --frozen-lockfile
- run: yarn encore production
# PHPStan needs the var/cache/test/App_KernelTestContainer.xml file to exist
- run: APP_DEBUG=1 bin/console cache:warmup
if: always()
- run: bin/console lint:twig templates
if: always()
- run: bin/console lint:yaml config --parse-tags
if: always()
- run: vendor/bin/php-cs-fixer fix --verbose --diff --dry-run --format=checkstyle | cs2pr
if: always()
- run: vendor/bin/phpcs --warning-severity=0 --report=checkstyle | cs2pr
working-directory: ${{ matrix.working_directory }}
if: always()
- name: Run PHPStan
run: vendor/bin/phpstan analyse --configuration phpstan.neon --level max --no-progress . --error-format=checkstyle | cs2pr
if: always()
- name: Bootstrap database
run: |
bin/console doctrine:database:create -n --if-not-exists
bin/console doctrine:migrations:migrate -n
bin/console doctrine:fixtures:load -n
if: always()
- name: Validate schema
run: |
bin/console doctrine:schema:validate
bin/console doctrine:mapping:info
if: always()
- name: Run phpunit tests
run: vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer --coverage-clover=coverage.xml
if: always()
- uses: codecov/codecov-action@v1
if: always()
with:
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run Behat tests
run: |
bin/post-install-test.sh
vendor/bin/behat --format=progress --out=std --format=junit --out=var/behat --tags '~@javascript'
if: always()
- uses: codecov/codecov-action@v1
if: always()
with:
file: ./var/behat/coverage.xml
flags: behat
token: ${{ secrets.CODECOV_TOKEN }}
javascript:
runs-on: ubuntu-latest
steps:
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/checkout@v2
- name: Cache node_modules
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- run: yarn install --frozen-lockfile
- run: yarn lint --no-fix
- run: yarn lint:css --no-fix