CI #2581
This file contains 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
# https://docs.github.com/en/actions | |
on: | |
pull_request: null | |
push: null | |
schedule: | |
- cron: "15 0 * * *" | |
name: CI | |
env: | |
COMPOSER_ROOT_VERSION: "12.0.x-dev" | |
permissions: | |
contents: read | |
jobs: | |
dependency-validation: | |
name: Dependency Validation | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
extensions: none, ctype, curl, dom, json, libxml, mbstring, openssl, phar, tokenizer, xml, xmlwriter | |
coverage: none | |
tools: none | |
- name: Ensure that composer.json is valid | |
run: ./tools/composer validate --no-ansi --strict composer.json | |
- name: Ensure that dependencies can be installed | |
run: ./tools/composer install --no-ansi --dry-run | |
coding-guidelines: | |
name: Coding Guidelines | |
if: github.event_name != 'schedule' | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
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 | |
static-analysis: | |
name: Static Analysis | |
if: github.event_name != 'schedule' | |
needs: | |
- dependency-validation | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: none | |
- name: Install dependencies with Composer | |
run: ./tools/composer update --no-interaction --no-ansi --no-progress | |
- name: Run PHPStan | |
run: ./tools/phpstan analyse --no-progress --error-format=github | |
unit-tests: | |
name: Unit Tests | |
needs: | |
- dependency-validation | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
env: | |
PHP_EXTENSIONS: none, ctype, curl, dom, json, libxml, mbstring, openssl, phar, 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.3" | |
- "8.4" | |
- "8.5" | |
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@v4 | |
- 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 install --no-ansi --no-interaction --no-progress | |
- name: Run tests with PHPUnit | |
run: php ./phpunit --testsuite unit --order-by depends,random | |
end-to-end-tests: | |
name: End-to-End Tests | |
needs: | |
- unit-tests | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
env: | |
PHP_EXTENSIONS: none, ctype, curl, dom, json, libxml, mbstring, openssl, pdo, phar, 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.3" | |
- "8.4" | |
- "8.5" | |
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@v4 | |
- 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 install --no-ansi --no-interaction --no-progress | |
- name: Run tests with PHPUnit | |
run: php ./phpunit --testsuite end-to-end --order-by depends,random | |
code-coverage: | |
name: Code Coverage | |
if: github.event_name != 'schedule' | |
needs: | |
- end-to-end-tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP with extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.4 | |
coverage: xdebug | |
extensions: none, ctype, curl, dom, json, libxml, mbstring, pdo, phar, 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 install --no-ansi --no-interaction --no-progress | |
- name: Collect code coverage with PHPUnit | |
run: ./phpunit --log-junit junit.xml --coverage-clover=coverage.xml | |
- name: Upload test results to Codecov.io | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload code coverage data to Codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build-phar: | |
name: Build PHAR | |
if: github.event_name != 'schedule' | |
needs: | |
- end-to-end-tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
env: | |
PHP_EXTENSIONS: none, ctype, dom, json, fileinfo, iconv, libxml, mbstring, phar, tokenizer, xml, xmlwriter | |
PHP_INI_VALUES: assert.exception=1, phar.readonly=0, zend.assertions=1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP with extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: none | |
extensions: ${{ env.PHP_EXTENSIONS }} | |
ini-values: ${{ env.PHP_INI_VALUES }} | |
tools: none | |
- name: Install java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 11 | |
- name: Build PHAR | |
run: ant phar-snapshot | |
- name: Check whether PHAR is scoped | |
run: grep -q PHPUnitPHAR\\\\DeepCopy\\\\Exception\\\\CloneException build/artifacts/phpunit-snapshot.phar || (echo "phpunit-snapshot.phar is not scoped." && false) | |
- name: Upload PHAR | |
uses: actions/upload-artifact@v4 | |
with: | |
name: phpunit-snapshot-phar | |
overwrite: true | |
path: ./build/artifacts/phpunit-snapshot.phar | |
retention-days: 7 | |
test-phar: | |
name: Test PHAR | |
if: github.event_name != 'schedule' | |
needs: | |
- build-phar | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
env: | |
PHP_EXTENSIONS: none, ctype, curl, dom, json, fileinfo, iconv, libxml, mbstring, phar, tokenizer, xml, xmlwriter | |
PHP_INI_VALUES: assert.exception=1, phar.readonly=0, zend.assertions=1 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- "8.3" | |
- "8.4" | |
- "8.5" | |
coverage: | |
- pcov | |
- xdebug | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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@v4 | |
with: | |
distribution: zulu | |
java-version: 11 | |
- name: Download PHAR | |
uses: actions/download-artifact@v4 | |
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 |