Skip to content

Commit

Permalink
Allow PHP 8
Browse files Browse the repository at this point in the history
- update CI
- add phpstan
- upgrade phpunit to v9
- upgrade psalm
  • Loading branch information
simPod committed Jan 18, 2021
1 parent b40daf2 commit 928c37c
Show file tree
Hide file tree
Showing 13 changed files with 226 additions and 204 deletions.
7 changes: 4 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text eol=lf
/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
/infection.json.dist export-ignore
/Makefile export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml.dist export-ignore
.gitignore export-ignore
/tests export-ignore
132 changes: 0 additions & 132 deletions .github/workflows/ci.yaml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Coding Standards"

on:
pull_request:
push:
branches:
- "master"

jobs:
coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-20.04"

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

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

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

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

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

on:
pull_request:
push:
branches:
- "master"
schedule:
- cron: "42 3 * * *"

jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.4"
- "8.0"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

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

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"

upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
with:
directory: reports
20 changes: 10 additions & 10 deletions .github/workflows/infection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: Install PHP
uses: shivammathur/setup-php@v2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: 7.3
coverage: pcov
extensions: json
php-version: 7.4
coverage: "pcov"

- name: Install Dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest
composer require --dev infection/infection
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

- name: Run Infection
run: vendor/bin/infection --min-msi=90 --min-covered-msi=90 --log-verbosity=none -s
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/shepherd.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Static Analysis"

on:
pull_request:
push:
branches:
- "master"

jobs:
static-analysis-phpstan:
name: "Static Analysis with PHPStan"
runs-on: "ubuntu-20.04"

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

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"

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

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"

static-analysis-psalm:
name: "Static Analysis with Psalm"
runs-on: "ubuntu-20.04"

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

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Psalm
uses: docker://vimeo/psalm-github-actions:4.4.1
with:
args: --shepherd
composer_require_dev: true
security_analysis: true
report_file: results.sarif
- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/.phpcs-cache
/.phpunit.result.cache
/composer.lock
/phpcs.xml
/phpstan.neon
/psalm.xml
/phpunit.xml
/vendor
/infection.json
/infection-log.txt
.phpunit.result.cache
/infection.json
/infection-log.txt
/vendor/
Loading

0 comments on commit 928c37c

Please sign in to comment.