-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
316 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: CS | ||
|
||
on: | ||
# Run on all relevant pushes (except to main) and on all relevant pull requests. | ||
push: | ||
paths: | ||
- '**.php' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
- '.phpcs.xml.dist' | ||
- 'phpcs.xml.dist' | ||
- '.github/workflows/cs.yml' | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
- '.phpcs.xml.dist' | ||
- 'phpcs.xml.dist' | ||
- '.github/workflows/cs.yml' | ||
# 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: 'Check code style' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
tools: cs2pr | ||
|
||
# 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@v2 | ||
with: | ||
# Bust the cache at least once a month - output format: YYYY-MM. | ||
custom-cache-suffix: $(date -u "+%Y-%m") | ||
|
||
# Check the codestyle of the files. | ||
# The results of the CS check will be shown inline in the PR via the CS2PR tool. | ||
# @link https://github.com/staabm/annotate-pull-request-from-checkstyle/ | ||
- name: Check PHP code style | ||
id: phpcs | ||
run: composer check-cs -- --no-cache --report-full --report-checkstyle=./phpcs-report.xml | ||
|
||
- name: Show PHPCS results in PR | ||
if: ${{ always() && steps.phpcs.outcome == 'failure' }} | ||
run: cs2pr ./phpcs-report.xml |
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,19 @@ | ||
name: "Deploy to WordPress.org" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
tag: | ||
name: New tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: WordPress Plugin Deploy | ||
uses: 10up/action-wordpress-plugin-deploy@stable | ||
env: | ||
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | ||
SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | ||
SLUG: fewer-tags |
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,69 @@ | ||
name: Lint | ||
|
||
on: | ||
# Run on pushes to select branches and on all pull requests. | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
- 'release/[0-9]+.[0-9]+*' | ||
- 'hotfix/[0-9]+.[0-9]+*' | ||
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: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
# Lint against the highest/lowest supported versions of each PHP major. | ||
# And also do a run against "nightly" (the current dev version of PHP). | ||
php_version: ['7.4', '8.0', '8.1', '8.2'] | ||
|
||
name: "Lint: PHP ${{ matrix.php_version }}" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP for the composer install | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
coverage: none | ||
|
||
# The lint stage doesn't use code style, so no need for WPCS or phpcompatibility. | ||
- name: 'Composer: adjust dependencies - remove PHPCompatibility' | ||
run: composer remove --no-update --dev phpcompatibility/phpcompatibility-wp --no-scripts --no-interaction | ||
- name: 'Composer: adjust dependencies - remove WPCS' | ||
run: composer remove --no-update --dev wp-coding-standards/wpcs --no-scripts --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 | ||
with: | ||
# Bust the cache at least once a month - output format: YYYY-MM-DD. | ||
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") | ||
|
||
- name: Install PHP for the actual test | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php_version }} | ||
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | ||
coverage: none | ||
tools: cs2pr | ||
|
||
- name: Lint against parse errors | ||
run: composer lint -- --checkstyle | cs2pr | ||
|
||
- name: Lint blueprint file | ||
run: composer lint-blueprint |
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,90 @@ | ||
name: Test | ||
|
||
on: | ||
# Run on pushes to select branches and on all pull requests. | ||
push: | ||
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: | ||
integration: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- php_version: '8.1' | ||
wp_version: '6.2' | ||
multisite: false | ||
|
||
- php_version: '8.1' | ||
wp_version: 'latest' | ||
multisite: false | ||
|
||
- php_version: '8.1' | ||
wp_version: 'latest' | ||
multisite: true | ||
|
||
- php_version: '8.2' | ||
wp_version: 'latest' | ||
multisite: true | ||
|
||
name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}" | ||
|
||
# Allow builds to fail on as-of-yet unreleased WordPress versions. | ||
continue-on-error: ${{ matrix.wp_version == 'trunk' }} | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: false | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php_version }} | ||
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | ||
coverage: none | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: "Composer: remove the PHP platform requirement" | ||
run: composer config --unset platform.php | ||
|
||
- name: "Install Composer dependencies" | ||
uses: ramsey/composer-install@v2 | ||
with: | ||
# Force a `composer update` run. | ||
dependency-versions: "highest" | ||
# But make it selective. | ||
composer-options: "yoast/wp-test-utils --with-dependencies" | ||
# Bust the cache at least once a month - output format: YYYY-MM-DD. | ||
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F") | ||
|
||
- name: Install WP | ||
shell: bash | ||
run: tests/bin/install-wp-tests.sh wordpress_tests root '' 127.0.0.1:3306 ${{ matrix.wp_version }} | ||
|
||
- name: Run unit tests - single site | ||
run: composer test | ||
|
||
- name: Run unit tests - multisite | ||
if: ${{ matrix.multisite == true }} | ||
run: composer test | ||
env: | ||
WP_MULTISITE: 1 |
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,16 @@ | ||
name: Playground Comment | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: mshick/add-pr-comment@v2 | ||
with: | ||
message: | | ||
**Test on Playground** | ||
[Test this pull request on the Playground](https://playground.wordpress.net/#{"landingPage":"/wp-admin/edit-tags.php?taxonomy=post_tag","features":{"networking":true},"steps":[{"step":"defineWpConfigConsts","consts":{"IS_PLAYGROUND_PREVIEW":true}},{"step":"login","username":"admin","password":"password"},{"step":"installPlugin","pluginZipFile":{"resource":"url","url":"https://bypass-cors.altha.workers.dev/${{ github.server_url }}/${{ github.repository }}/archive/${{ github.sha }}.zip"},"options":{"activate":true}}]}) |
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,34 @@ | ||
name: Security | ||
|
||
on: | ||
# Run on all pushes and on all pull requests. | ||
push: | ||
pull_request: | ||
# Also run this workflow every Monday at 6:00. | ||
schedule: | ||
- cron: '0 6 * * 1' | ||
# 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: | ||
security: | ||
name: 'Security check' | ||
runs-on: ubuntu-latest | ||
|
||
# Don't run the cronjob in this workflow on forks. | ||
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'Emilia-Capital') | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# This action checks the `composer.lock` file against known security vulnerabilities in the dependencies. | ||
# https://github.com/marketplace/actions/the-php-security-checker | ||
- name: Run Security Check | ||
uses: symfonycorp/security-checker-action@v4 |
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,20 @@ | ||
name: "WordPress version checker" | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
permissions: | ||
issues: write | ||
|
||
jobs: | ||
wordpress-version-checker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: WordPress version checker | ||
uses: skaut/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |