release/v0.1.2 #80
Workflow file for this run
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, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| name: PHP Tests - ${{ matrix.os }} - PHP ${{ matrix.php }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| php: [8.0 ,8.1 ,8.2, 8.3, 8.4] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Setup PHP for Linux | |
| - 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 php${{ matrix.php }} php${{ matrix.php }}-cli php${{ matrix.php }}-xml php${{ matrix.php }}-curl php${{ matrix.php }}-mbstring | |
| php -v | |
| shell: bash | |
| # Setup PHP for macOS | |
| - name: Setup PHP (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install php@${{ matrix.php }} | |
| brew link php@${{ matrix.php }} --force | |
| php -v | |
| shell: bash | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(wsl composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - 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- | |
| # Install dependencies | |
| - name: Install dependencies (Windows via WSL) | |
| if: matrix.os == 'windows-latest' | |
| run: wsl composer install --prefer-dist --no-progress | |
| shell: pwsh | |
| - name: Install dependencies (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: composer install --prefer-dist --no-progress | |
| shell: bash | |
| # Run tests | |
| - name: Run test suite (Windows via WSL) | |
| if: matrix.os == 'windows-latest' | |
| run: wsl vendor/bin/phpunit | |
| shell: pwsh | |
| - name: Run test suite (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: vendor/bin/phpunit | |
| 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 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: Install Dependencies | |
| run: | | |
| composer install --prefer-dist --no-progress | |
| composer require --dev phpstan/phpstan --with-all-dependencies | |
| shell: bash | |
| - name: Run PHPStan | |
| run: vendor/bin/phpstan analyse --level=5 src tests | |
| shell: bash | |
| code-style: | |
| name: Code Style | |
| 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 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: Install Dependencies | |
| run: | | |
| composer install --prefer-dist --no-progress | |
| composer require --dev friendsofphp/php-cs-fixer --with-all-dependencies | |
| shell: bash | |
| - 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 | |
| shell: bash | |
| - name: Check coding standards | |
| run: vendor/bin/php-cs-fixer fix --dry-run --diff | |
| shell: bash |