Skip to content

Commit

Permalink
ci: add mutation testing support and CI/CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 30, 2024
1 parent 0a40196 commit 9f3cd38
Show file tree
Hide file tree
Showing 6 changed files with 949 additions and 8 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on: # yamllint disable-line rule:truthy
pull_request:
branches:
- master
push:
branches:
- master

name: 🧹 Fix PHP coding standards

Expand All @@ -26,7 +23,7 @@ jobs:
with:
configFile: ${{ github.workspace }}/.github/.commitlint.config.mjs
failOnWarnings: false
failOnErrors: false
failOnErrors: true
helpURL: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'

yaml-linting:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---

name: 🔐 Security analysis

on: # yamllint disable-line rule:truthy
pull_request:
push:
branches:
- master

name: 🔐 Security analysis

jobs:
security-analysis:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,60 @@ jobs:
- name: 🧪 Run tests that require separate process using phpunit/phpunit
run: composer test:sep


mutation-testing:
timeout-minutes: 16
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: mutation-testing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
php-version:
- '8.2'
dependencies:
- locked
steps:
- name: 📦 Check out the codebase
uses: actions/[email protected]

- name: 🛠️ Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, pdo, pdo_sqlite
ini-values: error_reporting=E_ALL
coverage: xdebug

- name: 🛠️ Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: 🔍 Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/[email protected]

- name: ♻️ Restore cached dependencies installed with composer
uses: actions/[email protected]
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
uses: wayofdev/gh-actions/actions/composer/[email protected]
with:
dependencies: ${{ matrix.dependencies }}

- name: 🧪 Run mutation testing using Xdebug and infection/infection
run: composer infect:ci
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

compile-phar:
timeout-minutes: 4
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "^10.5",
"roave/infection-static-analysis-plugin": "^1.35",
"roxblnfk/unpoly": "^1.8.1",
"vimeo/psalm": "^5.11",
"wayofdev/cs-fixer-config": "^1.4"
Expand Down Expand Up @@ -96,6 +97,7 @@
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"infection/extension-installer": true,
"pestphp/pest-plugin": true,
"phpstan/extension-installer": true
},
Expand Down
Loading

0 comments on commit 9f3cd38

Please sign in to comment.