Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add Makefile + fix CI GHA workflow #81

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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