Merge pull request #44 from OskarStark/feature/cs-ci #110
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.3" | |
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: | |
- "7.4" | |
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/composer-install@v1" | |
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: | |
- '7.4' | |
- '8.0' | |
- '8.1' | |
- '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/composer-install@v1" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
composer-options: "--prefer-dist" | |
- name: Run tests | |
run: vendor/bin/phpunit tests |