Files
php-flasher/.github/workflows/tests.yaml
T

234 lines
9.5 KiB
YAML

name: qa
on:
push:
branches:
- main
- 2.x
pull_request:
schedule:
- cron: '0 0 * * *' # Daily at midnight
jobs:
javascript-tests:
runs-on: ubuntu-latest
name: JavaScript Tests
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v4
- name: 🔧 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: 📦 Install Dependencies
run: npm ci
- name: ✅ Run Tests
run: npm run test
- name: 📊 Run Coverage
run: npm run test:coverage
static-analysis:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.2 ]
name: php v${{ matrix.php }}
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 🚚 Cache Composer Dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: 📦 Install Dependencies
run: |
composer config --global allow-plugins true
composer install --no-interaction --prefer-dist --optimize-autoloader
- name: 🧹 Run PHP CS Fixer (Code Style)
run: vendor/bin/php-cs-fixer fix --dry-run --diff
- name: 🔍 Run PHPStan (Static Analysis)
run: vendor/bin/phpstan analyse --no-progress
- name: 🚀 Run PHPLint (Syntax Check)
run: vendor/bin/phplint
prime-test:
needs: static-analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { php: 8.4, phpunit: 10.5.* }
- { php: 8.3, phpunit: 10.5.* }
- { php: 8.2, phpunit: 10.5.* }
name: php v${{ matrix.php }}
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 🚚 Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: 📦 Install dependencies
run: |
sed -i '/"require": {/,/},/d; /"require-dev": {/,/},/d' composer.json
composer config --global allow-plugins true
composer require "phpunit/phpunit:${{ matrix.phpunit }}" "mockery/mockery" "psr/container" --no-interaction --no-update
composer update --prefer-lowest -W --no-interaction --prefer-dist --optimize-autoloader
- name: ✅ Execute tests
run: vendor/bin/phpunit --testsuite prime
symfony-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { symfony: 8.0.x-dev, php: 8.4, phpunit: 10.5.* }
- { symfony: 7.4.x-dev, php: 8.2, phpunit: 10.5.* }
- { symfony: 7.3.*, php: 8.5, phpunit: 10.5.* }
- { symfony: 7.3.*, php: 8.4, phpunit: 10.5.* }
- { symfony: 7.3.*, php: 8.3, phpunit: 10.5.* }
- { symfony: 7.3.*, php: 8.2, phpunit: 10.5.* }
- { symfony: 7.2.*, php: 8.2, phpunit: 10.5.* }
- { symfony: 7.1.*, php: 8.2, phpunit: 10.5.* }
- { symfony: 7.0.*, php: 8.2, phpunit: 10.5.* }
name: symfony v${{ matrix.symfony }} x php v${{ matrix.php }}
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 🚚 Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: 📦 Install dependencies
run: |
sed -i '/"require": {/,/},/d; /"require-dev": {/,/},/d' composer.json
composer config --global allow-plugins true
composer config extra.symfony.require "${{ matrix.symfony }}"
if [[ "${{ matrix.symfony }}" == *"-dev"* ]]; then
echo "Setting minimum-stability to dev for ${{ matrix.symfony }}"
composer config minimum-stability "dev"
composer config prefer-stable true
fi
composer require "symfony/config:${{ matrix.symfony }}" "symfony/console:${{ matrix.symfony }}" "symfony/dependency-injection:${{ matrix.symfony }}" "symfony/framework-bundle:${{ matrix.symfony }}" "symfony/http-kernel:${{ matrix.symfony }}" "symfony/translation:${{ matrix.symfony }}" "symfony/twig-bundle:${{ matrix.symfony }}" "phpunit/phpunit:${{ matrix.phpunit }}" "mockery/mockery" "psr/container" "monolog/monolog" --no-interaction --no-update
if [[ "${{ matrix.symfony }}" == *"-dev"* ]]; then
echo "Running composer update (latest dependencies)"
composer update -W --no-interaction --prefer-dist --optimize-autoloader
else
echo "Running composer update --prefer-lowest"
composer update --prefer-lowest -W --no-interaction --prefer-dist --optimize-autoloader
fi
- name: ✅ Execute tests
run: vendor/bin/phpunit --testsuite symfony
laravel-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { laravel: 13.x-dev, testbench: 11.x-dev, php: 8.5, phpunit: 11.5.* }
- { laravel: 13.x-dev, testbench: 11.x-dev, php: 8.4, phpunit: 11.5.* }
- { laravel: 13.x-dev, testbench: 11.x-dev, php: 8.3, phpunit: 11.5.* }
- { laravel: 12.*, testbench: 10.*, php: 8.5, phpunit: 11.5.* }
- { laravel: 12.*, testbench: 10.*, php: 8.4, phpunit: 11.5.* }
- { laravel: 12.*, testbench: 10.*, php: 8.3, phpunit: 11.5.* }
- { laravel: 12.*, testbench: 10.*, php: 8.2, phpunit: 11.5.* }
- { laravel: 11.*, testbench: 9.*, php: 8.2, phpunit: 10.5.* }
name: laravel v${{ matrix.laravel }} x php v${{ matrix.php }}
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: fileinfo
coverage: none
- name: 🚚 Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ matrix.php }}-composer
- name: 📦 Install dependencies
run: |
sed -i '/\"require\": {/,/},/d; /\"require-dev\": {/,/},/d' composer.json
composer config --global allow-plugins true
if [[ "${{ matrix.laravel }}" == *"-dev"* ]]; then
echo "Setting minimum-stability to dev for ${{ matrix.laravel }}"
composer config minimum-stability "dev"
composer config prefer-stable true
fi
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
if [[ "${{ matrix.laravel }}" == *"-dev"* ]]; then
echo "Running composer update (latest dependencies)"
composer update -W --no-interaction --prefer-dist --optimize-autoloader
else
echo "Running composer update --prefer-lowest"
composer update --prefer-lowest -W --no-interaction --prefer-dist --optimize-autoloader
fi
- name: ✅ Execute tests
run: vendor/bin/phpunit --testsuite laravel