Skip to content

PHP 8+ / Move CI to GHA #18

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

Merged
merged 7 commits into from
Mar 29, 2024
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
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab
indent_size = 8

[{*.yml,*.yaml}]
indent_style = space
indent_size = 2
19 changes: 19 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ignore all test and documentation for archive
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/.editorconfig export-ignore
/codecov.yml export-ignore
/.remarkrc export-ignore
/.remarkignore export-ignore
/behat.yml export-ignore
/phpunit.xml.dist export-ignore
/phpcs.xml.dist export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/Makefile export-ignore
/tests export-ignore
/features export-ignore
/docs export-ignore
3 changes: 3 additions & 0 deletions .github/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.yml]
indent_style = space
indent_size = 2
42 changes: 21 additions & 21 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 2
updates:
#
#
# [GHAction]
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/github-action.yml file
#
#
#
# [GHAction]
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/github-action.yml file
#
- package-ecosystem: github-actions
directory: /
schedule:
Expand All @@ -14,22 +14,22 @@ updates:
prefix: '[dependabot][ghaction] - ' # No need to specify prod/dev for GHAction as there is only "production" updates !
include: scope
groups:
# Group all basic updates inside the a single PR
# No need to split prod/dev as there is only prod updates
# Group all basic updates inside the a single PR
# No need to split prod/dev as there is only prod updates
all-actions:
applies-to: version-updates
patterns: ['*']
# Group all security updates inside the a single PR
# No need to split prod/dev as there is only prod updates
# +Most likely no need to split major and other updates either
# Group all security updates inside the a single PR
# No need to split prod/dev as there is only prod updates
# +Most likely no need to split major and other updates either
SECURITY-all:
applies-to: security-updates
patterns: ['*']
#
#
# [Composer]
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/composer.yml file
#
#
#
# [Composer]
# Based on https://github.com/yoanm/shared-config/blob/master/GitHub/dependabot/composer.yml file
#
- package-ecosystem: composer
directory: /
schedule: # Create PRs during week-ends, they will be ready on monday morning
Expand All @@ -41,9 +41,9 @@ updates:
prefix-development: '[dependabot][dev][composer] - '
include: scope
groups:
# Split basic updates by:
# - prod vs dev
# - major vs others (assuming packages properly follow semver !)
# Split basic updates by:
# - prod vs dev
# - major vs others (assuming packages properly follow semver !)
prod-majors:
applies-to: version-updates
dependency-type: production
Expand All @@ -62,9 +62,9 @@ updates:
applies-to: version-updates
dependency-type: development
patterns: ['*']
# Split security updates by:
# - prod vs dev
# - Major prod updates vs other prod updates
# Split security updates by:
# - prod vs dev
# - Major prod updates vs other prod updates
SECURITY-prod-major:
applies-to: security-updates
dependency-type: production
Expand Down
234 changes: 234 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
name: 'CI'

on: # Build any PRs and main branch changes
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
pull_request:
types:
- opened
- synchronize
push:
branches: [ master ]
schedule:
- cron: '0 0 1 * *' # Every month

concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
cancel-in-progress: true

env:
TEST_OUTPUT_STYLE: pretty
COMPOSER_OPTIONS: --optimize-autoloader

jobs:
tests:
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
runs-on: ubuntu-latest
env:
COVERAGE_TYPE: none
strategy:
fail-fast: true
max-parallel: 4
matrix:
include:
# Bare minimum => Lowest versions allowed by composer config
- symfony-version: '4.4'
php-version: '8.0'
composer-flag: --prefer-lowest
# Up to date versions => Latest versions allowed by composer config
- symfony-version: '5.4'
php-version: '8.2'
# Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config
- symfony-version: '4.4'
php-version: '8.2'
composer-flag: --prefer-lowest
# Late php migration => Latest symfony version with lowest minor php version allowed by composer config
- symfony-version: '5.4'
php-version: '8.0'
# Symfony 6.0 latest
- symfony-version: '6.0'
php-version: '8.2'
# Symfony 6.0 lowest
- symfony-version: '6.0'
php-version: '8.0'
composer-flag: --prefer-lowest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Enable coverage
if: ${{ matrix.php-version == '8.2' }}
run: |
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
env:
update: true # Always use latest available patch for the version
fail-fast: true # step will fail if an extension or tool fails to set up
with:
php-version: '${{ matrix.php-version }}'
tools: composer
coverage: ${{ env.COVERAGE_TYPE }}

- name: Setup cache
id: cache
uses: actions/cache@v4
with:
path: |
~/.composer
./vendor
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}

- name: Build
run: |
SF_VERSION=${{ matrix.symfony-version }}
# Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc
test '${{ matrix.symfony-version }}' = '4.4' && test '${{ matrix.php-version }}' = '8.2' && SF_VERSION=4.4.30
composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
symfony/config:^$SF_VERSION \
symfony/dependency-injection:^$SF_VERSION \
symfony/http-kernel:^$SF_VERSION \
symfony/event-dispatcher:^$SF_VERSION \
symfony/framework-bundle:^$SF_VERSION \
symfony/routing:^$SF_VERSION \
&& composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
&& make build

- name: Tests
run: make test-unit && make test-functional

- name: Create "unit tests" reports group
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
id: unit-tests-coverage-group
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
with:
name: unit-tests
format: clover
files: build/coverage-phpunit/unit.clover
flags: |
unit-tests
php-${{ matrix.php-version }}
sf-${{ matrix.symfony-version }}
path: build/coverage-groups

- name: Create "functional tests" coverage group
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
id: functional-tests-coverage-group
uses: yoanm/temp-reports-group-workspace/.github/actions/create-action@develop
with:
name: functional-tests
format: clover
files: |
build/coverage-phpunit/functional.clover
build/coverage-behat/clover.xml
flags: |
functional-tests
php-${{ matrix.php-version }}
sf-${{ matrix.symfony-version }}
path: build/coverage-groups

- name: Upload coverage reports
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
uses: actions/upload-artifact@v4
with:
name: coverage-groups-php${{ matrix.php-version }}-sf${{ matrix.symfony-version }}
path: build/coverage-groups
if-no-files-found: error

static-checks:
name: Static checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2 # Latest supported
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true

- name: Setup cache
id: cache
uses: actions/cache@v3
with:
path: |
~/.composer
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}

- name: Build
run: make build

- name: ComposerRequireChecker
uses: docker://webfactory/composer-require-checker:4.5.0

- name: Dependencies check
if: ${{ github.event_name == 'pull_request' }}
uses: actions/dependency-review-action@v1

nightly-tests:
name: Nightly - Symfony ${{ matrix.symfony-version }}
runs-on: ubuntu-latest
env:
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
continue-on-error: true
needs: [ static-checks, tests ]
strategy:
fail-fast: false
max-parallel: 4
matrix:
php-version:
- '8.3' # Current php dev version
symfony-version:
- '4.4' # Lowest LTS
- '5.4' # Latest LTS
- '6.0' # Current major version
include:
- symfony-version: '6.3' # Next symfony minor version to manage with latest supported PHP version
php-version: '8.2'

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php-version }}'
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true

- name: Setup cache
id: cache
uses: actions/cache@v3
with:
path: |
~/.composer
./vendor
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}

- name: Build
run: |
composer config minimum-stability dev \
&& composer require -W ${{ env.COMPOSER_OPTIONS }} \
symfony/config:^${{ matrix.symfony-version }} \
symfony/dependency-injection:^${{ matrix.symfony-version }} \
symfony/http-kernel:^${{ matrix.symfony-version }} \
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
symfony/framework-bundle:^${{ matrix.symfony-version }} \
symfony/routing:^${{ matrix.symfony-version }} \
&& composer update ${{ env.COMPOSER_OPTIONS }} \
&& make build

- name: Test
run: make test-unit && make test-functional
1 change: 1 addition & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor
6 changes: 6 additions & 0 deletions .remarkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [
"remark-preset-lint-consistent",
"remark-preset-lint-recommended"
]
}
Loading