Enhancement: Better tests #324
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
REQUIRED_PHP_EXTENSIONS: "curl, json" | |
jobs: | |
coding-standards: | |
name: "Coding Standards" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.2" | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v3 | |
- | |
name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
tools: "composer:v2" | |
- | |
name: "Install dependencies with composer" | |
uses: "ramsey/[email protected]" | |
with: | |
composer-options: "--no-scripts" | |
- | |
name: "Create cache directory for friendsofphp/php-cs-fixer" | |
run: "mkdir -p .build/php-cs-fixer" | |
- | |
name: "Cache cache directory for friendsofphp/php-cs-fixer" | |
uses: "actions/cache@v4" | |
with: | |
path: ".build/php-cs-fixer" | |
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}" | |
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-" | |
- | |
name: "Run friendsofphp/php-cs-fixer" | |
run: "vendor/bin/php-cs-fixer fix --diff --verbose" | |
composer-validate: | |
name: "Validate composer.json" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.2" | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v3 | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
tools: "composer:v2" | |
- name: "Composer install" | |
uses: "ramsey/[email protected]" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "--prefer-dist" | |
- name: "Validate composer.json" | |
run: "composer validate" | |
- name: "Normalize composer.json" | |
run: "composer normalize" | |
tests: | |
name: "PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }}" | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.allowed-to-fail }} | |
strategy: | |
matrix: | |
php-version: | |
- '8.2' | |
- '8.3' | |
dependencies: | |
- 'highest' | |
allowed-to-fail: [false] | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v3 | |
- name: Install PHP with extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
tools: "composer:v2" | |
- name: Add PHPUnit matcher | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: "Composer install" | |
uses: "ramsey/[email protected]" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "--prefer-dist" | |
- name: Run tests | |
run: vendor/bin/phpunit tests | |
static-code-analysis: | |
name: "Static Code Analysis" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.2" | |
steps: | |
- | |
name: "Checkout" | |
uses: "actions/checkout@v3" | |
- | |
name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
tools: "composer:v2" | |
- | |
name: "Install dependencies with composer" | |
uses: "ramsey/[email protected]" | |
- | |
name: "Run a static code analysis with phpstan/phpstan and default configuration" | |
run: "vendor/bin/phpstan analyse --configuration=phpstan-default.neon.dist --no-progress" | |
refactoring: | |
name: "Refactoring" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.2" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- | |
name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | |
tools: "composer:v2" | |
- | |
name: "Install dependencies with composer" | |
uses: "ramsey/[email protected]" | |
with: | |
composer-options: "--no-scripts" | |
- | |
name: "Run rector/rector" | |
run: "vendor/bin/rector process --config rector.php" |