Skip to content

Commit

Permalink
chore(ci): add Makefile + fix CI GHA workflow (#81)
Browse files Browse the repository at this point in the history
* chore(ci): add Makefile + fix coding style

* chore(ci): use ubuntu-latest
  • Loading branch information
Oliboy50 authored Oct 10, 2023
1 parent 994dad8 commit ca1074a
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

tests:
name: Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
version: ['8.0', '8.1']
Expand Down
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
SHELL=bash
SOURCE_DIR = $(shell pwd)
BIN_DIR = ${SOURCE_DIR}/bin
COMPOSER = composer

define printSection
@printf "\033[36m\n==================================================\n\033[0m"
@printf "\033[36m $1 \033[0m"
@printf "\033[36m\n==================================================\n\033[0m"
endef

.PHONY: all
all: install quality test test-dependencies

.PHONY: ci
ci: quality test

.PHONY: install
install: clean-vendor composer-install

.PHONY: quality
quality: cs-ci

.PHONY: quality-fix
quality-fix: cs-fix

.PHONY: test
test: atoum

.PHONY: cs
cs:
${BIN_DIR}/php-cs-fixer fix --dry-run --stop-on-violation --diff

.PHONY: cs-fix
cs-fix:
${BIN_DIR}/php-cs-fixer fix

.PHONY: cs-ci
cs-ci:
${BIN_DIR}/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose

.PHONY: clean-vendor
clean-vendor:
$(call printSection,CLEAN-VENDOR)
rm -f ${SOURCE_DIR}/composer.lock
rm -rf ${SOURCE_DIR}/vendor

.PHONY: composer-install
composer-install: ${SOURCE_DIR}/vendor/composer/installed.json

${SOURCE_DIR}/vendor/composer/installed.json:
$(call printSection,COMPOSER INSTALL)
$(COMPOSER) --no-interaction install --ansi --no-progress --prefer-dist

.PHONY: atoum
atoum:
$(call printSection,TEST atoum)
${BIN_DIR}/atoum

10 changes: 5 additions & 5 deletions src/M6Web/Bundle/LogBridgeBundle/Config/FilterParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ protected function getAllRoutes(): array
public function parse(string $name, array $config): Filter
{
if (
(!array_key_exists('route', $config) && !array_key_exists('routes', $config)) ||
!array_key_exists('method', $config) ||
!array_key_exists('status', $config)
(!array_key_exists('route', $config) && !array_key_exists('routes', $config))
|| !array_key_exists('method', $config)
|| !array_key_exists('status', $config)
) {
throw new ParseException(sprintf('Undefined "route(s)", "method" or "status" parameter from filter "%s"', $name));
}
Expand Down Expand Up @@ -168,8 +168,8 @@ public function setFilterClass(string $filterClass): self
$reflection = new \ReflectionClass($filterClass);

if (
!$reflection->isInstantiable() ||
!$reflection->isSubclassOf(Filter::class)
!$reflection->isInstantiable()
|| !$reflection->isSubclassOf(Filter::class)
) {
throw new \RuntimeException(sprintf('"%s" is not instantiable or is not a subclass of "%s"', $filterClass, Filter::class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ protected function getUsername(): string
}

// compatibility Symfony < 6
if (!method_exists($token, 'getUserIdentifier') &&
method_exists($token, 'getUsername')) {
if (!method_exists($token, 'getUserIdentifier')
&& method_exists($token, 'getUsername')) {
return $token->getUsername();
}

Expand Down

0 comments on commit ca1074a

Please sign in to comment.