Skip to content

Commit

Permalink
Core dependency and tool updates with PHP 8.1
Browse files Browse the repository at this point in the history
make boot fix with php 8.1

bumped dependencies

refactored rector config file

refactored github workflows

added temporary phpstan baseline to keep track on what to fix

phpstan; resolved meilisearch incorrect case

phpstan; added phpstan phpunit dev depenecies; started fixing tests

removing doctrine annotations; replaced document annotation with attribute; further fixing tests

phpunit fixed errors, left with 19 failures

fixed test regarding document reader

bumped psr/log constraint

fixed constraints back for apt in dockerfile

no lowerest composer install for phpcs phpstan and phpunit workflows

ran phpcs fixer with created config

ran phpcs fixer for tests directory

updated phpstan parameters

added gitattributes, updated gitignore, removed composer.lock

fixed renaming annotation to attribute in docs + composer.json tests namespace

updated rector with skip rules

ran rector + phpcsfixer

updated badges for workflows in readme

fixed typo in readme

updated readme for support 8.1 and up

phpunit fixes; left with search extension failure test

phpunit resolved final test cases

tried running infection with fixed config; i have no idea what core files are that are generated

phpstan ignoreerrors and start fixing

reformating codestyle

phpstan issues resolved mostly by phpdoc typing

ran phpcsfixer

updated gitattributes

added command attributes

added asmessagehandler attributes
  • Loading branch information
ToshY committed Nov 19, 2023
1 parent f84828e commit 29d1d49
Show file tree
Hide file tree
Showing 217 changed files with 3,886 additions and 12,921 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/.github export-ignore
/doc export-ignore
/docker export-ignore
/tests export-ignore
.dockerignore export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.dockerignore export-ignore
.php-cs-fixer.dist.php export-ignore
docker-compose.override.yml.dist export-ignore
docker-compose.yml export-ignore
infection.json5.dist export-ignore
Makefile export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
rector.php export-ignore
75 changes: 0 additions & 75 deletions .github/workflows/daily.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: PHPCS

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
phpcs:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions:
- '8.1'
- '8.2'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: zip, xdebug
coverage: xdebug
env:
update: true

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40

- name: PHP CS Fixer
run: |
CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | tr ' ' '\n')
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --diff --using-cache=no ${EXTRA_ARGS}
38 changes: 38 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHPStan

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions:
- '8.1'
- '8.2'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: zip, xdebug
coverage: xdebug
env:
update: true

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: PHPStan
run: php vendor/bin/phpstan analyse --error-format=github
41 changes: 41 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PHPUnit

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions:
- '8.1'
- '8.2'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: zip, xdebug
coverage: xdebug
env:
update: true

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: PHPUnit
run: php vendor/bin/phpunit tests

- name: Infection
run: php vendor/bin/infection --threads=max
50 changes: 15 additions & 35 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
name: MeiliSearchBundle CI
on: [push]

on:
push:
branches:
- master

jobs:
meili_search:
name: PHP ${{ matrix.php-versions }} - ${{ matrix.composer-dependencies }}
# https://hub.docker.com/_/ubuntu/
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions:
- '8.1'
- '8.2'
composer-dependencies: ['', 'lowest']
steps:
# https://github.com/actions/checkout (official)
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# https://github.com/azohra/shell-linter (community)
- name: Lint check
uses: azohra/shell-linter@v0.3.0
with:
path: "docker/php"

# https://github.com/shivammathur/setup-php (community)
- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
Expand All @@ -31,20 +29,16 @@ jobs:
env:
update: true

# —— Composer️ —————————————————————————————————————————————————————
- name: Validate composer.json and composer.lock
run: composer validate

# —— Security ——————————————————————————————————————————————————————
- name: Symfony Security Checker
uses: symfonycorp/security-checker-action@v2

- name: Get composer cache directory
- name: Get composer cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v1
uses: actions/cache@v3.3.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.composer-dependencies }}-${{ hashFiles('**/composer.lock') }}
Expand All @@ -57,17 +51,3 @@ jobs:
- name: Install Composer dependencies - Lowest
if: matrix.composer-dependencies == 'lowest'
run: composer update --prefer-lowest

# —— Style —————————————————————————————————————————————————————————
- name: PHP-CS-FIXER
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run .

# —— PHPUnit ———————————————————————————————————————————————————————
- name: PHPUnit
run: php vendor/bin/phpunit tests

# —— Infection —————————————————————————————————————————————————————
- name: Infection
run: php vendor/bin/infection --no-progress --min-covered-msi=95 --min-msi=95
23 changes: 23 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Security Check

on:
schedule:
- cron: '0 0 * * *'

jobs:
build:
name: Security Check
runs-on: ubuntu-latest

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

- name: Check for vulnerabilities
uses: symfonycorp/security-checker-action@v5
with:
disable-exit-code: 1
id: security-check

- name: Display vulnerabilities as JSON
run: echo ${{ steps.security-check.outputs.vulns }}
22 changes: 22 additions & 0 deletions .github/workflows/shell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Shell Linter

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
shell_linter:
name: Shell Linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint check
uses: azohra/shell-linter@v0.6.0
with:
path: "docker/php"
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ docker-compose.override.yml

# Composer
vendor
composer.lock

# Meili
docker/meili/data.ms
Expand All @@ -13,7 +14,15 @@ summary.log

# PHPStan
.php_cs.cache
phpstan.neon

# PHPUnit
phpunit.xml
.phpunit.result.cache
reports

# Infection
core.*

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

$finder = (new PhpCsFixer\Finder())
->exclude(__DIR__ . '/vendor')
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php');

return (new PhpCsFixer\Config())
->setUsingCache(false)
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
])->setFinder($finder);
Loading

0 comments on commit 29d1d49

Please # to comment.