Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/merge
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jul 5, 2020
2 parents 2c03eca + de3eeca commit 9ba3441
Show file tree
Hide file tree
Showing 56 changed files with 1,250 additions and 901 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.github/ export-ignore
/tests/ export-ignore
/tools/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
Expand Down
20 changes: 18 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ For details, take a look at the following workflow configuration files:

## Coding Standards

We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.

We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.

If you do not have `yamllint` installed yet, run
Expand All @@ -21,13 +23,27 @@ $ brew install yamllint

to install `yamllint`.

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards in PHP files.

Run

```sh
$ make coding-standards
```

to detect coding standard violations.
to automatically fix coding standard violations.

## Static Code Analysis

We are using [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.

Run

```sh
$ make static-code-analysis
```

to run a static code analysis.

## Tests

Expand All @@ -49,7 +65,7 @@ Run
$ make
```

to detect coding standard violations and run tests!
to enforce coding standards, run a static code analysis, and run tests!

## Help

Expand Down
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
patreon: "s_bergmann"
github: "sebastianbergmann"
10 changes: 9 additions & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- "Coding Standards"
- "Code Coverage (7.4, highest)"
- "Coding Standards (7.1)"
- "Tests (7.1, highest)"
- "Tests (7.1, lowest)"
- "Tests (7.2, highest)"
- "Tests (7.2, lowest)"
- "Tests (7.3, highest)"
- "Tests (7.3, lowest)"
- "Tests (7.4, highest)"
- "Tests (7.4, lowest)"
- "Tests (8.0, highest)"
- "Tests (8.0, lowest)"
strict: false
restrictions: null

Expand Down
178 changes: 178 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.1"

steps:
- name: "Checkout"
uses: "actions/[email protected]"
Expand All @@ -25,6 +30,115 @@ jobs:
file_or_dir: "."
strict: true

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

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

- name: "Run ergebnis/composer-normalize"
run: "tools/composer-normalize --dry-run"

- name: "Create cache directory for friendsofphp/php-cs-fixer"
run: "mkdir -p .build/php-cs-fixer"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/cache@v2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('tools/php-cs-fixer') }}"
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-"

- name: "Run friendsofphp/php-cs-fixer"
run: "tools/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose"

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

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/[email protected]"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Determine composer cache directory"
id: "determine-composer-cache-directory"
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies from composer.json"
if: "matrix.dependencies == 'lowest'"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"

- name: "Install locked dependencies from composer.lock"
if: "matrix.dependencies == 'locked'"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies from composer.json"
if: "matrix.dependencies == 'highest'"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Create cache directory for vimeo/psalm"
run: "mkdir -p .build/psalm"

- name: "Cache cache directory for vimeo/psalm"
uses: "actions/cache@v2"
with:
path: ".build/psalm"
key: "php-${{ matrix.php-version }}-psalm-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-psalm-"

- name: "Run vimeo/psalm"
run: "tools/psalm --config=psalm.xml --diff --diff-methods --shepherd --show-info=false --stats --threads=4"

backward-compatibility:
name: "Backward Compatibility"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/[email protected]"
with:
fetch-depth: 0

- name: "Fetch tags"
run: "git fetch --depth=1 origin +refs/tags/*:refs/tags/*"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.4"
coverage: "none"
extensions: "intl"

- name: "Run roave/backward-compatibility-check"
run: "tools/roave-backward-compatibility-check --from=1.0.0"

tests:
name: "Tests"

Expand All @@ -36,8 +150,11 @@ jobs:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"

dependencies:
- "lowest"
- "highest"

steps:
Expand Down Expand Up @@ -76,12 +193,73 @@ jobs:
- name: "Run tests with phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=phpunit.xml"

code-coverage:
name: "Code Coverage"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/[email protected]"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "xdebug"
php-version: "${{ matrix.php-version }}"

- name: "Determine composer cache directory"
id: "determine-composer-cache-directory"
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies from composer.json"
if: "matrix.dependencies == 'lowest'"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"

- name: "Install locked dependencies from composer.lock"
if: "matrix.dependencies == 'locked'"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies from composer.json"
if: "matrix.dependencies == 'highest'"
run: "composer update --no-interaction --no-progress --no-suggest"

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

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

- name: "Send code coverage report to Codecov.io"
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
run: "bash <(curl -s https://codecov.io/bash)"

merge:
name: "Merge"

runs-on: "ubuntu-latest"

needs:
- "backward-compatibility"
- "code-coverage"
- "coding-standards"
- "static-code-analysis"
- "tests"

if: >
Expand Down
Loading

0 comments on commit 9ba3441

Please sign in to comment.