This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "**" | ||
|
||
name: "Continuous Integration" | ||
|
||
jobs: | ||
coding-standards: | ||
name: "Coding Standards" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- 7.4 | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v1 | ||
|
||
- name: "Install PHP with extensions" | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
coverage: none | ||
extensions: "json" | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: "Validate composer.json and composer.lock" | ||
run: composer validate --strict | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
php${{ matrix.php-version }}-composer-locked- | ||
- name: "Install locked dependencies with composer" | ||
run: composer install --no-interaction --no-progress --no-suggest | ||
|
||
- name: "Run localheinz/composer-normalize" | ||
run: 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@v1 | ||
with: | ||
path: .build/php-cs-fixer | ||
key: php${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
php${{ matrix.php-version }}-php-cs-fixer- | ||
- name: "Run friendsofphp/php-cs-fixer" | ||
run: vendor/bin/php-cs-fixer fix --diff --diff-format=udiff --dry-run --verbose | ||
|
||
static-code-analysis: | ||
name: "Static Code Analysis" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- 7.4 | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v1 | ||
|
||
- name: "Install PHP with extensions" | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
coverage: none | ||
extensions: "json" | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: ${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ matrix.php-version }}-composer-locked- | ||
- name: "Install locked dependencies with composer" | ||
run: composer install --no-interaction --no-progress --no-suggest | ||
|
||
- name: "Run phpstan/phpstan" | ||
run: vendor/bin/phpstan analyse | ||
|
||
tests: | ||
name: "Tests" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
|
||
dependencies: | ||
- lowest | ||
- highest | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v1 | ||
|
||
- name: "Install PHP with extensions" | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
coverage: none | ||
extensions: "json" | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- | ||
- name: "Install lowest dependencies with composer" | ||
if: matrix.dependencies == 'lowest' | ||
run: composer update --no-interaction --no-progress --no-suggest --prefer-lowest | ||
|
||
- name: "Install highest dependencies with composer" | ||
if: matrix.dependencies == 'highest' | ||
run: composer update --no-interaction --no-progress --no-suggest | ||
|
||
- name: "Run tests with phpunit/phpunit" | ||
run: vendor/bin/phpunit | ||
|
||
code-coverage: | ||
name: "Code Coverage" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- 7.4 | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v1 | ||
|
||
- name: "Install PHP with extensions" | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
coverage: pcov | ||
extensions: "json" | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache | ||
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
php${{ matrix.php-version }}-composer-locked- | ||
- name: "Install locked dependencies with composer" | ||
run: composer install --no-interaction --no-progress --no-suggest | ||
|
||
- name: "Collect code coverage with pcov and phpunit/phpunit" | ||
run: vendor/bin/phpunit -coverage-clover=build/logs/clover.xml | ||
|
||
- name: "Send code coverage report to Codecov.io" | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
run: bash <(curl -s https://codecov.io/bash) |