Skip to content

Commit

Permalink
Enhancement: Synchronize project tooling configuration with localhein…
Browse files Browse the repository at this point in the history
…z/php-library-template
  • Loading branch information
localheinz committed Sep 10, 2019
1 parent d316fab commit 0d63a0e
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 204 deletions.
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/.dependabot/ export-ignore
/.github/ export-ignore
/.travis/ export-ignore
/test/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
/infection.json export-ignore
/Makefile export-ignore
/phpstan.neon export-ignore
18 changes: 13 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# CONTRIBUTING

We're using [Travis CI](https://travis-ci.com) as a continuous integration system.
We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system.

For details, see [`.travis.yml`](../.travis.yml).
For details, see [`workflows/continuous-integration.yml`](workflows/continuous-integration.yml).

## Coding Standards

Expand Down Expand Up @@ -30,7 +30,7 @@ to run a static code analysis.

## Tests

We're using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.
We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

Expand All @@ -40,11 +40,11 @@ $ make test

to run all the tests.

## Mutation Testing
## Mutation Tests

We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests.

Enable `xdebug` and run
Enable `Xdebug` and run

```
$ make infection
Expand All @@ -61,3 +61,11 @@ $ make
```

to enforce coding standards, perform a static code analysis, and run tests!

:bulb: Run

```
$ make help
```

to display a list of available targets with corresponding descriptions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
custom: https://www.buymeacoffee.com/localheinz
github: localheinz
patreon: localheinz
18 changes: 14 additions & 4 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- "codecov/patch"
- "codecov/project"
- "Travis CI - Branch"
- "Travis CI - Pull Request"
- "Coding Standards"
- "Static Code Analysis"
- "Tests (php7.1, lowest)"
- "Tests (php7.1, locked)"
- "Tests (php7.1, highest)"
- "Tests (php7.2, lowest)"
- "Tests (php7.2, locked)"
- "Tests (php7.2, highest)"
- "Tests (php7.3, lowest)"
- "Tests (php7.3, locked)"
- "Tests (php7.3, highest)"
- "Code Coverage"
- "codecov/patch"
- "codecov/project"
strict: false
restrictions: null

Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request
- push

name: "Continuous Integration"

jobs:
coding-standards:
name: "Coding Standards"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@master

- name: "Validate composer.json and composer.lock"
run: php7.1 /usr/bin/composer validate --strict

- name: "Install locked dependencies with composer"
run: php7.1 /usr/bin/composer install --no-interaction --no-progress --no-suggest

- name: "Run localheinz/composer-normalize"
run: php7.1 /usr/bin/composer normalize --dry-run

- name: "Run friendsofphp/php-cs-fixer for source"
run: php7.1 vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --using-cache=no --verbose

- name: "Run friendsofphp/php-cs-fixer for test fixtures"
run: php7.1 vendor/bin/php-cs-fixer fix --config=.php_cs.fixture --diff --diff-format=udiff --using-cache=no --verbose

static-code-analysis:
name: "Static Code Analysis"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@master

- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install --no-interaction --no-progress --no-suggest

- name: "Run phpstan/phpstan"
run: php7.3 vendor/bin/phpstan analyse --configuration=phpstan.neon

tests:
name: "Tests"

runs-on: ubuntu-latest

strategy:
matrix:
php-binary:
- php7.1
- php7.2
- php7.3

dependencies:
- lowest
- locked
- highest

steps:
- name: "Checkout"
uses: actions/checkout@master

- name: "Install lowest dependencies with composer"
if: matrix.dependencies == 'lowest'
run: ${{ matrix.php-binary }} /usr/bin/composer update --prefer-lowest --no-interaction --no-progress --no-suggest

- name: "Install locked dependencies with composer"
if: matrix.dependencies == 'locked'
run: ${{ matrix.php-binary }} /usr/bin/composer install --no-interaction --no-progress --no-suggest

- name: "Install highest dependencies with composer"
if: matrix.dependencies == 'highest'
run: ${{ matrix.php-binary }} /usr/bin/composer update --no-interaction --no-progress --no-suggest

- name: "Run auto-review tests with phpunit/phpunit"
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml

- name: "Run integration tests with phpunit/phpunit"
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=test/Integration/phpunit.xml

code-coverage:
name: "Code Coverage"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@master

- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install --no-interaction --no-progress --no-suggest

- name: "Dump Xdebug filter with phpunit/phpunit"
run: php7.3 vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php

- name: "Collect code coverage with Xdebug and phpunit/phpunit"
run: php7.3 vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --coverage-clover=build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php

- name: "Download code coverage uploader for Codecov.io"
run: curl -s https://codecov.io/bash -o codecov

- name: "Send code coverage report to Codecov.io"
run: bash codecov -t ${{ secrets.CODECOV_TOKEN }}
8 changes: 3 additions & 5 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ $config->getFinder()
->ignoreDotFiles(false)
->in(__DIR__)
->exclude([
'.github',
'.build',
'.travis',
'.dependabot',
'.github',
'test/Fixture',
])
->name('.php_cs');

$directory = \getenv('TRAVIS') ? \getenv('HOME') : __DIR__;

$config->setCacheFile($directory . '/.build/php-cs-fixer/.php_cs.cache');
$config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php_cs.cache');

return $config;
160 changes: 0 additions & 160 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 0d63a0e

Please sign in to comment.