Skip to content

Commit

Permalink
Merge pull request #2 from bearsunday/update-ci-qa
Browse files Browse the repository at this point in the history
Supports PHP 8.0
  • Loading branch information
koriym authored May 9, 2021
2 parents 754207e + f753f6b commit 3870dab
Show file tree
Hide file tree
Showing 17 changed files with 348 additions and 135 deletions.
34 changes: 34 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# CONTRIBUTING

## Code Contributions

## Installation

Install project dependencies and test tools by running the following commands.

```bash
$ composer install
```

## Running tests

```bash
$ composer test
```
```bash
$ composer coverage // xdebug
$ composer pcov // pcov
```

Add tests for your new code ensuring that you have 100% code coverage.
In rare cases, code may be excluded from test coverage using `@codeCoverageIgnore`.

## Sending a pull request

To ensure your PHP code changes pass the CI checks, make sure to run all the same checks before submitting a PR.

```bash
$ composer tests
```

When you make a pull request, the tests will automatically be run again by GH action on multiple php versions.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Bug Report
about: Create a bug report
labels: Bug
---

### Bug Report

<!-- Provide a summary describing the problem you are experiencing. -->

### How to reproduce

<!--- Describe exactly how to reproduce the problem, using a minimal test-case or working code sample. -->

7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Feature
about: Suggest a new feature or enhancement
labels: Feature
---

<!-- Write your suggestion here. -->
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Question
about: Ask a question regarding software usage
labels: Support
---

<!-- Write your question here. -->
6 changes: 6 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Reporting a vulnerability

If you have found any issues that might have security implications,
please send a report privately to [email protected]

Do not report security reports publicly.
41 changes: 41 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Coding Standards

on:
push:
pull_request:
workflow_dispatch:

jobs:
coding-standards:
name: Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: cs2pr
coverage: none

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

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Validate composer.json
run: composer validate --strict

- name: Run PHP_CodeSniffer
run: ./vendor/bin/phpcs -q --no-colors --report=checkstyle src tests | cs2pr
61 changes: 61 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Continuous Integration

on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '42 15 * * *'

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
matrix:
operating-system:
- ubuntu-latest
php-version:
- '7.3'
- '7.4'
- '8.0'
dependencies:
- lowest
- highest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: zend.assertions=1

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

- name: Install lowest dependencies
if: ${{ matrix.dependencies == 'lowest' }}
run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest

- name: Install highest dependencies
if: ${{ matrix.dependencies == 'highest' }}
run: composer update --no-interaction --no-progress --no-suggest

- name: Run test suite
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
113 changes: 113 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Static Analysis

on:
push:
pull_request:
workflow_dispatch:

jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: cs2pr
coverage: none

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

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr

static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: cs2pr
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run Psalm
run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr

static-analysis-phpmd:
name: Static Analysis with PHPMD
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

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

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

static-analysis-composer-require-checker:
name: Static Analysis with ComposerRequireChecker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist
composer require --dev maglnet/composer-require-checker ^3.0
- name: Run composer-require-checker
run: ./vendor/bin/composer-require-checker check ./composer.json
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/.phpunit.result.cache
/.phpcs-cache
/vendor/
/vendor-bin/tools/vendor/
/build/
/.idea/

/composer.lock
/phpunit.xml
/.phpunit.result.cache
/.php_cs.cache
.phpcs-cache
composer.lock
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 3870dab

Please sign in to comment.