Skip to content

Commit

Permalink
Merge pull request #102 from Exercise/sf-7
Browse files Browse the repository at this point in the history
Allow Symfony 7
  • Loading branch information
HeahDude authored Nov 16, 2023
2 parents 526c98e + 70e4021 commit 3a64204
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 79 deletions.
103 changes: 36 additions & 67 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,14 @@ on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['7.1', '8.1']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json, mbstring, pdo
env:
update: true

- name: Validate composer.json
run: composer validate --strict

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Install Lowest Composer dependencies
if: "matrix.php-versions < '8.1'"
run: composer update --prefer-lowest --no-progress --prefer-dist --optimize-autoloader

- name: Install PHPUnit
run: vendor/bin/simple-phpunit install

- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
php-version: ${{ matrix.php-versions }}

qa:
name: Quality
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['8.1']
php-versions:
- 8.2

steps:
- name: Checkout
Expand All @@ -68,28 +23,38 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, intl, dom, filter
tools: symfony
env:
update: true

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
run: composer install --working-dir=qa/php-cs-fixer

- name: PHP-CS-Fixer
run: symfony php ./vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --verbose --diff
run: ./qa/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --verbose --diff

test:
name: Tests
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['7.1', '8.1']
php-versions:
- 8.1
- 8.2
symfony-versions:
- 5.4.*
- 6.3.*
- 6.4.*
- 7.0.*
dependencies:
- ''
include:
- php-versions: '8.1'
symfony-versions: '5.4.*'
dependencies: 'lowest'
exclude:
- php-versions: '8.1'
symfony-versions: '7.0.*'

steps:
- name: Checkout
Expand All @@ -99,21 +64,25 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, intl, dom, filter
tools: symfony
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, json
tools: flex
env:
update: true

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Install Composer
if: "matrix.dependencies == ''"
run: composer update --no-progress --ansi --prefer-stable
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-versions }}

- name: Install Lowest Composer dependencies
if: "matrix.php-versions < '8.1'"
run: composer install --no-progress --prefer-dist --optimize-autoloader
if: "matrix.dependencies == 'lowest'"
run: composer update --no-progress --ansi --prefer-stable --prefer-lowest
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-versions }}

- name: Validate composer
run: composer validate --strict --no-check-lock

- name: Execute unit tests
run: symfony php ./vendor/bin/simple-phpunit
run: ./vendor/bin/simple-phpunit
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,5 +324,5 @@ previous, and "all" could define its own rules too.

## Contributing

PRs are welcomed :). Please target the `3.x` branch for bug fixes and `master`
PRs are welcomed :). Please target the `4.x` branch for bug fixes and `master`
for new features.
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
}
],
"require": {
"php": "^7.1.3 || ^8.0.0",
"php": "^8.1",
"ezyang/htmlpurifier": "~4.14",
"symfony/config": "~4.4 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.0 || ^6.0"
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"symfony/form": "^4.4 || ^5.0 || ^6.0",
"symfony/phpunit-bridge": "^6.0",
"twig/twig": "^1.35.0 || ^2.4.4 || ^3.0"
"symfony/form": "^5.4 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^7.0",
"twig/twig": "^2.4.4 || ^3.0"
},
"autoload": {
"psr-4": { "Exercise\\HTMLPurifierBundle\\": "src/" }
Expand All @@ -35,7 +34,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
"dev-master": "5.x-dev"
}
}
},
"minimum-stability": "dev"
}
5 changes: 5 additions & 0 deletions qa/php-cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"friendsofphp/php-cs-fixer": "^3.38"
}
}
2 changes: 1 addition & 1 deletion src/CacheWarmer/SerializerCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(array $paths, array $profiles, HTMLPurifiersRegistry
$this->filesystem = $filesystem;
}

public function warmUp($cacheDir): array
public function warmUp($cacheDir, string $buildDir = null): array
{
foreach ($this->paths as $path) {
$this->filesystem->remove($path); // clean previous cache
Expand Down

0 comments on commit 3a64204

Please sign in to comment.