Skip to content

Commit 63b41c0

Browse files
authored
Merge pull request #117 from Automattic/update-actions
update github actions
2 parents 40e308c + 21e3b54 commit 63b41c0

File tree

9 files changed

+296
-139
lines changed

9 files changed

+296
-139
lines changed

.editorconfig

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# This file is for unifying the coding style for different editors and IDEs
2-
# editorconfig.org
1+
# This file is for unifying the coding style for different editors and IDEs.
2+
# It is based on https://core.trac.wordpress.org/browser/trunk/.editorconfig.
3+
# See https://editorconfig.org for more information about the standard.
34

45
# WordPress Coding Standards
56
# https://make.wordpress.org/core/handbook/coding-standards/
@@ -9,16 +10,16 @@ root = true
910
[*]
1011
charset = utf-8
1112
end_of_line = lf
12-
indent_size = 4
13-
tab_width = 4
14-
indent_style = tab
1513
insert_final_newline = true
1614
trim_trailing_whitespace = true
15+
indent_style = tab
1716

18-
[*.txt]
19-
trim_trailing_whitespace = false
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2
2020

21-
[*.{md,json,yml}]
21+
[*.md]
2222
trim_trailing_whitespace = false
23-
indent_style = space
24-
indent_size = 2
23+
24+
[*.txt]
25+
end_of_line = crlf

.github/workflows/cs-lint.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CS & Lint
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the "push" build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- "**.md"
9+
pull_request:
10+
# Allow manually triggering the workflow.
11+
workflow_dispatch:
12+
13+
jobs:
14+
checkcs:
15+
name: "Basic CS and QA checks"
16+
runs-on: ubuntu-latest
17+
18+
env:
19+
XMLLINT_INDENT: " "
20+
21+
steps:
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: "7.4"
26+
coverage: none
27+
tools: cs2pr
28+
29+
# Show PHP lint violations inline in the file diff.
30+
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
31+
- name: Register PHP lint violations to appear as file diff comments
32+
uses: korelstar/phplint-problem-matcher@v1
33+
34+
# Show XML violations inline in the file diff.
35+
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
36+
- name: Register XML violations to appear as file diff comments
37+
uses: korelstar/xmllint-problem-matcher@v1
38+
39+
- name: Checkout code
40+
uses: actions/checkout@v2
41+
42+
# Validate the composer.json file.
43+
# @link https://getcomposer.org/doc/03-cli.md#validate
44+
- name: Validate Composer installation
45+
run: composer validate --no-check-all
46+
47+
# Install dependencies and handle caching in one go.
48+
# @link https://github.com/marketplace/actions/install-composer-dependencies
49+
- name: Install Composer dependencies
50+
uses: ramsey/composer-install@v1
51+
52+
# Lint PHP.
53+
- name: Lint PHP against parse errors
54+
run: composer lint-ci | cs2pr
55+
56+
# Needed as runs-on: system doesn't have xml-lint by default.
57+
# @link https://github.com/marketplace/actions/xml-lint
58+
- name: Lint phpunit.xml.dist
59+
uses: ChristophWurst/xmllint-action@v1
60+
with:
61+
xml-file: ./phpunit.xml.dist
62+
xml-schema-file: ./vendor/phpunit/phpunit/phpunit.xsd
63+
64+
# Check the code-style consistency of the PHP files.
65+
# - name: Check PHP code style
66+
# continue-on-error: true
67+
# run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
68+
69+
# - name: Show PHPCS results in PR
70+
# run: cs2pr ./phpcs-report.xml

.github/workflows/integrate.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/integrations.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Run PHPUnit
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the "push" build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- "**.md"
9+
pull_request:
10+
# Allow manually triggering the workflow.
11+
workflow_dispatch:
12+
13+
jobs:
14+
test:
15+
name: WP ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
16+
# Ubuntu-20.x includes MySQL 8.0, which causes `caching_sha2_password` issues with PHP < 7.4
17+
# https://www.php.net/manual/en/mysqli.requirements.php
18+
# TODO: change to ubuntu-latest when we no longer support PHP < 7.4
19+
runs-on: ubuntu-18.04
20+
21+
env:
22+
WP_VERSION: ${{ matrix.wordpress }}
23+
24+
strategy:
25+
matrix:
26+
wordpress: ["5.5", "5.6", "5.7"]
27+
php: ["5.6", "7.0", "7.1", "7.2", "7.3", "7.4"]
28+
include:
29+
- php: "8.0"
30+
# Ignore platform requirements, so that PHPUnit 7.5 can be installed on PHP 8.0 (and above).
31+
composer-options: "--ignore-platform-reqs"
32+
extensions: pcov
33+
ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""
34+
coverage: pcov
35+
exclude:
36+
- php: "8.0"
37+
wordpress: "5.5"
38+
fail-fast: false
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v2
43+
44+
- name: Setup PHP ${{ matrix.php }}
45+
uses: shivammathur/setup-php@v2
46+
with:
47+
php-version: ${{ matrix.php }}
48+
extensions: ${{ matrix.extensions }}
49+
ini-values: ${{ matrix.ini-values }}
50+
coverage: ${{ matrix.coverage }}
51+
52+
- name: Setup problem matchers for PHP
53+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
54+
55+
# Setup PCOV since we're using PHPUnit < 8 which has it integrated. Requires PHP 7.1.
56+
# Ignore platform reqs to make it install on PHP 8.
57+
# https://github.com/krakjoe/pcov-clobber
58+
- name: Setup PCOV
59+
if: ${{ matrix.php == 8.0 }}
60+
run: |
61+
composer require pcov/clobber --ignore-platform-reqs
62+
vendor/bin/pcov clobber
63+
64+
- name: Setup Problem Matchers for PHPUnit
65+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
66+
67+
- name: Install Composer dependencies
68+
uses: ramsey/composer-install@v1
69+
with:
70+
composer-options: "${{ matrix.composer-options }}"
71+
72+
- name: Start MySQL Service
73+
run: sudo systemctl start mysql.service
74+
75+
- name: Prepare environment for integration tests
76+
run: composer prepare-ci
77+
78+
- name: Run integration tests (single site)
79+
if: ${{ matrix.php != 8.0 }}
80+
run: composer test
81+
- name: Run integration tests (single site with code coverage)
82+
if: ${{ matrix.php == 8.0 }}
83+
run: composer coverage-ci
84+
- name: Run integration tests (multisite)
85+
run: composer test-ms

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
.svn
2-
wpcom-helper.php
3-
.DS_Store
4-
.vscode/
51
composer.lock
6-
vendor/
2+
/vendor

.gitmodules

Whitespace-only changes.

.phpcs.xml.dist

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ad-code-manager" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
<description>Custom ruleset for ad-code-manager plugin.</description>
4+
5+
<!-- For help in understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
6+
<!-- For help in using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
7+
8+
<!-- What to scan -->
9+
<file>.</file>
10+
<!-- Ignoring Files and Folders:
11+
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders -->
12+
<exclude-pattern>/vendor/</exclude-pattern>
13+
14+
<!-- How to scan -->
15+
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
16+
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
17+
<!-- Show sniff and progress -->
18+
<arg value="sp"/>
19+
<!-- Strip the file paths down to the relevant bit -->
20+
<arg name="basepath" value="./"/>
21+
<!-- Show results with colors -->
22+
<arg name="colors"/>
23+
<!-- Limit to PHP files -->
24+
<arg name="extensions" value="php"/>
25+
<!-- Enables parallel processing when available for faster results. -->
26+
<arg name="parallel" value="8"/>
27+
28+
<!-- Rules: Check PHP version compatibility - see
29+
https://github.com/PHPCompatibility/PHPCompatibilityWP -->
30+
<rule ref="PHPCompatibilityWP"/>
31+
<!-- For help in understanding this testVersion:
32+
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
33+
<config name="testVersion" value="5.6-"/>
34+
35+
<!-- Rules: WordPress Coding Standards - see
36+
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
37+
<!-- WordPress-Extra includes WordPress-Core -->
38+
<rule ref="WordPress-Extra"/>
39+
<rule ref="WordPress-Docs"/>
40+
<!-- For help in understanding these custom sniff properties:
41+
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
42+
<config name="minimum_supported_wp_version" value="5.5"/>
43+
44+
<!-- Rules: WordPress VIP - see
45+
https://github.com/Automattic/VIP-Coding-Standards -->
46+
<rule ref="WordPress-VIP-Go"/>
47+
48+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
49+
<properties>
50+
<property name="prefixes" type="array">
51+
<element value="ad_code_manager"/>
52+
</property>
53+
</properties>
54+
</rule>
55+
56+
<rule ref="WordPress.WP.I18n">
57+
<properties>
58+
<property name="text_domain" type="array">
59+
<element value="ad-code-manager"/>
60+
</property>
61+
</properties>
62+
</rule>
63+
64+
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
65+
<properties>
66+
<property name="blank_line_check" value="true"/>
67+
</properties>
68+
</rule>
69+
70+
</ruleset>

0 commit comments

Comments
 (0)