Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1107 from Automattic/release/5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryJones authored Oct 18, 2022
2 parents da073ea + 9303541 commit 25dac3a
Show file tree
Hide file tree
Showing 41 changed files with 1,732 additions and 1,680 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is for unifying the coding style for different editors and IDEs.
# It is based on https://core.trac.wordpress.org/browser/trunk/.editorconfig.
# See https://editorconfig.org for more information about the standard.

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.txt]
end_of_line = crlf
81 changes: 81 additions & 0 deletions .github/workflows/cs-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
checkcs:
name: 'Basic CS and QA checks'
runs-on: ubuntu-20.04

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@v3

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict --no-interaction

# 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@v2

# Lint PHP.
- name: Lint PHP against parse errors
run: composer lint-ci --no-interaction | 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

- name: Lint .phpcs.xml.dist
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./.phpcs.xml.dist
xml-schema-file: ./vendor/squizlabs/php_codesniffer/phpcs.xsd

# Check the code-style consistency of the PHP files.
# - name: Check PHP code style
# run: composer cs -- --report-full --report-checkstyle=./phpcs-report.xml
#
# - name: Show PHPCS results in PR
# run: cs2pr ./phpcs-report.xml
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy to WordPress.org
on:
release:
types: [released]
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
release:
name: New release to WordPress.org
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build # Remove or modify this step as needed
run: composer install --no-dev --classmap-authoritative
- name: Push to WordPress.org
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
79 changes: 79 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Integration Tests

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:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04

env:
WP_VERSION: ${{ matrix.wp }}

strategy:
# PHP 7.1 uses PHPUnit 7.5.20
# PHP 7.2 uses PHPUnit 8.5.21
# PHP 7.3 uses PHPUnit 9.5.10
# PHP 7.4 uses PHPUnit 9.5.10
# PHP 8.0 uses PHPUnit 9.5.10
# PHP 8.1 uses PHPUnit 9.5.10
# PHP 8.2 uses PHPUnit 9.5.10
# Keys:
# - experimental: Whether the build is "allowed to fail".
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
wp: ['latest']
experimental: [false]
include:
- php: '7.1'
wp: '5.8.5'
experimental: false
- php: '8.2'
wp: 'trunk'
experimental: true
fail-fast: false
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: ${{ matrix.ini-values }}

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Start MySQL Service
run: sudo systemctl start mysql.service

- name: Setting mysql_native_password for PHP <= 7.3
if: ${{ matrix.php <= 7.3 }}
run: mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"

- name: Prepare environment for integration tests
run: composer prepare-ci --no-interaction

- name: Run integration tests (multi site)
run: composer test-ms --no-interaction
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
vendor
resty
jsawk
facebook-instant-articles-wp.zip
/facebook-instant-articles-wp.zip
/.phpcs.xml
/.phpunit.result.cache
/.wp-env.override.json
/composer.lock
/vendor
71 changes: 71 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="wp-parsely" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Custom ruleset for instant-articles 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>/tests/Facebook/</exclude-pattern>
<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="7.1-"/>

<!-- 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="4.3"/>

<!-- 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="instant_articles"/>-->
<!-- </property>-->
<!-- </properties>-->
<!-- </rule>-->

<!-- <rule ref="WordPress.WP.I18n">-->
<!-- <properties>-->
<!-- <property name="text_domain" type="array">-->
<!-- <element value="instant-articles"/>-->
<!-- </property>-->
<!-- </properties>-->
<!-- </rule>-->

<!-- <rule ref="WordPress.WhiteSpace.ControlStructureSpacing">-->
<!-- <properties>-->
<!-- <property name="blank_line_check" value="true"/>-->
<!-- </properties>-->
<!-- </rule>-->

</ruleset>
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit 25dac3a

Please sign in to comment.