Update CI #2
This file contains hidden or 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: [ 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/macOS) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| sudo apt-get update || brew install [email protected] | |
| sudo apt-get install -y php8.2-cli php8.2-xml php8.2-curl || true | |
| php -v | |
| - name: Setup PHP (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| choco install php --version=8.2 | |
| php -v | |
| - name: Install Composer | |
| run: | | |
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
| 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 --strict | |
| 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 --coverage-text | |
| 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 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP and tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y php8.2-cli php8.2-xml | |
| curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
| composer global require phpstan/phpstan | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run PHPStan | |
| run: ~/.composer/vendor/bin/phpstan analyse src tests --level=5 | |
| code-style: | |
| name: Code Style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP and tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y php8.2-cli php8.2-xml | |
| curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
| composer global require friendsofphp/php-cs-fixer | |
| - name: Check coding standards | |
| run: ~/.composer/vendor/bin/php-cs-fixer fix --dry-run --diff |