Skip to content

Commit

Permalink
Merge pull request #4 from hametuha/wip/1.3.0
Browse files Browse the repository at this point in the history
Update dependencies.
  • Loading branch information
fumikito committed Apr 16, 2024
2 parents b8297f9 + d4fc668 commit 6ffec63
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tests/ export-ignore
bin/ export-ignore
.travis.yml export-ignore
.github/ export-ignore
68 changes: 15 additions & 53 deletions .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,73 +14,35 @@ jobs:
test:
strategy:
matrix:
os: [ ubuntu-latest ] # OS. ubuntu-18.04 is also available.
php: [ '7.4', '8.0', '8.1' ] # PHP versions to check.
wp: [ '5.9', 'latest' ]
tools: [ composer ]
include:
- os: ubuntu-18.04
php: 5.6
tools: composer:v2.2
wp: 5.9
- os: ubuntu-18.04
php: 5.6
tools: composer:v2.2
wp: latest
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
runs-on: ${{ matrix.os }}
name: UnitTest in WordPress ${{ matrix.wp }} and PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@master

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

- name: Validate composer.json and composer.lock
run: composer validate
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

- name: Check PHP syntax
run: composer lint

- name: Start MySQL
run: sudo systemctl start mysql
if: matrix.php != 5.6

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

- name: Unit Test
run: composer test
if: matrix.php != 5.6
phpcs:
uses: tarosky/workflows/.github/workflows/phpcs.yml@main
with:
version: 7.2

release:
name: Create Release Package
needs: [ test ]
needs: [ test, phpcs ]
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@master

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

- name: Clean Package
run: bash bin/cleanup.sh
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# wp-block-creator
# WP Block Creator

Gutenberg Block Creator for themes.

[![Travis CI](https://travis-ci.org/hametuha/wp-block-creator.svg?branch=master)](https://travis-ci.org/hametuha/wp-block-creator)
[![CI/CD for PHP Library](https://github.com/hametuha/wp-block-creator/actions/workflows/wordpress.yml/badge.svg)](https://github.com/hametuha/wp-block-creator/actions/workflows/wordpress.yml)

## Installation

Expand Down Expand Up @@ -54,9 +54,25 @@ Add new block anytime you want.

Every JavaScripts and Stylesheets will be resgistered with the power of [wp-enqueue-manager](https://github.com/hametuha/wp-enqueue-manager). Write proper header like below:

```js
/*!
* Header description here.
*
* deps=jquery,wp-element,wp-api-fetch
*/
```

```css
/**
* Header comment.
*
* deps=bootstrap
*/
```


For more details, see [README.md](https://github.com/hametuha/wp-enqueue-manager) of `wp-enqueue-manager`.

## License

GPL 3.0 or later. Compatible with WordPress.
GPL 3.0 or later. Compatible with WordPress.
18 changes: 10 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,21 @@
],
"scripts": {
"test": "phpunit",
"lint": [
"phpcs --config-set installed_paths $(pwd)/vendor/wp-coding-standards/wpcs",
"phpcs --standard=phpcs.ruleset.xml $(find ./src -name '*.php')"
]

"lint": "phpcs --standard=phpcs.ruleset.xml $(find ./src -name '*.php')"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.6",
"php": ">=7.2",
"hametuha/singleton-pattern": "^1.2",
"hametuha/string-utility": "^1.2",
"hametuha/wp-enqueue-manager": "^1.1"
"hametuha/wp-enqueue-manager": "^1.2"
},
"require-dev": {
"phpunit/phpunit": ">=5.7",
"squizlabs/php_codesniffer": "^3.3",
"wp-coding-standards/wpcs": "^2.0",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"yoast/phpunit-polyfills": "^1.0"
},
"autoload": {
Expand All @@ -40,5 +37,10 @@
"psr-0": {
"Hametuha\\WpBlockCreatorTest": "tests/src"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
4 changes: 4 additions & 0 deletions phpcs.ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound" />
</rule>

<rule ref="PHPCompatibility">
<config name="testVersion" value="7.2-"/>
</rule>

<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*.js</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
Expand Down
7 changes: 6 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@

$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = sys_get_temp_dir() . '/wordpress-tests';
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}

if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
exit( 1 );
}

// Give access to tests_add_filter() function.
Expand Down

0 comments on commit 6ffec63

Please sign in to comment.