From c73cb3ba690b38ad414d6548fa43725017af4d23 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 08:44:15 -0700 Subject: [PATCH 1/7] Try set up CS GitHub Action --- .github/workflows/coding-standards.yml | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/coding-standards.yml diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..ed1b9d0 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,66 @@ +name: Coding Standards + +on: + push: + branches: + - develop + - stable + - release/** + pull_request: + branches: + - develop + +jobs: + lint: + name: Script and Style Coding Standards + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Log debug information + run: | + npm --version + node --version + git --version + - name: Install NodeJS v14 + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Log debug information + run: | + npm --version + node --version + - name: Install npm dependencies + run: npm ci + - name: Run eslint + run: npm run lint:scripts + - name: Run stylelint + run: npm run lint:styles + - name: Run npmPkgJsonLint + run: npm run lint:pkg + phpcs: + name: PHP Coding Standards + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + tools: composer, cs2pr + - name: Log debug information + run: | + php --version + composer --version + - name: Install Composer dependencies + uses: ramsey/composer-install@v1 + with: + composer-options: "--no-progress --no-ansi --no-interaction" + - name: Make Composer packages available globally + run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH + - name: Log PHPCS debug information + run: phpcs -i + - name: Run PHPCS + run: phpcs -q -n --report=checkstyle | cs2pr From 636b5f3eb93b032bb316b5485a5bd5c39ccbf1e1 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 09:26:35 -0700 Subject: [PATCH 2/7] Try `npm install` over `npm ci` to avoid `fsevents` error --- .github/workflows/coding-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index ed1b9d0..6a29dd2 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -31,7 +31,7 @@ jobs: npm --version node --version - name: Install npm dependencies - run: npm ci + run: npm install - name: Run eslint run: npm run lint:scripts - name: Run stylelint From ef685381454fd4356540d5daf0d39093fccb7f75 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 10:20:26 -0700 Subject: [PATCH 3/7] Revert to `npm ci` since `npm install` did not resolve issues Hit issues with package lock file version warning and `fsevents` error. Attempted running with `npm install` instead of `npm ci`, with no effect. In a separate branch rebuilt `package-lock.json` because problem might have related to using a lock file that had been built for a different version of npm. --- .github/workflows/coding-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 6a29dd2..ed1b9d0 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -31,7 +31,7 @@ jobs: npm --version node --version - name: Install npm dependencies - run: npm install + run: npm ci - name: Run eslint run: npm run lint:scripts - name: Run stylelint From 03f82df8749595be37082ce96741905f1a45bd50 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 10:38:59 -0700 Subject: [PATCH 4/7] Test coding standards workflow --- src/blocks/accordion/edit.js | 6 +++--- src/blocks/accordion/editor.css | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/blocks/accordion/edit.js b/src/blocks/accordion/edit.js index 8e47e6d..bb6d41d 100644 --- a/src/blocks/accordion/edit.js +++ b/src/blocks/accordion/edit.js @@ -98,12 +98,12 @@ const AccordionEdit = withDispatch( ( dispatch, ownProps, registry ) => ( { * @param {number} newLevel the heading level setting */ updateHeadingLevel( newLevel ) { - const { clientId, setAttributes } = ownProps; + const { clientId, setAttributes } = ownProps; const { updateBlockAttributes } = dispatch( 'core/block-editor' ); const { getBlockOrder } = registry.select( 'core/block-editor' ); // Update own level setting. - setAttributes( { level: newLevel } ); +setAttributes( { level: newLevel } ); // Update child block to match own level setting. const innerBlockClientIds = getBlockOrder( clientId ); @@ -113,6 +113,6 @@ const AccordionEdit = withDispatch( ( dispatch, ownProps, registry ) => ( { } ); } ); }, -} ) )( AccordionEditContent ); +} ) )( AccordionEditContent ) export default AccordionEdit; diff --git a/src/blocks/accordion/editor.css b/src/blocks/accordion/editor.css index 1ef73e2..f89ae45 100644 --- a/src/blocks/accordion/editor.css +++ b/src/blocks/accordion/editor.css @@ -1,9 +1,8 @@ .wp-block-buttons.controls { - display: flex; +display: flex; justify-content: flex-end; - opacity: 0.5; + opacity: .5; } - /* stylelint-disable selector-class-pattern */ .wp-block-buttons.controls .wp-block-button__link { font-weight: 400; From 19740f3906ddc190ec39efe5aacd29a5f40c3411 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 10:55:00 -0700 Subject: [PATCH 5/7] Test coding standards workflow --- includes/class-setup.php | 3 +-- src/blocks/accordion/edit.js | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/class-setup.php b/includes/class-setup.php index f30b816..a9819a1 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -5,7 +5,6 @@ * @package HRSWP_Blocks * @since 0.1.0 */ - namespace HRSWP\Blocks\Setup; if ( ! defined( 'ABSPATH' ) ) { @@ -50,7 +49,7 @@ class Setup { * @param string $file The __FILE__ value of the main plugin file. * @return Setup An instance of the HRSWP Blocks Setup class. */ - public static function get_instance( $file ) { + public static function get_instance($file) { static $instance; if ( ! isset( $instance ) ) { diff --git a/src/blocks/accordion/edit.js b/src/blocks/accordion/edit.js index bb6d41d..8e47e6d 100644 --- a/src/blocks/accordion/edit.js +++ b/src/blocks/accordion/edit.js @@ -98,12 +98,12 @@ const AccordionEdit = withDispatch( ( dispatch, ownProps, registry ) => ( { * @param {number} newLevel the heading level setting */ updateHeadingLevel( newLevel ) { - const { clientId, setAttributes } = ownProps; + const { clientId, setAttributes } = ownProps; const { updateBlockAttributes } = dispatch( 'core/block-editor' ); const { getBlockOrder } = registry.select( 'core/block-editor' ); // Update own level setting. -setAttributes( { level: newLevel } ); + setAttributes( { level: newLevel } ); // Update child block to match own level setting. const innerBlockClientIds = getBlockOrder( clientId ); @@ -113,6 +113,6 @@ setAttributes( { level: newLevel } ); } ); } ); }, -} ) )( AccordionEditContent ) +} ) )( AccordionEditContent ); export default AccordionEdit; From d9045e91745c69da431b7b24de136661bc6de634 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 10:57:54 -0700 Subject: [PATCH 6/7] Test coding standards workflow --- includes/class-setup.php | 3 ++- src/blocks/accordion/editor.css | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/class-setup.php b/includes/class-setup.php index a9819a1..f30b816 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -5,6 +5,7 @@ * @package HRSWP_Blocks * @since 0.1.0 */ + namespace HRSWP\Blocks\Setup; if ( ! defined( 'ABSPATH' ) ) { @@ -49,7 +50,7 @@ class Setup { * @param string $file The __FILE__ value of the main plugin file. * @return Setup An instance of the HRSWP Blocks Setup class. */ - public static function get_instance($file) { + public static function get_instance( $file ) { static $instance; if ( ! isset( $instance ) ) { diff --git a/src/blocks/accordion/editor.css b/src/blocks/accordion/editor.css index f89ae45..1ef73e2 100644 --- a/src/blocks/accordion/editor.css +++ b/src/blocks/accordion/editor.css @@ -1,8 +1,9 @@ .wp-block-buttons.controls { -display: flex; + display: flex; justify-content: flex-end; - opacity: .5; + opacity: 0.5; } + /* stylelint-disable selector-class-pattern */ .wp-block-buttons.controls .wp-block-button__link { font-weight: 400; From 15840beb48a61acc1e2e1d3f2ba2d34e2a24a2c1 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Mon, 12 Apr 2021 11:03:05 -0700 Subject: [PATCH 7/7] Fix #60 replace Travis CI with GitHub Actions --- .travis.yml | 56 ----------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6b2495b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,56 +0,0 @@ -# Travis CI configuration -# @link https://travis-ci.org/ - -os: linux -dist: xenial - -language: generic - -notifications: - email: - on_success: never - on_failure: change - -cache: - apt: true - directories: - - $HOME/.composer/cache - - vendor - - $HOME/.npm - - $HOME/.nvm/.cache - -branches: - only: - - stable - - 0.x - -before_install: - - npm --version - - node --version - - nvm install --latest-npm - -jobs: - include: - - name: Lint JS - install: npm ci - script: npm run lint:scripts - - - name: Lint CSS - install: npm ci - script: npm run lint:styles - - - name: Lint JSON - install: npm ci - script: npm run lint:pkg - - - name: Lint PHP - install: composer install - script: - - find . \( -name '*.php' \) -not -path "./vendor/*" | xargs -n1 bash -c 'php -lf $0 || exit 1' - - npm run lint:php - - - name: Build - install: - - npm ci - - composer install - - npm run build