Skip to content

Commit bd21101

Browse files
committed
Switch to Github actions
1 parent 572e2d3 commit bd21101

File tree

9 files changed

+249
-250
lines changed

9 files changed

+249
-250
lines changed

.github/workflows/ci.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
phpstan:
6+
name: "PHPStan"
7+
runs-on: ubuntu-latest
8+
env:
9+
php-version: 8.0
10+
steps:
11+
- name: "Setup PHP"
12+
uses: shivammathur/setup-php@v2
13+
with:
14+
php-version: ${{ env.php-version }}
15+
tools: composer:v2, flex, cs2pr
16+
17+
- name: "Checkout code"
18+
uses: actions/checkout@v2
19+
20+
- name: "Install Composer dependencies"
21+
run: |
22+
composer install --prefer-dist --no-progress --no-suggest --no-interaction --optimize-autoloader
23+
24+
- name: "Run PHPStan"
25+
run: vendor/bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr
26+
27+
php-cs-fixer:
28+
name: PHP-CS-Fixer
29+
runs-on: ubuntu-latest
30+
env:
31+
php-version: 8.0
32+
steps:
33+
- name: "Setup PHP"
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: ${{ env.php-version }}
37+
tools: composer:v2, flex, cs2pr
38+
39+
- name: "Checkout code"
40+
uses: actions/checkout@v2
41+
42+
- name: "Install Composer dependencies"
43+
run: |
44+
composer install --prefer-dist --no-progress --no-suggest --no-interaction --optimize-autoloader
45+
46+
- name: "Run PHP-CS-Fixer"
47+
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr
48+
49+
phpunit:
50+
name: "PHPUnit"
51+
runs-on: ubuntu-latest
52+
strategy:
53+
max-parallel: 10
54+
fail-fast: true
55+
matrix:
56+
php: ['7.3', '7.4', '8.0']
57+
sf_version: ['4.4.*', '5.1.*', '5.2.*']
58+
steps:
59+
- name: "Setup PHP"
60+
uses: shivammathur/setup-php@v2
61+
with:
62+
php-version: ${{ matrix.php }}
63+
tools: composer:v2, flex
64+
coverage: none
65+
66+
- name: "Checkout code"
67+
uses: actions/checkout@v2
68+
69+
- name: "Install Composer dependencies"
70+
env:
71+
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
72+
run: composer update --no-interaction --optimize-autoloader
73+
74+
- name: "Run tests"
75+
env:
76+
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
77+
run: ./vendor/bin/simple-phpunit -v --testsuite main
78+
79+
phpunit-lowest:
80+
name: "PHPUnit (Lowest)"
81+
runs-on: ubuntu-latest
82+
strategy:
83+
max-parallel: 10
84+
fail-fast: true
85+
matrix:
86+
php: ['7.4']
87+
sf_version: ['4.4.*', '5.1.*', '5.2.*']
88+
steps:
89+
- name: "Setup PHP"
90+
uses: shivammathur/setup-php@v2
91+
with:
92+
php-version: ${{ matrix.php }}
93+
tools: composer:v2, flex
94+
coverage: none
95+
96+
- name: "Checkout code"
97+
uses: actions/checkout@v2
98+
99+
- name: "Install Composer dependencies"
100+
env:
101+
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
102+
run: composer update --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader
103+
104+
- name: "Run tests"
105+
env:
106+
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
107+
run: ./vendor/bin/simple-phpunit -v --testsuite main
108+
109+
doctrine:
110+
name: "PHPUnit (Doctrine)"
111+
runs-on: ubuntu-latest
112+
strategy:
113+
max-parallel: 10
114+
fail-fast: true
115+
matrix:
116+
php: ['7.3', '7.4', '8.0']
117+
sf_version: ['4.4.*', '5.1.*', '5.2.*']
118+
steps:
119+
- name: "Setup PHP"
120+
uses: shivammathur/setup-php@v2
121+
with:
122+
php-version: ${{ matrix.php }}
123+
tools: composer:v2, flex
124+
coverage: none
125+
126+
- name: "Checkout code"
127+
uses: actions/checkout@v2
128+
129+
- name: "Install Composer dependencies"
130+
env:
131+
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
132+
run: composer update --prefer-source --no-interaction --optimize-autoloader
133+
134+
- name: "Run tests"
135+
env:
136+
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
137+
run: ./vendor/bin/simple-phpunit -v --testsuite doctrine

.github/workflows/main.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

DataCollector/DataCollectorSymfonyCompatibilityTrait.php

Lines changed: 0 additions & 68 deletions
This file was deleted.

DataCollector/GeocoderDataCollector.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
namespace Bazinga\GeocoderBundle\DataCollector;
1414

1515
use Bazinga\GeocoderBundle\Plugin\ProfilingPlugin;
16+
use Symfony\Component\HttpFoundation\Request;
17+
use Symfony\Component\HttpFoundation\Response;
1618
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
1719

1820
/**
1921
* @author Michal Dabrowski <[email protected]>
2022
*/
2123
class GeocoderDataCollector extends DataCollector
2224
{
23-
use DataCollectorSymfonyCompatibilityTrait;
24-
2525
/**
2626
* @var ProfilingPlugin[]
2727
*/
@@ -43,6 +43,28 @@ public function reset()
4343
$this->data['providers'] = [];
4444
}
4545

46+
/**
47+
* {@inheritdoc}
48+
*/
49+
public function collect(Request $request, Response $response, \Throwable $exception = null)
50+
{
51+
if (!empty($this->data['queries'])) {
52+
// To avoid collection more that once.
53+
return;
54+
}
55+
56+
/** @var ProfilingPlugin[] $instances */
57+
$instances = $this->instances;
58+
59+
foreach ($instances as $instance) {
60+
foreach ($instance->getQueries() as $query) {
61+
$query['query'] = $this->cloneVar($query['query']);
62+
$query['result'] = $this->cloneVar($query['result']);
63+
$this->data['queries'][] = $query;
64+
}
65+
}
66+
}
67+
4668
/**
4769
* Returns an array of collected requests.
4870
*/

0 commit comments

Comments
 (0)