PHP CI #528
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
# For details of what checks are run for PRs please refer below | |
# see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: PHP CI | |
on: | |
push: | |
branches: [ "master", "main" ] | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
# schedule weekly tests, since dependencies are not intended to be pinned | |
# this means: at 23:42 on Fridays | |
- cron: '42 23 * * 5' | |
env: | |
PHP_VERSION_LATEST: '8.3' | |
jobs: | |
tests: | |
name: php${{ matrix.php }} ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
REPORTS_DIR: CI_reports | |
REPORTS_ARTIFACT: tests-reports | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
php: | |
- '8.3' # highest supported | |
- '8.2' | |
- '8.1' | |
- '8.0' | |
- '7.4' | |
- '7.3' # lowest supported | |
include: | |
- # highest supported Windows | |
os: windows-latest | |
php: '8.3' # highest supported | |
- # highest supported macOS | |
os: macos-latest | |
php: '8.3' | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
# see https://github.com/shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: json | |
tools: composer | |
coverage: pcov | |
- name: dir setup | |
run: mkdir ${{ env.REPORTS_DIR }} | |
- name: Validate composer.json and composer.lock | |
run: > | |
composer validate | |
--no-interaction | |
- name: Install dependencies | |
run: > | |
composer install | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
- name: Run PHPUnit tests | |
run: > | |
php | |
-d zend.assertions=1 | |
-d assert.exception=1 | |
-d display_errors=On | |
-d error_reporting=-1 | |
-d log_errors_max_len=0 | |
-d memory_limit=-1 | |
vendor/phpunit/phpunit/phpunit | |
--log-junit=${{ env.REPORTS_DIR }}/tests.${{ matrix.os }}_php${{ matrix.php }}.junit.xml | |
--coverage-clover=${{ env.REPORTS_DIR }}/coverage.${{ matrix.os}}_php${{ matrix.php }}.clover.xml | |
--no-interaction | |
--do-not-cache-result | |
- name: Artifact reports | |
if: ${{ ! cancelled() }} | |
# see https://github.com/actions/upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ env.REPORTS_ARTIFACT }}_PHPUnit_php${{ matrix.php }}_${{ matrix.os }}' | |
path: ${{ env.REPORTS_DIR }} | |
if-no-files-found: error | |
code-checker: | |
name: Code Analysis (php${{ matrix.php-version }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
REPORTS_DIR: CI_reports | |
REPORTS_ARTIFACT: code-reports | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- '8.3' # highest supported | |
- '7.3' # lowest supported | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
# see https://github.com/shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION_LATEST }} | |
tools: composer | |
coverage: none | |
- name: Install psalm | |
run: > | |
composer install | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
working-directory: tools/psalm | |
- name: Install dependencies | |
run: > | |
composer config platform.php ${{ matrix.php-version }} && | |
composer install | |
--no-dev | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
- name: Run Psalm tests | |
run: > | |
php tools/psalm/vendor/vimeo/psalm/psalm | |
--php-version=${{ matrix.php-version }} | |
--no-diff | |
--no-cache | |
--long-progress | |
--report=${{ env.REPORTS_DIR }}/psalm.php${{ matrix.php-version }}.junit.xml | |
- name: Artifact reports | |
if: ${{ ! cancelled() }} | |
# see https://github.com/actions/upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ env.REPORTS_ARTIFACT }}_CodeCheck_php${{ matrix.php-version }}' | |
path: ${{ env.REPORTS_DIR }} | |
if-no-files-found: error | |
style-checker: | |
name: Coding Standards | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
# see https://github.com/shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION_LATEST }} | |
tools: composer | |
coverage: none | |
- name: Install PHP-CS-Fixer | |
run: > | |
composer install | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
working-directory: tools/php-cs-fixer | |
- name: Install dependencies | |
run: > | |
composer install | |
--no-dev | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
- name: Run PHP-CS-Fixer tests | |
run: > | |
php tools/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer | |
fix | |
--dry-run | |
--diff | |
--using-cache=no | |
--show-progress=dots | |
--no-interaction | |
composer-require-checker: | |
name: CompoerRequireChecker | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
# see https://github.com/shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION_LATEST }} | |
tools: composer | |
coverage: none | |
- name: Install composer-require-checker | |
run: > | |
composer install | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
working-directory: tools/composer-require-checker | |
- name: Install dependencies | |
run: > | |
composer install | |
--no-dev | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
- name: Run composer-require-checker tests | |
run: > | |
php tools/composer-require-checker/vendor/maglnet/composer-require-checker/bin/composer-require-checker | |
--no-interaction | |
composer-unused: | |
name: CompoerUnused | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
# see https://github.com/shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION_LATEST }} | |
tools: composer | |
coverage: none | |
- name: Install composer-require-checker | |
run: > | |
composer install | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
working-directory: tools/composer-unused | |
- name: Install dependencies | |
run: > | |
composer install | |
--no-dev | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
- name: Run composer-unused tests | |
run: > | |
php tools/composer-unused/vendor/icanhazstring/composer-unused/bin/composer-unused | |
--no-progress | |
--no-interaction | |
composer-normalize: | |
name: Composer normalize | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
# see https://github.com/shivammathur/setup-php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION_LATEST }} | |
tools: composer | |
coverage: none | |
- name: Install composer-normalize | |
run: > | |
composer install | |
--prefer-dist | |
--no-interaction | |
--no-progress | |
--no-suggest | |
working-directory: tools/composer-normalize | |
- name: Run composer-normalize tests | |
run: > | |
composer -dtools/composer-normalize | |
normalize | |
--dry-run | |
--diff | |
--no-check-lock | |
--no-update-lock | |
--no-interaction | |
$PWD/composer.json |