mirror of
https://github.com/pmmp/BedrockProtocol.git
synced 2025-03-01 02:21:12 +00:00
90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request, workflow_dispatch]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
strategy:
|
|
matrix:
|
|
php: ['8.1', '8.2', '8.3', '8.4']
|
|
name: Tests (PHP ${{ matrix.php }})
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@2.32.0
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
ini-values: xdebug.max_nesting_level=3000
|
|
|
|
- name: Load Composer package cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "~/.cache/composer"
|
|
key: "php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
|
|
restore-keys: "php-${{ matrix.php }}-composer-"
|
|
|
|
- name: Install dependencies
|
|
run: composer install --prefer-dist --no-interaction
|
|
|
|
- name: Run PHPStan
|
|
run: ./vendor/bin/phpstan analyze --no-progress
|
|
|
|
- name: Run PHPUnit tests
|
|
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
|
|
|
|
codegen:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
needs: codestyle #to avoid false positives
|
|
name: Generated Code consistency checks
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@2.32.0
|
|
with:
|
|
php-version: 8.1
|
|
ini-values: xdebug.max_nesting_level=3000
|
|
tools: php-cs-fixer:3
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Load Composer package cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "~/.cache/composer"
|
|
key: "php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
|
|
restore-keys: "php-${{ matrix.php }}-composer-"
|
|
|
|
- name: Install dependencies
|
|
run: composer install --prefer-dist --no-interaction
|
|
|
|
- name: Verify ::create() methods are up to date
|
|
run: |
|
|
php tools/generate-create-static-methods.php
|
|
php-cs-fixer fix
|
|
git diff
|
|
git diff --quiet #to set the exit code
|
|
|
|
codestyle:
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
name: Code Style checks
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@2.32.0
|
|
with:
|
|
php-version: 8.2
|
|
ini-values: xdebug.max_nesting_level=3000
|
|
tools: php-cs-fixer:3
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run PHP-CS-Fixer
|
|
run: php-cs-fixer fix --dry-run --diff
|