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 Nov 13, 2019
1 parent 2e5c1a1 commit 4a3b220
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 21 deletions.
8 changes: 8 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
version: 1

update_configs:
- default_assignees:
- "localheinz"
default_reviewers:
- "localheinz"
directory: "/"
package_manager: "github_actions"
update_schedule: "daily"

- default_assignees:
- "localheinz"
default_reviewers:
Expand Down
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ $ make

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

## Help

:bulb: Run

```
Expand Down
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
3 changes: 3 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ labels:
- name: question
color: cc317c

- name: security
color: ee0701

- name: stale
color: eeeeee

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

on:
- pull_request
- push
pull_request:
push:
branches:
- master
- "1.x"
tags:
- "**"

name: "Continuous Integration"

Expand All @@ -14,16 +19,30 @@ jobs:

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

- name: "Disable Xdebug"
run: php7.1 --ini | grep xdebug | sed 's/,$//' | xargs sudo rm

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

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.0
with:
path: ~/.composer/cache
key: php7.1-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php7.1-composer-locked-
- name: "Install locked dependencies with composer"
run: php7.1 /usr/bin/composer install
run: php7.2 $(which composer) install --no-interaction --no-progress --no-suggest

- name: "Run localheinz/composer-normalize"
run: php7.2 $(which composer) normalize --dry-run

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

static-code-analysis:
name: "Static Code Analysis"
Expand All @@ -32,10 +51,21 @@ jobs:

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

- name: "Disable Xdebug"
run: php7.3 --ini | grep xdebug | sed 's/,$//' | xargs sudo rm

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.0
with:
path: ~/.composer/cache
key: php7.3-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php7.3-composer-locked-
- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install
run: php7.3 $(which composer) install --no-interaction --no-progress --no-suggest

- name: "Run phpstan/phpstan"
run: php7.3 vendor/bin/phpstan analyse --configuration=phpstan.neon
Expand All @@ -59,19 +89,33 @@ jobs:

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

- name: "Disable Xdebug"
run: ${{ matrix.php-binary }} --ini | grep xdebug | sed 's/,$//' | xargs sudo rm

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.0
with:
path: ~/.composer/cache
key: ${{ matrix.php-binary }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ matrix.php-binary }}-composer-${{ matrix.dependencies }}-
- name: "Install lowest dependencies with composer"
if: matrix.dependencies == 'lowest'
run: ${{ matrix.php-binary }} /usr/bin/composer update --prefer-lowest
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest

- name: "Install locked dependencies with composer"
if: matrix.dependencies == 'locked'
run: ${{ matrix.php-binary }} /usr/bin/composer install
run: ${{ matrix.php-binary }} $(which 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
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest

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

- name: "Run integration tests with phpunit/phpunit"
run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=test/Integration/phpunit.xml
Expand All @@ -83,19 +127,26 @@ jobs:

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

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1.0.0
with:
path: ~/.composer/cache
key: php7.3-composer-locked-${{ hashFiles('**/composer.lock') }}
restore-keys: |
php7.3-composer-locked-
- name: "Install locked dependencies with composer"
run: php7.3 /usr/bin/composer install
run: php7.3 $(which 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 }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
1 change: 1 addition & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# https://github.com/actions/stale

name: "Close stale issues and pull requests"

on:
schedule:
- cron: "0 * * * *"
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: coverage cs help it stan test
.PHONY: coverage cs help infection it stan test

it: cs stan test ## Runs the cs, stan, and test targets

coverage: vendor ## Collects coverage from running unit tests with phpunit
coverage: vendor ## Collects coverage from running integration tests with phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php
vendor/bin/phpunit --configuration=test/Integration/phpunit.xml --coverage-text --prepend=.build/phpunit/xdebug-filter.php
Expand All @@ -24,4 +24,4 @@ test: vendor ## Runs auto-review, unit, and integration tests with phpunit

vendor: composer.json composer.lock
composer validate --strict
composer install
composer install --no-interaction --no-progress --no-suggest

0 comments on commit 4a3b220

Please sign in to comment.