Skip to content

Commit

Permalink
migrate travis to circle-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
benji07 committed Feb 18, 2022
1 parent 1f6cf54 commit 0f53519
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 115 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
workflow_dispatch: ~
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.1'

- name: 'Install dependencies'
run: make php-cs-fixer.phar

- name: 'Check style'
run: ./php-cs-fixer.phar 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:
# Lowest deps
- name: 'Test lowest deps [Linux, PHP 7.4]'
os: 'ubuntu-latest'
php: '7.4'
symfony: '4.4.*@dev'
composer-flags: '--prefer-lowest'
allow-unstable: true

# Most recent versions
- name: 'Test Symfony 5.4 [Linux, PHP 8.0]'
os: 'ubuntu-latest'
php: '8.0'
symfony: '5.4.*@dev'
allow-unstable: true

- name: 'Test Symfony 6.0 [Linux, PHP 8.1]'
os: 'ubuntu-latest'
php: '8.1'
symfony: '6.0.*@dev'
allow-unstable: true

# 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: '6.1.*@dev'
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 }}
extensions: pdo_sqlite
coverage: pcov
tools: 'composer:v2,flex'

- 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-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-${{ hashFiles('**/composer.json') }}-flags-${{ matrix.composer-flags }}
restore-keys: ${{ runner.os }}-composer-

- name: 'Allow unstable packages'
run: composer config minimum-stability dev
if: ${{ matrix.allow-unstable }}

- name: 'Install dependencies'
run: composer update --prefer-dist ${{ matrix.composer-flags }} --ansi
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"

- name: 'Run PHPUnit tests'
run: vendor/bin/simple-phpunit --testdox --verbose ${{ matrix.code-coverage && '--coverage-text --coverage-clover build/logs/clover.xml' }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor
composer.lock
.php_cs.cache
.php-cs-fixer.cache
php-cs-fixer.phar
.phpunit.result.cache
6 changes: 3 additions & 3 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
])
;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setUsingCache(true)
->setFinder($finder)
->setRules([
'@Symfony' => true,
'php_unit_namespaced' => true,
'psr0' => false,
'psr_autoloading' => true,
'concat_space' => ['spacing' => 'one'],
'phpdoc_summary' => false,
'phpdoc_annotation_without_dot' => false,
Expand All @@ -30,7 +30,7 @@
'ordered_imports' => true,
'simplified_null_return' => false,
'header_comment' => ['header' => $header],
'yoda_style' => null,
'yoda_style' => [],
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'single_line_throw' => false,
])
Expand Down
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PHP_CS_FIXER_VERSION=v3.4.0

php-cs-fixer.phar:
wget --no-verbose https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/${PHP_CS_FIXER_VERSION}/php-cs-fixer.phar
chmod +x php-cs-fixer.phar
21 changes: 18 additions & 3 deletions Model/FormTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,19 @@ public function addChild(FormTreeNode $node)

/**
* Set the loop back to the start
*
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
}

/**
* Return the length of the tree
*
* @return int
*/
public function count()
public function count(): int
{
return \count($this->nodes);
}
Expand All @@ -88,6 +89,7 @@ public function count()
*
* @return FormTreeNode
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->nodes[$this->position];
Expand All @@ -98,14 +100,18 @@ public function current()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}

/**
* Increment current position
*
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
Expand All @@ -116,6 +122,7 @@ public function next()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function valid()
{
return $this->offsetExists($this->position);
Expand All @@ -128,6 +135,7 @@ public function valid()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->nodes[$offset]);
Expand All @@ -140,6 +148,7 @@ public function offsetExists($offset)
*
* @return FormTreeNode
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->offsetExists($offset) ? $this->nodes[$offset] : null;
Expand All @@ -150,7 +159,10 @@ public function offsetGet($offset)
*
* @param mixed $offset
* @param mixed $value
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
/* Not implemented: Use addParent and addChild methods */
Expand All @@ -160,7 +172,10 @@ public function offsetSet($offset, $value)
* Unset node at the given offset
*
* @param mixed $offset
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
/* Not implemented: FormTree nodes should not be unsetable */
Expand Down
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
}
],
"require": {
"php": ">=7.1.0",
"symfony/framework-bundle": "~2.8|~3.0|~4.0|~5.0|~6.0",
"symfony/form": "~2.8|~3.0|~4.0|~5.0|~6.0",
"symfony/property-access": "~2.8|~3.0|~4.0|~5.0|~6.0"
"php": ">=7.4.0",
"symfony/framework-bundle": "~4.4|~5.0|~6.0",
"symfony/form": "~2.8|~3.0|~4.4|~5.0|~6.0",
"symfony/property-access": "~4.4|~5.0|~6.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.0",
"friendsofphp/php-cs-fixer": "^2.16"
"symfony/phpunit-bridge": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down
50 changes: 19 additions & 31 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0&amp;max[self]=0&amp;max[total]=9999&amp;verbose=1" />
</php>
<testsuites>
<testsuite name="ElaoFormTranslation Test Suite">
<directory suffix="Test.php">./Tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0&amp;max[self]=0&amp;max[total]=9999&amp;verbose=1"/>
</php>
<testsuites>
<testsuite name="ElaoFormTranslation Test Suite">
<directory suffix="Test.php">./Tests/</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 0f53519

Please sign in to comment.