Skip to content

Commit

Permalink
Add GitHub actions, update phpstan rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaveras committed May 8, 2022
1 parent 3f7cc95 commit af6c3dc
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/coding-standards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Coding Standards"

on:
pull_request:
branches:
- "master"
- "main"

push:
branches:
- "master"
- "main"
- "*.x"

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

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.4"
extensions: "redis"
tools: "composer:v2,cs2pr"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist --optimize-autoloader"

- name: "Check code style"
run: "./vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr"
96 changes: 96 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: "Continuous Integration"

on:
pull_request:
branches:
- "master"
- "main"

push:
branches:
- "master"
- "main"
- "*.x"

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

strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "highest"
stability:
- "stable"

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

- name: "Install PHP with PCOV"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1, apc.enable_cli=1"
extensions: "redis,apcu"
tools: "composer:v2,flex"

- name: "Enforce using stable dependencies"
run: "composer config minimum-stability stable"
if: "${{ matrix.stability == 'stable' }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist --optimize-autoloader"

- name: "Run PHPUnit"
run: "./vendor/bin/phpunit"

# - name: "Upload coverage file"
# uses: "actions/upload-artifact@v2"
# with:
# name: "phpunit-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}.coverage"
# path: "clover.xml"

# upload_coverage:
# name: "Upload coverage to Codecov"
# runs-on: "ubuntu-latest"
# 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"
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# directory: reports
#
# - name: "Upload to CodeClimate"
# uses: "paambaati/[email protected]"
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# with:
# coverageLocations: |
# ${{github.workspace}}/reports/*/clover.xml:clover
39 changes: 39 additions & 0 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Static Analysis"

on:
pull_request:
branches:
- "master"
- "main"

push:
branches:
- "master"
- "main"
- "*.x"

jobs:
static-analysis:
name: "Static Analysis"
runs-on: "ubuntu-latest"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.4"
extensions: "redis"
tools: "composer:v2"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist --optimize-autoloader"

- name: "Run PHPStan"
run: "./vendor/bin/phpstan analyse --error-format=github"
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ parameters:
- DependencyInjection/Configuration.php
ignoreErrors:
-
message: '#::loadInternal\(\) has no return typehint specified#'
path: 'DependencyInjection/CircuitBreakerExtension.php'
message: '#::loadInternal\(\) has no return type specified\.#'
path: 'DependencyInjection/KsaverasCircuitBreakerExtension.php'

includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
Expand Down

0 comments on commit af6c3dc

Please sign in to comment.