Skip to content

fix

fix #14

Workflow file for this run

name: CI

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

No steps defined in `steps` and no workflow called in `uses` for the following jobs: test
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
jobs:
test:
name: PHP Tests - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
# PHP installation and setup using built-in tools
- name: Setup PHP (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php8.2 php8.2-cli php8.2-xml php8.2-curl php8.2-mbstring
php -v
shell: bash
- name: Setup PHP (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install [email protected]
brew link [email protected] --force
php -v
shell: bash
- name: Setup PHP (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install php --version=8.2 --params '"/ExtensionList:mbstring,curl,openssl,xml"'
refreshenv
php -v
shell: pwsh
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-pcntl
shell: bash
- name: Install Composer (Unix)
if: matrix.os != 'windows-latest'
run: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
shell: bash
- name: Validate composer.json
run: composer validate
shell: bash
- name: Cache Composer packages
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
shell: bash
- name: Run test suite
run: vendor/bin/phpunit
shell: bash
- name: Verify binary installation
run: |
php -r "require 'vendor/autoload.php'; new VoltTest\Platform();"
shell: bash
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}
path: |
./build/logs
./phpunit.xml
./coverage.xml
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup PHP
run: |
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php8.2 php8.2-cli php8.2-xml php8.2-mbstring
shell: bash
- name: Install Composer
run: |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo chmod +x /usr/local/bin/composer
mkdir -p ~/.composer
sudo chown -R $USER:$USER ~/.composer
shell: bash
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer packages
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Dependencies
run: |
composer install --prefer-dist --no-progress
composer require --dev phpstan/phpstan --with-all-dependencies
shell: bash
- name: Create PHPStan config
run: |
echo '
parameters:
level: 5
paths:
- src
- tests
excludePaths:
- vendor/*
' > phpstan.neon
- name: Run PHPStan
run: |
if [ -f "vendor/bin/phpstan" ]; then
vendor/bin/phpstan analyse -c phpstan.neon
else
echo "PHPStan not found in vendor/bin"
exit 1
fi
shell: bash
code-style:
name: Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP and tools
run: |
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php8.2 php8.2-cli php8.2-xml php8.2-mbstring
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
- name: Install PHP CS Fixer
run: |
composer require --dev friendsofphp/php-cs-fixer
- name: Create PHP CS Fixer config
run: |
echo "<?php
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'ordered_imports' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
);
" > .php-cs-fixer.php
- name: Check coding standards
run: vendor/bin/php-cs-fixer fix --dry-run --diff