Skip to content

Commit

Permalink
Merge pull request #7 from tarosky/feature/add-request-uri
Browse files Browse the repository at this point in the history
Feature/add request uri
  • Loading branch information
fumikito authored Sep 27, 2024
2 parents 65c610f + 5f1c41a commit 6edb4b1
Show file tree
Hide file tree
Showing 18 changed files with 1,628 additions and 72 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# 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,wp-config-sample.php}]
end_of_line = crlf
78 changes: 31 additions & 47 deletions .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Deploy Plugin

on:
push:
branches:
- master
tags:
- '*'
pull_request:
Expand All @@ -12,62 +10,48 @@ on:

jobs:
test:
runs-on: ${{ matrix.operating-system }}
name: PHP Unit Test
strategy:
matrix:
operating-system: [ ubuntu-18.04 ] # OS. ubuntu-18.04 is also available.
php: [ '7.0', '7.4' ] # PHP versions to check.
wp: [ 'latest', '5.8' ] # WordPress version to check.
services:
mysql:
image: mysql:5.7
options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10
ports:
- 3306/tcp
env:
MYSQL_ROOT_PASSWORD: root
name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest
steps:
- uses: actions/checkout@master

- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2.2

- name: Validate composer.json and composer.lock
run: composer validate
php: [ '7.4', '8.1' ] # PHP versions to check.
wp: [ 'latest', '5.9' ] # WordPress version to check.
uses: tarosky/workflows/.github/workflows/wp-unit-test.yml@main
with:
php_version: ${{ matrix.php }}
wp_version: ${{ matrix.wp }}

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
lint:
name: PHP Syntax Check
uses: tarosky/workflows/.github/workflows/phpcs.yml@main
with:
version: 7.4

- name: Start MySQL
run: sudo systemctl start mysql

- name: Install WordPress
run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }}

- name: Run Unit Test
run: composer test

- name: Check PHP syntax
run: composer lint
status-check:
name: Confirm All test passed
needs: [ test, lint ]
runs-on: ubuntu-latest
if: always()
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

release:
name: Deploy WordPress.org
needs: [ test ]
needs: [ status-check ]
if: contains(github.ref, 'tags/')
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@main

- name: Setup PHP with composer v2
- name: Setup PHP with composer
uses: shivammathur/setup-php@v2
with:
php-version: 7.0
tools: composer:v2.2
php-version: 7.4
tools: composer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Plugin
run: bash bin/build.sh ${{ github.ref }}
Expand All @@ -78,8 +62,8 @@ jobs:
with:
generate-zip: true
env:
SVN_USERNAME: ${{ secrets.WPORG_FUMIKI_USERNAME }}
SVN_PASSWORD: ${{ secrets.WPORG_FUMIKI_PASSWORD }}
SVN_USERNAME: ${{ secrets.WP_ORG_USERNAME_TAROSKY }}
SVN_PASSWORD: ${{ secrets.WP_ORG_PASSWORD_TAROSKY }}

- name: Create Release
id: create_release
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/wordpress/
/node_modules/
composer.lock
package-lock.json
*.cache
31 changes: 19 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,40 @@
{
"name": "fumikito",
"email": "fumikito@kunoichiwp.com"
},
{
"name": "Tarosky",
"email": "hi@tarosky.co.jp"
}
],
"scripts": {
"test": "phpunit",
"lint": [
"phpcs --config-set installed_paths $(pwd)/vendor/wp-coding-standards/wpcs",
"phpcs --standard=phpcs.ruleset.xml $(find ./ -name '*.php')"
],
"fix": [
"phpcs --config-set installed_paths $(pwd)/vendor/wp-coding-standards/wpcs",
"phpcbf --standard=phpcs.ruleset.xml $(find ./ -name '*.php')"
]
"lint": "phpcs --standard=phpcs.ruleset.xml $(find ./ -name '*.php')",
"fix": "phpcbf --standard=phpcs.ruleset.xml $(find ./ -name '*.php')"

},
"minimum-stability": "stable",
"require": {
"php": "^7|^8"
},
"require-dev": {
"phpunit/phpunit": "^6|^7",
"squizlabs/php_codesniffer": "^3.0",
"wp-coding-standards/wpcs": "^2.0",
"yoast/phpunit-polyfills": "^1.0"
"phpunit/phpunit": "^6|^7|^8|^9",
"wp-coding-standards/wpcs": "^3.0",
"yoast/phpunit-polyfills": "^2.0"
},
"autoload": {
"psr-0": {
"Kunoichi\\Hagakure": "src"
}
},
"autoload-dev": {
"psr-4": {
"Kunoichi\\Hagakure\\Tests\\": "tests\\src"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
5 changes: 5 additions & 0 deletions hagakure.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@
if ( defined( 'WP_CLI' ) && WP_CLI ) {
WP_CLI::add_command( 'hagakure', Kunoichi\Hagakure\Command::class );
}

// Register shortcodes for test environment.
if ( class_exists( 'Kunoichi\Hagakure\Tests\OverflowShortCode' ) ) {
\Kunoichi\Hagakure\Tests\OverflowShortCode::get_instance();
}
Loading

0 comments on commit 6edb4b1

Please sign in to comment.