-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into user-configurable-config-file-location
- Loading branch information
Showing
180 changed files
with
7,150 additions
and
733 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: PHPStan | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
phpstan: | ||
name: "PHP: 7.4 | PHPStan" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
tools: phpstan | ||
|
||
# Install dependencies and handle caching in one go. | ||
# Dependencies need to be installed to make sure the PHPUnit classes are recognized. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v1" | ||
|
||
- name: Run PHPStan | ||
run: phpstan analyse --configuration=phpstan.neon |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
name: Test | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
# Keys: | ||
# - custom_ini: Whether to run with specific custom ini settings to hit very specific | ||
# code conditions. | ||
# - experimental: Whether the build is "allowed to fail". | ||
matrix: | ||
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] | ||
custom_ini: [false] | ||
experimental: [false] | ||
|
||
include: | ||
# Builds running the basic tests with different PHP ini settings. | ||
- php: '5.5' | ||
custom_ini: true | ||
experimental: false | ||
- php: '7.0' | ||
custom_ini: true | ||
experimental: false | ||
|
||
# Nightly. | ||
- php: '8.1' | ||
custom_ini: false | ||
experimental: true | ||
|
||
name: "PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}" | ||
|
||
continue-on-error: ${{ matrix.experimental }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup ini config | ||
id: set_ini | ||
run: | | ||
# On stable PHPCS versions, allow for PHP deprecation notices. | ||
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. | ||
# Also set the "short_open_tag" ini to make sure specific conditions are tested. | ||
if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '5.5' ]]; then | ||
echo '::set-output name=PHP_INI::phar.readonly=Off, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On' | ||
elif [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.0' ]]; then | ||
echo '::set-output name=PHP_INI::phar.readonly=Off, date.timezone=Australia/Sydney, short_open_tag=On' | ||
else | ||
echo '::set-output name=PHP_INI::phar.readonly=Off' | ||
fi | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
ini-values: ${{ steps.set_ini.outputs.PHP_INI }} | ||
coverage: none | ||
tools: cs2pr | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies - normal | ||
if: ${{ matrix.php < 8.0 }} | ||
uses: "ramsey/composer-install@v1" | ||
|
||
# For PHP 8.0+, we need to install with ignore platform reqs as PHPUnit 7 is still used. | ||
- name: Install Composer dependencies - with ignore platform | ||
if: ${{ matrix.php >= 8.0 }} | ||
uses: "ramsey/composer-install@v1" | ||
with: | ||
composer-options: --ignore-platform-reqs | ||
|
||
# Note: The code style check is run multiple times against every PHP version | ||
# as it also acts as an integration test. | ||
- name: 'PHPCS: set the path to PHP' | ||
run: php bin/phpcs --config-set php_path php | ||
|
||
- name: 'PHPUnit: run the tests' | ||
if: ${{ matrix.php != 8.1 }} | ||
run: vendor/bin/phpunit tests/AllTests.php | ||
|
||
# We need to ignore the config file so that PHPUnit doesn't try to read it. | ||
# The config file causes an error on PHP 8.1+ with PHPunit 7, but it's not needed here anyway | ||
# as we can pass all required settings in the phpunit command. | ||
- name: 'PHPUnit: run the tests on PHP nightly' | ||
if: ${{ matrix.php == 8.1 }} | ||
run: vendor/bin/phpunit tests/AllTests.php --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests | ||
|
||
- name: 'PHPCS: check code style without cache, no parallel' | ||
if: ${{ matrix.custom_ini == false && matrix.php != 7.4 }} | ||
run: php bin/phpcs --no-cache --parallel=1 | ||
|
||
- name: 'PHPCS: check code style to show results in PR' | ||
if: ${{ matrix.custom_ini == false && matrix.php == 7.4 }} | ||
continue-on-error: true | ||
run: php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml | ||
|
||
- name: Show PHPCS results in PR | ||
if: ${{ matrix.custom_ini == false && matrix.php == 7.4 }} | ||
run: cs2pr ./phpcs-report.xml | ||
|
||
- name: 'Composer: validate config' | ||
if: ${{ matrix.custom_ini == false }} | ||
run: composer validate --no-check-all --strict | ||
|
||
- name: Build the phar | ||
if: ${{ matrix.custom_ini == false }} | ||
run: php scripts/build-phar.php | ||
|
||
- name: 'PHPCS: check code style using the Phar file' | ||
if: ${{ matrix.custom_ini == false }} | ||
run: php phpcs.phar |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Validate | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
checkxml: | ||
name: Check XML files | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
XMLLINT_INDENT: ' ' | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install xmllint | ||
run: sudo apt-get install --no-install-recommends -y libxml2-utils | ||
|
||
- name: Retrieve XML Schema | ||
run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd | ||
|
||
# Show XML violations inline in the file diff. | ||
# @link https://github.com/marketplace/actions/xmllint-problem-matcher | ||
- uses: korelstar/xmllint-problem-matcher@v1 | ||
|
||
# Validate the XML ruleset files. | ||
# @link http://xmlsoft.org/xmllint.html | ||
- name: Validate rulesets against schema | ||
run: xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml | ||
|
||
# Validate the XSD file. | ||
# @link http://xmlsoft.org/xmllint.html | ||
- name: Validate XSD against schema | ||
run: xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd | ||
|
||
# Check the code-style consistency of the XML files. | ||
- name: Check XML code style | ||
run: | | ||
diff -B ./phpcs.xml.dist <(xmllint --format "./phpcs.xml.dist") | ||
diff -B ./src/Standards/Generic/ruleset.xml <(xmllint --format "./src/Standards/Generic/ruleset.xml") | ||
diff -B ./src/Standards/MySource/ruleset.xml <(xmllint --format "./src/Standards/MySource/ruleset.xml") | ||
diff -B ./src/Standards/PEAR/ruleset.xml <(xmllint --format "./src/Standards/PEAR/ruleset.xml") | ||
diff -B ./src/Standards/PSR1/ruleset.xml <(xmllint --format "./src/Standards/PSR1/ruleset.xml") | ||
diff -B ./src/Standards/PSR2/ruleset.xml <(xmllint --format "./src/Standards/PSR2/ruleset.xml") | ||
diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml") | ||
diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml") | ||
diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml") | ||
pear: | ||
name: "PHP: 7.4 | PEAR package validation" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
|
||
- name: Validate the PEAR package file contents | ||
run: php scripts/validate-pear-package.php | ||
|
||
- name: Validate the PEAR package | ||
run: pear package-validate package.xml |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.