-
Notifications
You must be signed in to change notification settings - Fork 55
178 lines (157 loc) · 5.95 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
177
178
name: CI
on:
[push, pull_request, workflow_dispatch]
env:
APP_ENV: test
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-master"
jobs:
tests:
name: Tests (PHP ${{ matrix.php }} | composer ${{ matrix.composer_flags }} | ${{ matrix.doctrine_cache_driver }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: '8.0'
doctrine_cache_driver: 'memcached'
composer_flags: 'install'
- php: '8.0'
doctrine_cache_driver: 'array'
composer_flags: 'install'
services:
postgres:
image: postgres:9.6-alpine
ports:
- 5432/tcp
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
memcached:
image: memcached:1.6.5
ports:
- 11211:11211
rabbitmq:
image: rabbitmq:3.8.3
ports:
- 5672:5672
elasticsearch:
image: elasticsearch:7.10.1
ports:
- 9200:9200
options: -e="discovery.type=single-node"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "json,memcached,amqp,pdo_sqlite,pgsql,mbstring,xml,ctype,iconv,intl"
ini-values: "memory_limit=-1, post_max_size=100M, upload_max_filesize=100M"
php-version: "${{ matrix.php }}"
tools: pecl
- name: Display versions
run: |
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
php -i
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=directory::$(composer config cache-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-
- name: Install dependencies
run: composer $COMPOSER_FLAGS --prefer-dist --no-progress --ansi --optimize-autoloader
env:
COMPOSER_FLAGS: ${{ matrix.composer_flags }}
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Cache NPM
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install & run server.js
run: cd src/SWP/Bundle/CoreBundle/Tests/Functional/Resources/ && npm install json-server && nohup node server.js &
- name: Test loading fixtures from dev env in test env
run: |
echo "::group::database schema update"
php bin/console doctrine:schema:update -f --env=test
echo "::endgroup::"
echo "::group::load fixtures"
php bin/console doctrine:fixtures:load --env=test --no-interaction
echo "::endgroup::"
env:
FIXTURES_TYPE: dev
WEBP_CONVERSION_ENABLED: false
DOCTRINE_CACHE_DRIVER: ${{ matrix.doctrine_cache_driver }}
- name: Test migrations on Postgres
run: php bin/console doctrine:migrations:migrate --env=test --no-debug -vvv
env:
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
DOCTRINE_CACHE_DRIVER: ${{ matrix.doctrine_cache_driver }}
- name: Populate Elasticsearch index
run: |
curl -XDELETE http://127.0.0.1:9200/swp_index-test
php bin/console fos:elastica:populate --env=test
# - name: Run PHPSpec
# run: ./bin/phpspec run
#
# - name: Run Behat tests
# run: ./bin/behat -f progress -vvv --tags '~@custom-env&&~@webp'
# env:
# MEMCACHED_HOST: localhost
# DOCTRINE_CACHE_DRIVER: ${{ matrix.doctrine_cache_driver }}
#
# - name: Run Behat redirecting scenario
# run: ./bin/behat -f progress -vvv features/redirecting/redirecting_with_unpublished_article.feature
# env:
# REDIRECT_NOT_FOUND_ARTICLES_TO_ROUTE: true
# DOCTRINE_CACHE_DRIVER: ${{ matrix.doctrine_cache_driver }}
- name: Run PHPUnit tests
run: |
echo "::group::phpunit stderr"
bin/phpunit --stderr src/SWP/Bundle/CoreBundle/Tests/Security/Storage/DynamicDomainSessionStorageTest.php
bin/phpunit --stderr src/SWP/Bundle/CoreBundle/Tests/Controller/AuthControllerTest.php
bin/phpunit --stderr src/SWP/Bundle/CoreBundle/Tests/Controller/RegistrationControllerTest.php
echo "::endgroup::"
echo "::group::phpunit run"
bin/phpunit
echo "::endgroup::"
env:
DOCTRINE_CACHE_DRIVER: ${{ matrix.doctrine_cache_driver }}
# - name: Run PHPUnit Bridge Bundle tests
# run: |
# cd src/SWP/Bundle/BridgeBundle
# composer update --prefer-dist --no-progress --ansi
# bin/phpunit
#
# - name: Run PHPUnit Content Bundle tests
# run: |
# cd src/SWP/Bundle/ContentBundle
# composer update --prefer-dist --no-progress --ansi --no-cache
# bin/phpunit
# env:
# REDIRECT_NOT_FOUND_ARTICLES_TO_ROUTE: false
#
# - name: Run PHPUnit Settings Bundle tests
# run: |
# cd src/SWP/Bundle/SettingsBundle
# composer update --prefer-dist --no-progress --ansi
# bin/phpunit
#
# - name: Run PHPUnit User Bundle tests
# run: |
# cd src/SWP/Bundle/UserBundle
# composer update --prefer-dist --no-progress --ansi
# bin/phpunit --stder