Skip to content

Commit 81e9650

Browse files
authored
Merge pull request #220 from moufmouf/github_actions
Continuing enable Github Actions
2 parents 90cb180 + e9fc39b commit 81e9650

File tree

5 files changed

+344
-142
lines changed

5 files changed

+344
-142
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 278 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
pull_request:
55

66
jobs:
7-
static-analysis-phpstan:
8-
name: "Static Analysis with PHPStan"
7+
coding-standards:
8+
name: "Coding Standards"
99
runs-on: "ubuntu-latest"
1010

1111
strategy:
@@ -14,7 +14,7 @@ jobs:
1414
- "7.4"
1515

1616
steps:
17-
- name: "Checkout code"
17+
- name: "Checkout"
1818
uses: "actions/checkout@v2"
1919

2020
- name: "Install PHP"
@@ -34,11 +34,14 @@ jobs:
3434
- name: "Install dependencies with composer"
3535
run: "composer install --no-interaction --no-progress --no-suggest"
3636

37-
- name: "Run a static analysis with phpstan/phpstan"
38-
run: "composer phpstan -- --error-format=checkstyle | cs2pr"
37+
- name: "Run PHP-CS-Fixer on src/"
38+
run: "vendor/bin/php-cs-fixer fix src/ --dry-run --stop-on-violation --format=checkstyle | cs2pr"
3939

40-
coding-standards:
41-
name: "Coding Standards"
40+
- name: "Run PHP-CS-Fixer on tests/"
41+
run: "vendor/bin/php-cs-fixer fix tests/ --dry-run --stop-on-violation --format=checkstyle | cs2pr"
42+
43+
require-checker:
44+
name: "Composer require checker"
4245
runs-on: "ubuntu-latest"
4346

4447
strategy:
@@ -67,14 +70,11 @@ jobs:
6770
- name: "Install dependencies with composer"
6871
run: "composer install --no-interaction --no-progress --no-suggest"
6972

70-
- name: "Run PHP-CS-Fixer on src/"
71-
run: "vendor/bin/php-cs-fixer fix src/ --dry-run --stop-on-violation --report=checkstyle | cs2pr"
72-
73-
- name: "Run PHP-CS-Fixer on tests/"
74-
run: "vendor/bin/php-cs-fixer fix tests/ --dry-run --stop-on-violation --report=checkstyle | cs2pr"
73+
- name: "Run require-checker"
74+
run: "composer require-checker"
7575

7676
phpunit-mysql57:
77-
name: "PHPUnit on MySQL 5.7"
77+
name: "PHPUnit on MySQL 5.7 and PhpStan"
7878
runs-on: "ubuntu-latest"
7979

8080
strategy:
@@ -84,7 +84,7 @@ jobs:
8484

8585
services:
8686
mysql:
87-
image: "mysql: 5.7"
87+
image: "mysql:5.7"
8888
env:
8989
MYSQL_ALLOW_EMPTY_PASSWORD: true
9090
MYSQL_ROOT_PASSWORD:
@@ -99,8 +99,9 @@ jobs:
9999
uses: "shivammathur/setup-php@v2"
100100
with:
101101
php-version: "${{ matrix.php-version }}"
102-
extensions: "oci8"
102+
extensions: ""
103103
coverage: "pcov"
104+
tools: "cs2pr"
104105

105106
- name: "Cache dependencies installed with composer"
106107
uses: "actions/cache@v1"
@@ -113,13 +114,17 @@ jobs:
113114
run: "composer install --no-interaction --no-progress --no-suggest"
114115

115116
- name: "Run PHPUnit"
116-
run: "vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml"
117+
run: "vendor/bin/phpunit -c phpunit.mysql8.xml --coverage-clover=coverage.xml"
117118

118119
- name: "Upload Code Coverage"
119120
uses: "codecov/codecov-action@v1"
120121

121-
phpunit-oci8:
122-
name: "PHPUnit on OCI8"
122+
# PHPStan is run after PHPUnit because we want to analyze the generated files too.
123+
- name: "Run a static analysis with phpstan/phpstan"
124+
run: "composer phpstan -- --error-format=checkstyle | cs2pr"
125+
126+
phpunit-mysql8:
127+
name: "PHPUnit on MySQL 8"
123128
runs-on: "ubuntu-latest"
124129

125130
strategy:
@@ -128,10 +133,13 @@ jobs:
128133
- "7.4"
129134

130135
services:
131-
oracle:
132-
image: "wnameless/oracle-xe-11g-r2"
136+
mysql:
137+
image: "mysql:8"
138+
env:
139+
MYSQL_ALLOW_EMPTY_PASSWORD: true
140+
MYSQL_ROOT_PASSWORD:
133141
ports:
134-
- "1521:1521"
142+
- "3306:3306"
135143

136144
steps:
137145
- name: "Checkout"
@@ -141,7 +149,7 @@ jobs:
141149
uses: "shivammathur/setup-php@v2"
142150
with:
143151
php-version: "${{ matrix.php-version }}"
144-
extensions: "oci8"
152+
extensions: ""
145153
coverage: "pcov"
146154

147155
- name: "Cache dependencies installed with composer"
@@ -155,7 +163,254 @@ jobs:
155163
run: "composer install --no-interaction --no-progress --no-suggest"
156164

157165
- name: "Run PHPUnit"
158-
run: "vendor/bin/phpunit -c phpunit.oracle.xml --coverage-clover=coverage.xml"
166+
run: "vendor/bin/phpunit -c phpunit.mysql8.xml --coverage-clover=coverage.xml"
167+
168+
- name: "Upload Code Coverage"
169+
uses: "codecov/codecov-action@v1"
170+
171+
phpunit-prefer-lowest:
172+
name: "PHPUnit with prefer-lowest"
173+
runs-on: "ubuntu-latest"
174+
175+
strategy:
176+
matrix:
177+
php-version:
178+
- "7.4"
179+
180+
services:
181+
mysql:
182+
image: "mysql:8"
183+
env:
184+
MYSQL_ALLOW_EMPTY_PASSWORD: true
185+
MYSQL_ROOT_PASSWORD:
186+
ports:
187+
- "3306:3306"
188+
189+
steps:
190+
- name: "Checkout"
191+
uses: "actions/checkout@v2"
192+
193+
- name: "Install PHP"
194+
uses: "shivammathur/setup-php@v2"
195+
with:
196+
php-version: "${{ matrix.php-version }}"
197+
extensions: ""
198+
coverage: "pcov"
199+
200+
- name: "Cache dependencies installed with composer"
201+
uses: "actions/cache@v1"
202+
with:
203+
path: "~/.composer/cache"
204+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
205+
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
206+
207+
- name: "Install dependencies with composer"
208+
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"
209+
210+
- name: "Run PHPUnit"
211+
run: "vendor/bin/phpunit -c phpunit.mysql8.xml --coverage-clover=coverage.xml"
159212

160213
- name: "Upload Code Coverage"
161214
uses: "codecov/codecov-action@v1"
215+
216+
phpunit-mariadb105:
217+
name: "PHPUnit on MariaDB 10.5"
218+
runs-on: "ubuntu-latest"
219+
220+
strategy:
221+
matrix:
222+
php-version:
223+
- "7.4"
224+
225+
services:
226+
mysql:
227+
image: "mariadb:10.5"
228+
env:
229+
MYSQL_ROOT_PASSWORD: root
230+
ports:
231+
- "3306:3306"
232+
233+
steps:
234+
- name: "Checkout"
235+
uses: "actions/checkout@v2"
236+
237+
- name: "Install PHP"
238+
uses: "shivammathur/setup-php@v2"
239+
with:
240+
php-version: "${{ matrix.php-version }}"
241+
extensions: ""
242+
coverage: "pcov"
243+
244+
- name: "Cache dependencies installed with composer"
245+
uses: "actions/cache@v1"
246+
with:
247+
path: "~/.composer/cache"
248+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
249+
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
250+
251+
- name: "Install dependencies with composer"
252+
run: "composer install --no-interaction --no-progress --no-suggest"
253+
254+
- name: "Run PHPUnit"
255+
run: "vendor/bin/phpunit -c phpunit.mariadb.xml --coverage-clover=coverage.xml"
256+
257+
- name: "Upload Code Coverage"
258+
uses: "codecov/codecov-action@v1"
259+
260+
phpunit-postgresql:
261+
name: "PHPUnit on PostgreSQL"
262+
runs-on: "ubuntu-latest"
263+
264+
strategy:
265+
matrix:
266+
php-version:
267+
- "7.4"
268+
269+
services:
270+
postgres:
271+
image: postgres:12
272+
env:
273+
POSTGRES_PASSWORD: postgres
274+
ports:
275+
- "5432:5432"
276+
# Set health checks to wait until postgres has started
277+
options: >-
278+
--health-cmd pg_isready
279+
--health-interval 10s
280+
--health-timeout 5s
281+
--health-retries 5
282+
steps:
283+
- name: "Checkout"
284+
uses: "actions/checkout@v2"
285+
286+
- name: "Install PHP"
287+
uses: "shivammathur/setup-php@v2"
288+
with:
289+
php-version: "${{ matrix.php-version }}"
290+
extensions: "pgsql"
291+
coverage: "pcov"
292+
293+
- name: "Cache dependencies installed with composer"
294+
uses: "actions/cache@v1"
295+
with:
296+
path: "~/.composer/cache"
297+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
298+
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
299+
300+
- name: "Install dependencies with composer"
301+
run: "composer install --no-interaction --no-progress --no-suggest"
302+
303+
- name: "Run PHPUnit"
304+
run: "vendor/bin/phpunit -c phpunit.postgres.github.xml --coverage-clover=coverage.xml"
305+
306+
- name: "Upload Code Coverage"
307+
uses: "codecov/codecov-action@v1"
308+
309+
phpunit-phpbench:
310+
name: "PHPBench"
311+
runs-on: "ubuntu-latest"
312+
313+
strategy:
314+
matrix:
315+
php-version:
316+
- "7.4"
317+
318+
services:
319+
mysql:
320+
image: "mysql:8"
321+
env:
322+
MYSQL_ALLOW_EMPTY_PASSWORD: true
323+
MYSQL_ROOT_PASSWORD:
324+
ports:
325+
- "3306:3306"
326+
327+
steps:
328+
- name: "Checkout"
329+
uses: "actions/checkout@v2"
330+
with:
331+
fetch-depth: 0
332+
333+
- name: "Install PHP"
334+
uses: "shivammathur/setup-php@v2"
335+
with:
336+
php-version: "${{ matrix.php-version }}"
337+
extensions: ""
338+
coverage: "pcov"
339+
340+
- name: "Cache dependencies installed with composer"
341+
uses: "actions/cache@v1"
342+
with:
343+
path: "~/.composer/cache"
344+
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
345+
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
346+
347+
- name: "Install dependencies with composer"
348+
run: "composer install --no-interaction --no-progress --no-suggest"
349+
350+
- name: "Running PHPBench on current branch"
351+
run: "./phpbench.dist.sh run --tag=current_pr --store"
352+
353+
- name: "Switching to master branch"
354+
run: "git checkout master"
355+
356+
- name: "Updating dependencies"
357+
run: "composer update"
358+
359+
- name: "Running PHPBENCH on master branch for comparison"
360+
run: "./phpbench.dist.sh run --tag=master --store"
361+
362+
- name: "Generating comparison"
363+
run: "./phpbench.dist.sh report --uuid=tag:current_pr --uuid=tag:master --report='{extends: compare, compare: tag}'"
364+
365+
# phpunit-oci8:
366+
# name: "PHPUnit on OCI8"
367+
# runs-on: "ubuntu-latest"
368+
#
369+
# strategy:
370+
# matrix:
371+
# php-version:
372+
# - "7.4"
373+
#
374+
# services:
375+
# oracle:
376+
# image: "wnameless/oracle-xe-11g-r2"
377+
# ports:
378+
# - "1521:1521"
379+
#
380+
# steps:
381+
# - name: "Checkout"
382+
# uses: "actions/checkout@v2"
383+
#
384+
# - name: "Install PHP"
385+
# uses: "shivammathur/setup-php@v2"
386+
# with:
387+
# php-version: "${{ matrix.php-version }}"
388+
# extensions: "oci8"
389+
# coverage: "pcov"
390+
#
391+
# - name: "Cache dependencies installed with composer"
392+
# uses: "actions/cache@v1"
393+
# with:
394+
# path: "~/.composer/cache"
395+
# key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
396+
# restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
397+
#
398+
# - name: "Setup Oracle user"
399+
# run: |
400+
# docker exec $(docker ps -aqf "ancestor=wnameless/oracle-xe-11g-r2") bash -c "export PS1=1 && source /etc/bash.bashrc && source /root/.bashrc && sqlplus -L -S sys/oracle AS SYSDBA <<<SQL \
401+
# create user tdbm_admin identified by tdbm quota unlimited on USERS default tablespace USERS; \
402+
# GRANT CONNECT,RESOURCE TO tdbm_admin; \
403+
# GRANT dba TO tdbm_admin WITH ADMIN OPTION; \
404+
# grant create session, create procedure, create type, create table, create sequence, create view to tdbm_admin; \
405+
# grant select any dictionary to tdbm_admin; \
406+
# exit \
407+
# SQL"
408+
#
409+
# - name: "Install dependencies with composer"
410+
# run: "composer install --no-interaction --no-progress --no-suggest"
411+
#
412+
# - name: "Run PHPUnit"
413+
# run: "vendor/bin/phpunit -c phpunit.oracle.xml --coverage-clover=coverage.xml"
414+
#
415+
# - name: "Upload Code Coverage"
416+
# uses: "codecov/codecov-action@v1"

0 commit comments

Comments
 (0)