Skip to content

fix issue #5567

fix issue #5567 #12

Workflow file for this run

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
on:
- pull_request
- push
name: CI
env:
COMPOSER_ROOT_VERSION: "10.4-dev"
permissions:
contents: read
jobs:
coding-guidelines:
name: Coding Guidelines
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: none, iconv, json, phar, tokenizer
coverage: none
tools: none
- name: Run PHP-CS-Fixer
run: ./tools/php-cs-fixer fix --dry-run --show-progress=dots --using-cache=no --verbose
type-checker:
name: Type Checker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: none, ctype, curl, date, dom, json, libxml, mbstring, phar, simplexml, soap, tokenizer, xml, xmlwriter, zlib
coverage: none
tools: none
- name: Install dependencies with Composer
run: ./tools/composer update --no-interaction --no-ansi --no-progress
- name: Run Psalm on public API
run: ./tools/psalm --config=.psalm/static-analysis.xml --no-progress --show-info=false
- name: Run Psalm on internal code
run: ./tools/psalm --config=.psalm/config.xml --no-progress --shepherd --show-info=false --stats
unit-tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
env:
PHP_EXTENSIONS: none, curl, dom, json, libxml, mbstring, openssl, phar, soap, tokenizer, xml, xmlwriter
PHP_INI_VALUES: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
php-version:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
- name: Configure Git to avoid issues with line endings
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: none
- name: Install dependencies with Composer
run: php ./tools/composer update --no-ansi --no-interaction --no-progress
- name: Run tests with PHPUnit
run: php ./phpunit --testsuite unit
end-to-end-tests:
name: End-to-End Tests
needs:
- unit-tests
runs-on: ${{ matrix.os }}
env:
PHP_EXTENSIONS: none, curl, dom, json, libxml, mbstring, openssl, phar, soap, tokenizer, xml, xmlwriter
PHP_INI_VALUES: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
php-version:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
- name: Configure Git to avoid issues with line endings
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
coverage: pcov
tools: none
- name: Install dependencies with Composer
run: php ./tools/composer update --no-ansi --no-interaction --no-progress
- name: Run tests with PHPUnit
run: php ./phpunit --testsuite end-to-end
code-coverage:
name: Code Coverage
needs:
- end-to-end-tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: pcov
extensions: none, curl, dom, json, libxml, mbstring, phar, soap, tokenizer, xml, xmlwriter
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
tools: none
- name: Install dependencies with Composer
run: ./tools/composer update --no-ansi --no-interaction --no-progress
- name: Collect code coverage with PHPUnit
run: ./phpunit --coverage-clover=coverage.xml
- name: Send code coverage report to Codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
build-phar:
name: Build PHAR
needs:
- end-to-end-tests
runs-on: ubuntu-latest
env:
PHP_EXTENSIONS: none, dom, json, fileinfo, iconv, libxml, mbstring, phar, soap, tokenizer, xml, xmlwriter
PHP_INI_VALUES: assert.exception=1, phar.readonly=0, zend.assertions=1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: none
- name: Install java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
- name: Build PHAR
run: ant phar-snapshot
- name: Check whether PHAR is scoped
run: cat build/artifacts/phpunit-snapshot.phar | grep -q PHPUnit\\\\DeepCopy\\\\Exception\\\\CloneException || (echo "phpunit-snapshot.phar is not scoped." && false)
- name: Upload PHAR
uses: actions/upload-artifact@v3
with:
name: phpunit-snapshot-phar
path: ./build/artifacts/phpunit-snapshot.phar
retention-days: 7
test-phar:
name: Test PHAR
needs:
- build-phar
runs-on: ubuntu-latest
env:
PHP_EXTENSIONS: none, curl, dom, json, fileinfo, iconv, libxml, mbstring, phar, soap, tokenizer, xml, xmlwriter
PHP_INI_VALUES: assert.exception=1, phar.readonly=0, zend.assertions=1
strategy:
fail-fast: false
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
coverage:
- pcov
- xdebug
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: none
- name: Install java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
- name: Download PHAR
uses: actions/download-artifact@v3
with:
name: phpunit-snapshot-phar
path: ./build/artifacts/
- name: Make PHAR executable
run: chmod +x ./build/artifacts/phpunit-snapshot.phar
- name: Run PHAR-specific tests
run: ant run-phar-specific-tests