Simplify recipes and fix Psalm errors #175
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: "build" | |
on: | |
push: | |
branches: | |
- "*.x" | |
paths-ignore: | |
- "*.md" | |
pull_request: | |
paths-ignore: | |
- "*.md" | |
workflow_dispatch: ~ | |
env: | |
PHP_EXTENSIONS: "mbstring" | |
jobs: | |
coding-standards: | |
name: "Coding Standards" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.1" | |
dependencies: | |
- "highest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup PHP, with composer and extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.PHP_EXTENSIONS }}" | |
coverage: "none" | |
- name: "Install composer dependencies" | |
uses: "ramsey/composer-install@v3" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
- name: "Validate composer" | |
run: "composer validate --strict" | |
- name: "Check composer normalized" | |
run: "composer normalize --dry-run" | |
- name: "Check style" | |
run: "composer check-style" | |
dependency-analysis: | |
name: "Dependency Analysis" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
dependencies: | |
- "lowest" | |
- "highest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup PHP, with composer and extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
extensions: "${{ env.PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php-version }}" | |
- name: "Remove require-dev section in composer.json" | |
run: "composer config --unset require-dev" | |
- name: "Remove autoload-dev section in composer.json" | |
run: "composer config --unset autoload-dev" | |
- name: "Add shipmonk/composer-dependency-analyser to composer.json" | |
run: "composer require --dev --no-install --no-update --no-plugins --no-scripts shipmonk/composer-dependency-analyser" | |
- name: "Install composer dependencies" | |
uses: "ramsey/composer-install@v3" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
- name: "Run dependency analysis" | |
run: "vendor/bin/composer-dependency-analyser" | |
static-code-analysis: | |
name: "Static Code Analysis" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
dependencies: | |
- "lowest" | |
- "highest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Setup PHP, with composer and extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "${{ matrix.php-version }}" | |
extensions: "${{ env.PHP_EXTENSIONS }}" | |
coverage: "none" | |
- name: "Install composer dependencies" | |
uses: "ramsey/composer-install@v3" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
- name: "Static analysis" | |
run: "composer analyse" | |
unit-tests: | |
name: "Unit tests" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
php-version: | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
dependencies: | |
- "lowest" | |
- "highest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Build Docker image" | |
run: "docker build -t setono/deployer-cron --no-cache ./tests/docker" | |
- name: "Run Docker container" | |
run: "docker run -d -p 2222:22 setono/deployer-cron" | |
- name: "Change permissions" | |
run: "chmod 600 ./tests/docker/ssh/id_rsa && chmod 644 ./tests/docker/ssh/id_rsa.pub" | |
- name: "Setup PHP, with composer and extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
extensions: "${{ env.PHP_EXTENSIONS }}" | |
php-version: "${{ matrix.php-version }}" | |
- name: "Install composer dependencies" | |
uses: "ramsey/composer-install@v3" | |
with: | |
dependency-versions: "${{ matrix.dependencies }}" | |
- name: "Run phpunit" | |
run: "vendor/bin/phpunit" |