Skip to content

Commit

Permalink
minor #136 [CI] Add dedicated lint job + minor workflow tweaks (ogiza…
Browse files Browse the repository at this point in the history
…nagi)

This PR was squashed before being merged into the 1.x-dev branch.

Discussion
----------

[CI] Add dedicated lint job + minor workflow tweaks

Fixes #135 with some more tweaks

Commits
-------

bef3b5e [CI] Update tested Symfony versions
c00df54 Upgrade to Symfony phpunit bridge 5.3
26191a3 [CI] Add dedicated lint job + minor workflow tweaks
  • Loading branch information
ogizanagi committed May 31, 2021
2 parents a1717cc + bef3b5e commit 0fbdccf
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 82 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: CI

on:
push:
branches:
- master
pull_request: ~

jobs:

lint:
name: Lint
runs-on: 'ubuntu-latest'
timeout-minutes: 5

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

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

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

- name: 'Cache dependencies'
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: 'Install dependencies'
run: composer update --prefer-dist

- name: 'Check style'
run: vendor/bin/php-cs-fixer fix --dry-run --no-interaction --diff

test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 8
continue-on-error: ${{ matrix.allow-failure == 1 }}

strategy:
fail-fast: false
matrix:
include:
# Previous Symfony versions & lowest deps
- name: 'Test lowest deps [Linux, PHP 7.3]'
os: 'ubuntu-latest'
php: '7.3'
composer-flags: '--prefer-lowest'

# Previous Symfony versions
- name: 'Test 5.2 Symfony [Linux, PHP 8.0]'
os: 'ubuntu-latest'
symfony-version: '5.2.x'
php: '8.0'

# Previous PHP versions
- name: 'Test latest Symfony [Linux, PHP 7.3]'
os: 'ubuntu-latest'
php: '7.3'
composer-flags: '--prefer-lowest'

- name: 'Test latest Symfony [Linux, PHP 7.4]'
os: 'ubuntu-latest'
php: '7.4'

# Most recent versions
- name: 'Test latest Symfony [Linux, PHP 8.0] (with code coverage)'
os: 'ubuntu-latest'
php: '8.0'
code-coverage: true

- name: 'Test latest Symfony [Window, PHP 8.0]'
os: 'windows-latest'
php: '8.0'

# bleeding edge (unreleased dev versions where failures are allowed)
- name: 'Test Next Symfony [Linux, PHP 8.1] (allowed failure)'
os: 'ubuntu-latest'
php: '8.1'
symfony-version: '^5.4'
composer-flags: '--ignore-platform-req php'
allow-unstable: true
allow-failure: true

steps:
- name: 'Set git to use LF'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: 'Checkout'
uses: actions/checkout@v2

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

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

- name: 'Cache dependencies'
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: 'Allow unstable packages'
run: composer config prefer-stable false
if: ${{ matrix.allow-unstable }}

- name: 'Lock Symfony version'
run: composer require "symfony/symfony:${{ matrix.symfony-version }}" --no-update
if: ${{ matrix.symfony-version != '' }}

- name: 'Install dependencies'
run: composer update --prefer-dist ${{ matrix.composer-flags }}

- name: 'Run PHPUnit tests'
run: vendor/bin/simple-phpunit ${{ matrix.code-coverage && '--coverage-text --coverage-clover build/logs/clover.xml' }}
75 changes: 0 additions & 75 deletions .github/workflows/tests.yml

This file was deleted.

5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
###########

install:
composer remove --dev "symfony/symfony"
# Require "phpspec/prophecy" for PHPUnit 9 used when PHP 8+ is used
php -r "exit (PHP_MAJOR_VERSION == 8 ? 0 : 1);" \
&& composer config platform.php 7.4.99 \
&& composer require --dev --no-update "phpspec/prophecy-phpunit" || true
composer update

install-lowest:
composer require "symfony/symfony:^4.4" --no-update --no-interaction --dev
composer require "symfony/symfony:4.4.x" --no-update --no-interaction --dev
composer update --prefer-lowest

install-highest:
composer require "symfony/symfony:^5.3" --no-update --no-interaction --dev
composer require "symfony/symfony:5.4.x" --no-update --no-interaction --dev
composer update

########
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Elao Enumerations
[![Latest Stable Version](https://poser.pugx.org/elao/enum/v/stable?format=flat-square)](https://packagist.org/packages/elao/enum)
[![Total Downloads](https://poser.pugx.org/elao/enum/downloads?format=flat-square)](https://packagist.org/packages/elao/enum)
[![Monthly Downloads](https://poser.pugx.org/elao/enum/d/monthly?format=flat-square)](https://packagist.org/packages/elao/enum)
[![Tests](https://github.com/Elao/PhpEnums/actions/workflows/tests.yml/badge.svg)](https://github.com/Elao/PhpEnums/actions/workflows/tests.yml)
[![Tests](https://github.com/Elao/PhpEnums/actions/workflows/ci.yml/badge.svg)](https://github.com/Elao/PhpEnums/actions/workflows/ci.yml)
[![Coveralls](https://img.shields.io/coveralls/Elao/PhpEnums.svg?style=flat-square)](https://coveralls.io/github/Elao/PhpEnums)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Elao/PhpEnums.svg?style=flat-square)](https://scrutinizer-ci.com/g/Elao/PhpEnums/?branch=master)
[![php](https://img.shields.io/badge/PHP-7.3-green.svg?style=flat-square "Available for PHP 7.3+")](http://php.net)
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@
"symfony/css-selector": "^4.4|^5.1",
"symfony/form": "^4.4|^5.1",
"symfony/framework-bundle": "^4.4|^5.1",
"symfony/phpunit-bridge": "^5.3.0-RC1",
"symfony/phpunit-bridge": "^5.3",
"symfony/serializer": "^4.4|^5.1",
"symfony/symfony": "^4.4",
"symfony/translation": "^4.4|^5.1",
"symfony/twig-bundle": "^4.4|^5.1",
"symfony/validator": "^4.4|^5.1",
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/Integration/Symfony/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ framework:
strict_requirements: '%kernel.debug%'
utf8: true
test: ~
session:
storage_id: 'session.storage.mock_file'
assets: false

twig:
Expand Down
3 changes: 3 additions & 0 deletions tests/Fixtures/Integration/Symfony/config/config_5.3.0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
session:
storage_factory_id: 'session.storage.factory.mock_file'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
session:
storage_id: 'session.storage.mock_file'
6 changes: 6 additions & 0 deletions tests/Fixtures/Integration/Symfony/src/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public function registerBundles()
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getProjectDir() . '/config/config.yml');

if (self::VERSION_ID < 50300) {
$loader->load($this->getProjectDir() . '/config/config_prev_5.3.0.yml');
} else {
$loader->load($this->getProjectDir() . '/config/config_5.3.0.yml');
}
}

public function getProjectDir()
Expand Down

0 comments on commit 0fbdccf

Please sign in to comment.