-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from Automattic/update-actions
update actions setup
- Loading branch information
Showing
10 changed files
with
299 additions
and
155 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,70 @@ | ||
name: CS & Lint | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the "push" build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
pull_request: | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
checkcs: | ||
name: "Basic CS and QA checks" | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
XMLLINT_INDENT: " " | ||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.4" | ||
coverage: none | ||
tools: cs2pr | ||
|
||
# Show PHP lint violations inline in the file diff. | ||
# @link https://github.com/marketplace/actions/xmllint-problem-matcher | ||
- name: Register PHP lint violations to appear as file diff comments | ||
uses: korelstar/phplint-problem-matcher@v1 | ||
|
||
# Show XML violations inline in the file diff. | ||
# @link https://github.com/marketplace/actions/xmllint-problem-matcher | ||
- name: Register XML violations to appear as file diff comments | ||
uses: korelstar/xmllint-problem-matcher@v1 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
# Validate the composer.json file. | ||
# @link https://getcomposer.org/doc/03-cli.md#validate | ||
- name: Validate Composer installation | ||
run: composer validate --no-check-all | ||
|
||
# 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 | ||
|
||
# Lint PHP. | ||
- name: Lint PHP against parse errors | ||
run: composer lint-ci | cs2pr | ||
|
||
# Needed as runs-on: system doesn't have xml-lint by default. | ||
# @link https://github.com/marketplace/actions/xml-lint | ||
- name: Lint phpunit.xml.dist | ||
uses: ChristophWurst/xmllint-action@v1 | ||
with: | ||
xml-file: ./phpunit.xml.dist | ||
xml-schema-file: ./vendor/phpunit/phpunit/phpunit.xsd | ||
|
||
# Check the code-style consistency of the PHP files. | ||
# - name: Check PHP code style | ||
# continue-on-error: true | ||
# run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml | ||
|
||
# - name: Show PHPCS results in PR | ||
# run: cs2pr ./phpcs-report.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Run PHPUnit | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
# Prevent the "push" build from running when there are only irrelevant changes. | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
pull_request: | ||
# Allow manually triggering the workflow. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }} | ||
# Ubuntu-20.x includes MySQL 8.0, which causes `caching_sha2_password` issues with PHP < 7.4 | ||
# https://www.php.net/manual/en/mysqli.requirements.php | ||
# TODO: change to ubuntu-latest when we no longer support PHP < 7.4 | ||
runs-on: ubuntu-18.04 | ||
|
||
env: | ||
WP_VERSION: ${{ matrix.wordpress }} | ||
|
||
strategy: | ||
matrix: | ||
wordpress: ["5.5", "5.6", "5.7"] | ||
php: ["5.6", "7.0", "7.1", "7.2", "7.3", "7.4"] | ||
include: | ||
- php: "8.0" | ||
# Ignore platform requirements, so that PHPUnit 7.5 can be installed on PHP 8.0 (and above). | ||
composer-options: "--ignore-platform-reqs" | ||
extensions: pcov | ||
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\"" | ||
coverage: pcov | ||
exclude: | ||
- php: "8.0" | ||
wordpress: "5.5" | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP ${{ matrix.php }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: ${{ matrix.extensions }} | ||
ini-values: ${{ matrix.ini-values }} | ||
coverage: ${{ matrix.coverage }} | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
# Setup PCOV since we're using PHPUnit < 8 which has it integrated. Requires PHP 7.1. | ||
# Ignore platform reqs to make it install on PHP 8. | ||
# https://github.com/krakjoe/pcov-clobber | ||
- name: Setup PCOV | ||
if: ${{ matrix.php == 8.0 }} | ||
run: | | ||
composer require pcov/clobber --ignore-platform-reqs | ||
vendor/bin/pcov clobber | ||
- name: Setup Problem Matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Install Composer dependencies | ||
uses: ramsey/composer-install@v1 | ||
with: | ||
composer-options: "${{ matrix.composer-options }}" | ||
|
||
- name: Start MySQL Service | ||
run: sudo systemctl start mysql.service | ||
|
||
- name: Prepare environment for integration tests | ||
run: composer prepare-ci | ||
|
||
- name: Run integration tests (single site) | ||
if: ${{ matrix.php != 8.0 }} | ||
run: composer test | ||
- name: Run integration tests (single site with code coverage) | ||
if: ${{ matrix.php == 8.0 }} | ||
run: composer coverage-ci | ||
- name: Run integration tests (multisite) | ||
run: composer test-ms |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
.DS_Store | ||
.vscode/ | ||
composer.lock | ||
vendor/ | ||
/vendor |
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,70 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="syndication" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
<description>Custom ruleset for syndication plugin.</description> | ||
|
||
<!-- For help in understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> | ||
<!-- For help in using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> | ||
|
||
<!-- What to scan --> | ||
<file>.</file> | ||
<!-- Ignoring Files and Folders: | ||
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders --> | ||
<exclude-pattern>/vendor/</exclude-pattern> | ||
|
||
<!-- How to scan --> | ||
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> | ||
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> | ||
<!-- Show sniff and progress --> | ||
<arg value="sp"/> | ||
<!-- Strip the file paths down to the relevant bit --> | ||
<arg name="basepath" value="./"/> | ||
<!-- Show results with colors --> | ||
<arg name="colors"/> | ||
<!-- Limit to PHP files --> | ||
<arg name="extensions" value="php"/> | ||
<!-- Enables parallel processing when available for faster results. --> | ||
<arg name="parallel" value="8"/> | ||
|
||
<!-- Rules: Check PHP version compatibility - see | ||
https://github.com/PHPCompatibility/PHPCompatibilityWP --> | ||
<rule ref="PHPCompatibilityWP"/> | ||
<!-- For help in understanding this testVersion: | ||
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> | ||
<config name="testVersion" value="5.6-"/> | ||
|
||
<!-- Rules: WordPress Coding Standards - see | ||
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> | ||
<!-- WordPress-Extra includes WordPress-Core --> | ||
<rule ref="WordPress-Extra"/> | ||
<rule ref="WordPress-Docs"/> | ||
<!-- For help in understanding these custom sniff properties: | ||
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties --> | ||
<config name="minimum_supported_wp_version" value="5.5"/> | ||
|
||
<!-- Rules: WordPress VIP - see | ||
https://github.com/Automattic/VIP-Coding-Standards --> | ||
<rule ref="WordPress-VIP-Go"/> | ||
|
||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"> | ||
<properties> | ||
<property name="prefixes" type="array"> | ||
<element value="syndication"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WordPress.WP.I18n"> | ||
<properties> | ||
<property name="text_domain" type="array"> | ||
<element value="syndication"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> | ||
<properties> | ||
<property name="blank_line_check" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
</ruleset> |
Oops, something went wrong.