Skip to content

Commit

Permalink
Remove support for Symfony 5 and PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
sstok committed Nov 21, 2023
1 parent 76bc458 commit aef70d2
Show file tree
Hide file tree
Showing 23 changed files with 240 additions and 939 deletions.
14 changes: 7 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
* text=auto

# Always use LF
core.autocrlf=lf

.editorconfig
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
.github export-ignore
.php-cs-fixer.dist.php export-ignore
CODE_OF_CONDUCT.md export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
/tests export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
tests/ export-ignore
190 changes: 124 additions & 66 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Full CI process
name: 'CI'

on:
push:
branches:
Expand All @@ -8,92 +9,149 @@ on:
- main

jobs:
test:
name: PHP ${{ matrix.PHP_VERSION }}
runs-on: ubuntu-latest
cs-fixer:
name: 'PHP CS Fixer'

runs-on: 'ubuntu-latest'

strategy:
fail-fast: false
matrix:
include:
- PHP_VERSION: '7.1'
SYMFONY_REQUIRE: '^3.4'
- PHP_VERSION: '7.2'
SYMFONY_REQUIRE: '^4.4'
- PHP_VERSION: '7.3'
SYMFONY_REQUIRE: '^5.0'
- PHP_VERSION: '7.4'
SYMFONY_REQUIRE: '^5.2'
- PHP_VERSION: '8.0'
SYMFONY_REQUIRE: '^5.3'
- PHP_VERSION: '8.0'
SYMFONY_REQUIRE: '^6.0'
php-version:
- '8.2'

steps:
# —— Setup Github actions 🐙 —————————————————————————————————————————————
# https://github.com/actions/checkout (official)
-
name: Checkout
uses: actions/checkout@v2
name: 'Check out'
uses: 'actions/checkout@v4'

# https://github.com/shivammathur/setup-php (community)
-
name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: ${{ matrix.PHP_VERSION }}
extensions: mbstring, ctype, iconv, bcmath, filter, json
coverage: none
env:
update: true
php-version: '${{ matrix.php-version }}'
coverage: 'none'

# —— Composer 🧙‍️ —————————————————————————————————————————————————————————
-
name: Install Composer dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.SYMFONY_REQUIRE }}
SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1
SYMFONY_PHPUNIT_VERSION: '7.5.6'
run: |
git config --global author.name Sebastiaan Stok
git config --global author.email [email protected]
git config --global user.name Sebastiaan Stok
git config --global user.email [email protected]
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

-
name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

rm -f composer.lock
composer install --no-progress --no-interaction --optimize-autoloader --ansi
-
name: 'Install dependencies'
run: 'composer install --no-progress'

## —— Tests ✅ ———————————————————————————————————————————————————————————
-
name: Run Tests
run: |
make test
lint:
name: PHP-QA
runs-on: ubuntu-latest
name: 'Check the code style'
run: 'make cs'

phpstan:
name: 'PhpStan'

runs-on: 'ubuntu-latest'

strategy:
fail-fast: false
matrix:
php-version:
- '8.2'

steps:
-
name: Checkout
uses: actions/checkout@v2
name: 'Check out'
uses: 'actions/checkout@v4'

# https://github.com/shivammathur/setup-php (community)
-
name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '7.4'
extensions: mbstring, ctype, iconv, bcmath, filter, json
coverage: none
php-version: '${{ matrix.php-version }}'
coverage: 'none'

# —— Composer 🧙‍️ —————————————————————————————————————————————————————————
-
name: Install Composer dependencies
run: |
rm -f composer.lock
composer install --no-progress --no-interaction --no-suggest --optimize-autoloader --ansi
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

-
name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

-
name: 'Install dependencies'
run: 'composer install --no-progress'

-
name: Run PHP-QA
name: 'Run PhpStan'
run: 'vendor/bin/phpstan analyze --no-progress'

tests:
name: 'PHPUnit'

runs-on: 'ubuntu-latest'

strategy:
matrix:
include:
-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '6.3'
-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^6.4'

-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^7.0'

steps:
-
name: 'Check out'
uses: 'actions/checkout@v4'

-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'

-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

-
name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

-
name: 'Install dependencies'
env:
COMPOSER_OPTIONS: '${{ matrix.composer-options }}'
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
run: |
make cs-full
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer update --no-progress $COMPOSER_OPTIONS
-
name: 'Run tests'
run: make phpunit
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/phpunit.xml
/composer.lock
*.phar
composer.lock
/vendor/
/.php_cs.cache
symfony.lock

phpunit.xml
.phpunit.result.cache
.phpunit.cache/
.phpunit

.php-cs-fixer.cache
30 changes: 30 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

$header = <<<EOF
This file is part of the RollerworksPasswordStrengthBundle package.
(c) Sebastiaan Stok <[email protected]>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

/** @var \Symfony\Component\Finder\Finder $finder */
$finder = PhpCsFixer\Finder::create();
$finder
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules(
array_merge(
require __DIR__ . '/vendor/rollerscapes/standards/php-cs-fixer-rules.php',
['header_comment' => ['header' => $header]])
)
->setFinder($finder);

return $config;
33 changes: 0 additions & 33 deletions .php_cs

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2018 Sebastiaan Stok
Copyright (c) 2012-present Sebastiaan Stok

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 3 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
QA_DOCKER_IMAGE=jakzal/phpqa:1.34.1-php7.4-alpine
QA_DOCKER_COMMAND=docker run --init -t --rm --user "$(shell id -u):$(shell id -g)" --volume /tmp/tmp-phpqa-$(shell id -u):/tmp --volume "$(shell pwd):/project" --workdir /project ${QA_DOCKER_IMAGE}
include vendor/rollerscapes/standards/Makefile

dist: install cs-full phpstan test-full
lint: install security-check cs-full phpstan

install:
composer install --no-progress --no-interaction --no-suggest --optimize-autoloader --prefer-dist --ansi

test:
./vendor/bin/simple-phpunit --verbose

# Linting tools
security-check: ensure
sh -c "${QA_DOCKER_COMMAND} security-checker security:check ./composer.lock"

phpstan: ensure
sh -c "${QA_DOCKER_COMMAND} phpstan analyse --configuration phpstan.neon"

cs: ensure
sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --diff"

cs-full: ensure
sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=false --diff"

cs-full-check: ensure
sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=false --diff --dry-run"

ensure:
mkdir -p ${HOME}/.composer /tmp/tmp-phpqa-$(shell id -u)

.PHONY: install test phpstan cs cs-full cs-full-check
phpunit:
./vendor/bin/phpunit
Loading

0 comments on commit aef70d2

Please sign in to comment.