Skip to content

Commit

Permalink
ci: Split Github Actions into multiple files.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Nov 22, 2020
1 parent 9ed083d commit a442fea
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 30 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request

name: "Code style"

jobs:
run:
name: "CI"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4']

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v2.3.3
with:
fetch-depth: 1

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd,mbstring,pcov
tools: cs2pr

- 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.json') }}
restore-keys: ${{ runner.os }}-composer-

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

- name: Run Grumphp
run: vendor/bin/grumphp run --testsuite=cs -n

- name: Send feedback on Github
if: ${{ failure() }}
run: |
vendor/bin/php-cs-fixer --allow-risky=yes --config=.php_cs.dist fix --dry-run --format=checkstyle | cs2pr
55 changes: 55 additions & 0 deletions .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request

name: "Mutations testing"

jobs:
run:
name: "CI"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4']

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 1

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd,mbstring,pcov

- 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.json') }}
restore-keys: ${{ runner.os }}-composer-

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

- name: Run Grumphp
run: vendor/bin/grumphp run --tasks=infection -n

- name: Send feedback on Github
if: ${{ failure() }}
run: |
vendor/bin/infection -j2 --logger-github
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on: # yamllint disable-line rule:truthy

jobs:
release:
name: "Release"
name: "Tag"

runs-on: "ubuntu-latest"

Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request

name: "Static analysis"

jobs:
run:
name: "CI"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.4']

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v2.3.3
with:
fetch-depth: 1

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd,mbstring,pcov,xdebug
tools: cs2pr

- 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.json') }}
restore-keys: ${{ runner.os }}-composer-

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

- name: Run Grumphp
run: vendor/bin/grumphp run --tasks=psalm,phpstan -n

- name: Send feedback on Github
if: ${{ failure() }}
run: |
vendor/bin/phpstan analyse -l max --error-format=checkstyle src/ | cs2pr
vendor/bin/psalm --output-format=github | cs2pr
- name: Send PSALM data
run: vendor/bin/psalm --shepherd --stats
continue-on-error: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

on:
- pull_request
- push

name: "Continuous Integration"
name: "Unit tests"

jobs:
run:
name: "Grumphp"
name: "CI"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
Expand All @@ -23,15 +22,15 @@ jobs:
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.3.3
with:
fetch-depth: 1

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd,mbstring,xdebug
extensions: gd,mbstring,pcov,xdebug

- name: Get Composer Cache Directory
id: composer-cache
Expand All @@ -48,28 +47,10 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run Grumphp
run: vendor/bin/grumphp run --no-ansi -n
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

- name: Send PSALM data
run: vendor/bin/psalm --shepherd --stats
continue-on-error: true
run: vendor/bin/grumphp run --tasks=phpspec

- name: Send Scrutinizer data
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
continue-on-error: true

- name: Infection score report
run: |
vendor/bin/infection run -j 2
continue-on-error: true

- name: PHP Insights report
run: |
rm -rf composer.lock vendor
composer require nunomaduro/phpinsights --dev
vendor/bin/phpinsights analyse src/ -n
continue-on-error: true
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"php": ">= 7.4"
},
"require-dev": {
"amphp/parallel": "^1",
"drupol/php-conventions": "^1.7.4 || ^1.8.19 || ^2",
"friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^5.0.0",
"infection/infection": "^0.18.2",
"amphp/parallel-functions": "^0.1 || ^1",
"drupol/php-conventions": "^2.0.3",
"friends-of-phpspec/phpspec-code-coverage": "^5",
"infection/infection": "^0.20.1",
"infection/phpspec-adapter": "^0.1.1",
"phpspec/phpspec": "^5.1.2 || ^6.2.1 || ^7.0.0",
"phpspec/phpspec": "^7",
"phpstan/phpstan-strict-rules": "^0.12",
"psr/cache": "^1.0",
"symfony/cache": "^4.4 || ^5.1",
Expand Down
1 change: 1 addition & 0 deletions infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
]
},
"logs": {
"github": true,
"text": "build/infection.log",
"summary": "build/summary.log",
"debug": "build/debug.log",
Expand Down

0 comments on commit a442fea

Please sign in to comment.