Skip to content

Commit ca1074a

Browse files
authored
chore(ci): add Makefile + fix CI GHA workflow (#81)
* chore(ci): add Makefile + fix coding style * chore(ci): use ubuntu-latest
1 parent 994dad8 commit ca1074a

File tree

4 files changed

+67
-8
lines changed

4 files changed

+67
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
tests:
1717
name: Tests
18-
runs-on: ubuntu-18.04
18+
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
2121
version: ['8.0', '8.1']

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
SHELL=bash
2+
SOURCE_DIR = $(shell pwd)
3+
BIN_DIR = ${SOURCE_DIR}/bin
4+
COMPOSER = composer
5+
6+
define printSection
7+
@printf "\033[36m\n==================================================\n\033[0m"
8+
@printf "\033[36m $1 \033[0m"
9+
@printf "\033[36m\n==================================================\n\033[0m"
10+
endef
11+
12+
.PHONY: all
13+
all: install quality test test-dependencies
14+
15+
.PHONY: ci
16+
ci: quality test
17+
18+
.PHONY: install
19+
install: clean-vendor composer-install
20+
21+
.PHONY: quality
22+
quality: cs-ci
23+
24+
.PHONY: quality-fix
25+
quality-fix: cs-fix
26+
27+
.PHONY: test
28+
test: atoum
29+
30+
.PHONY: cs
31+
cs:
32+
${BIN_DIR}/php-cs-fixer fix --dry-run --stop-on-violation --diff
33+
34+
.PHONY: cs-fix
35+
cs-fix:
36+
${BIN_DIR}/php-cs-fixer fix
37+
38+
.PHONY: cs-ci
39+
cs-ci:
40+
${BIN_DIR}/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose
41+
42+
.PHONY: clean-vendor
43+
clean-vendor:
44+
$(call printSection,CLEAN-VENDOR)
45+
rm -f ${SOURCE_DIR}/composer.lock
46+
rm -rf ${SOURCE_DIR}/vendor
47+
48+
.PHONY: composer-install
49+
composer-install: ${SOURCE_DIR}/vendor/composer/installed.json
50+
51+
${SOURCE_DIR}/vendor/composer/installed.json:
52+
$(call printSection,COMPOSER INSTALL)
53+
$(COMPOSER) --no-interaction install --ansi --no-progress --prefer-dist
54+
55+
.PHONY: atoum
56+
atoum:
57+
$(call printSection,TEST atoum)
58+
${BIN_DIR}/atoum
59+

src/M6Web/Bundle/LogBridgeBundle/Config/FilterParser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ protected function getAllRoutes(): array
6767
public function parse(string $name, array $config): Filter
6868
{
6969
if (
70-
(!array_key_exists('route', $config) && !array_key_exists('routes', $config)) ||
71-
!array_key_exists('method', $config) ||
72-
!array_key_exists('status', $config)
70+
(!array_key_exists('route', $config) && !array_key_exists('routes', $config))
71+
|| !array_key_exists('method', $config)
72+
|| !array_key_exists('status', $config)
7373
) {
7474
throw new ParseException(sprintf('Undefined "route(s)", "method" or "status" parameter from filter "%s"', $name));
7575
}
@@ -168,8 +168,8 @@ public function setFilterClass(string $filterClass): self
168168
$reflection = new \ReflectionClass($filterClass);
169169

170170
if (
171-
!$reflection->isInstantiable() ||
172-
!$reflection->isSubclassOf(Filter::class)
171+
!$reflection->isInstantiable()
172+
|| !$reflection->isSubclassOf(Filter::class)
173173
) {
174174
throw new \RuntimeException(sprintf('"%s" is not instantiable or is not a subclass of "%s"', $filterClass, Filter::class));
175175
}

src/M6Web/Bundle/LogBridgeBundle/Formatter/DefaultFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ protected function getUsername(): string
127127
}
128128

129129
// compatibility Symfony < 6
130-
if (!method_exists($token, 'getUserIdentifier') &&
131-
method_exists($token, 'getUsername')) {
130+
if (!method_exists($token, 'getUserIdentifier')
131+
&& method_exists($token, 'getUsername')) {
132132
return $token->getUsername();
133133
}
134134

0 commit comments

Comments
 (0)