From d4fc668dcaed66a15e7b00c42011ba91f8011611 Mon Sep 17 00:00:00 2001 From: fumikito Date: Tue, 16 Apr 2024 14:07:04 +0900 Subject: [PATCH] Update dependencies. --- .gitattributes | 1 + .github/workflows/wordpress.yml | 68 ++++++++------------------------- README.md | 22 +++++++++-- composer.json | 18 +++++---- phpcs.ruleset.xml | 4 ++ tests/bootstrap.php | 7 +++- 6 files changed, 55 insertions(+), 65 deletions(-) diff --git a/.gitattributes b/.gitattributes index bc1783c..eedbe13 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ tests/ export-ignore bin/ export-ignore .travis.yml export-ignore +.github/ export-ignore diff --git a/.github/workflows/wordpress.yml b/.github/workflows/wordpress.yml index 2419d54..7c0df59 100644 --- a/.github/workflows/wordpress.yml +++ b/.github/workflows/wordpress.yml @@ -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 diff --git a/README.md b/README.md index 08e99f1..87cffea 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. \ No newline at end of file +GPL 3.0 or later. Compatible with WordPress. diff --git a/composer.json b/composer.json index b7fd08a..c34b1e9 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -40,5 +37,10 @@ "psr-0": { "Hametuha\\WpBlockCreatorTest": "tests/src" } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/phpcs.ruleset.xml b/phpcs.ruleset.xml index 2a3841f..f6925a3 100644 --- a/phpcs.ruleset.xml +++ b/phpcs.ruleset.xml @@ -26,6 +26,10 @@ + + + + */node_modules/* *.js */vendor/* diff --git a/tests/bootstrap.php b/tests/bootstrap.php index d9c796a..5664cf2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -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.