-
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 'feature/move-to-gh-actions' of https://github.com/jrfnl…
- Loading branch information
Showing
8 changed files
with
223 additions
and
140 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,38 @@ | ||
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' | ||
|
||
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 | ||
|
||
- name: 'Composer: require PHPStan' | ||
run: composer require --no-update --dev phpstan/phpstan | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v1" | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/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,105 @@ | ||
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' | ||
|
||
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 | ||
|
||
# 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' | ||
run: vendor/bin/phpunit tests/AllTests.php | ||
|
||
- name: 'PHPCS: check code style without cache, no parallel' | ||
if: ${{ matrix.custom_ini == false }} | ||
run: php bin/phpcs --no-cache --parallel=1 | ||
|
||
- 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,76 @@ | ||
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' | ||
|
||
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.