Skip to content
Merged

V1 #51

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
22 changes: 22 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM php:8.5-cli-trixie

RUN apt-get update && apt-get install -y --no-install-recommends \
file \
git \
openssh-client \
&& rm -rf /var/lib/apt/lists/*

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN set -eux; \
install-php-extensions \
@composer \
apcu \
opcache \
xdebug \
;

RUN useradd -m vscode

USER vscode
WORKDIR /workspace
39 changes: 39 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "A2LiX - AutoFormBundle",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"bmewburn.vscode-intelephense-client",
"xdebug.php-debug",
"SanderRonde.phpstan-vscode"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"intelephense.telemetry.enabled": false,
"phpstan.checkValidity": true,
"workbench.colorCustomizations": {
"statusBar.background": "#ffa600d3",
"statusBar.noFolderBackground": "#ffa600d3",
"statusBar.debuggingBackground": "#ffa600d3",
"activityBar.activeBorder": "#ffa600d3",
"activityBarBadge.background": "#ffa600d3",
"badge.background": "#ffa600d3",
"focusBorder": "#ffa600d3",
"progressBar.background": "#ffa600d3",
"notificationCenter.border": "#ffa600d3",
"notificationsInfoIcon.foreground": "#ffa600d3",
"pickerGroup.border": "#ffa600d3",
"settings.modifiedItemIndicator": "#ffa600d3",
"panelTitle.activeBorder": "#ffa600d3",
"list.activeSelectionBackground": "#6e6e6e",
"list.inactiveSelectionBackground": "#6e6e6e",
"list.hoverBackground": "#6e6e6e",
},
}
}
},
"remoteUser": "vscode"
}
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[{compose.yaml,compose.*.yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
260 changes: 137 additions & 123 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,128 +1,142 @@
name: CI

on: ["push", "pull_request"]
on:
push:
pull_request:

env:
COMPOSER_ALLOW_SUPERUSER: '1'
SYMFONY_DEPRECATIONS_HELPER: max[self]=0
permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
container:
image: php:8.3-alpine
options: >-
--tmpfs /tmp:exec
--tmpfs /var/tmp:exec
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Composer
run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-8.3-highest-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-8.3-highest
- name: Validate Composer
run: composer validate
- name: Install highest dependencies with Composer
run: composer update --no-progress --no-suggest --ansi
- name: Disable PHP memory limit
run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini
- name: Run CS-Fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format=checkstyle

phpunit:
name: PHPUnit (PHP ${{ matrix.php }} Deps ${{ matrix.dependencies }})
runs-on: ubuntu-latest
container:
image: php:${{ matrix.php }}-alpine
options: >-
--tmpfs /tmp:exec
--tmpfs /var/tmp:exec
strategy:
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
dependencies:
- 'lowest'
- 'highest'
include:
- php: '8.1'
phpunit-version: 10
- php: '8.2'
phpunit-version: 10
- php: '8.3'
phpunit-version: 10
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Composer
run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.dependencies }}
- name: Install lowest dependencies with Composer
if: matrix.dependencies == 'lowest'
run: composer update --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi
- name: Install highest dependencies with Composer
if: matrix.dependencies == 'highest'
run: composer update --no-progress --no-suggest --ansi
- name: Run tests with PHPUnit
env:
SYMFONY_MAX_PHPUNIT_VERSION: ${{ matrix.phpunit-version }}
run: vendor/bin/simple-phpunit --colors=always

# coverage:
# name: Coverage (PHP 8.3)
# runs-on: ubuntu-latest
# container:
# image: php:8.3-alpine
# options: >-
# --tmpfs /tmp:exec
# --tmpfs /var/tmp:exec
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Install pcov PHP extension
# run: |
# apk add $PHPIZE_DEPS
# pecl install pcov
# docker-php-ext-enable pcov
# - name: Install Composer
# run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet
# - name: Get Composer Cache Directory
# id: composer-cache
# run: |
# echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
# - uses: actions/cache@v3
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-8.3-highest-${{ hashFiles('**/composer.json') }}
# restore-keys: |
# ${{ runner.os }}-composer-8.3-highest
# - name: Install highest dependencies with Composer
# run: composer update --no-progress --no-suggest --ansi
# - name: Run coverage with PHPUnit
# run: vendor/bin/simple-phpunit --coverage-clover ./coverage.xml --colors=always
# - name: Send code coverage report to Codecov.io
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: ${{ runner.os }}-php-8.5-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-8.5-composer-

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

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

- name: Run php-cs-fixer (dry run)
run: vendor/bin/php-cs-fixer fix --dry-run --diff --verbose

static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: ${{ runner.os }}-php-8.5-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-8.5-composer-

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

- name: Run phpstan
run: vendor/bin/phpstan analyse --memory-limit=2G

tests:
name: PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, deps ${{ matrix.composer_args }}
runs-on: ubuntu-latest
needs:
- lint
- static-analysis
continue-on-error: ${{ matrix.stability == 'dev' }}
strategy:
fail-fast: false
matrix:
include:
# Symfony 7.4 (stable)
- php: '8.5'
symfony: '7.4'
composer_args: '--prefer-stable'
stability: 'stable'
coverage: true
- php: '8.4'
symfony: '7.4'
composer_args: '--prefer-stable'
stability: 'stable'

# Symfony 8.0 (stable)
- php: '8.5'
symfony: '8.0'
composer_args: '--prefer-stable'
stability: 'stable'

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-${{ matrix.composer_args }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-${{ matrix.composer_args }}-

- name: symfony/flex is required to install the correct symfony version
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require symfony/flex --quiet

- name: Configure Composer stability
run: composer config minimum-stability ${{ matrix.stability }}

- name: Configure Symfony version for symfony/flex
run: composer config extra.symfony.require "${{ matrix.symfony }}.*"

- name: Install dependencies
run: composer update ${{ matrix.composer_args }} --no-progress --no-scripts --no-plugins

- name: Run phpunit
run: |
if [[ "${{ matrix.coverage }}" == "true" ]]; then
mkdir -p build/logs
vendor/bin/phpunit --coverage-clover coverage.xml
else
vendor/bin/phpunit
fi

- name: Upload coverage to Codecov
if: matrix.coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.php_cs.cache
.php-cs-fixer.cache
psalm-phpqa.xml
.phpunit.result.cache
.phpunit.cache
composer.lock
vendor/*

.DS_Store
dump.html
Loading