From 976852877b44d84e235744d4eabcf70dc8043381 Mon Sep 17 00:00:00 2001 From: AnthonyLedesma Date: Fri, 25 Aug 2023 09:00:02 -0700 Subject: [PATCH 1/5] set min version of WP to 6.1 & add grunt helper --- class-coblocks.php | 2 +- gruntfile.js | 8 ++++++++ package.json | 5 +++-- readme.txt | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/class-coblocks.php b/class-coblocks.php index 50e1e9443a8..28cd2f50ffc 100644 --- a/class-coblocks.php +++ b/class-coblocks.php @@ -8,7 +8,7 @@ * Text Domain: coblocks * Domain Path: /languages * Tested up to: 6.3 - * Requires at least: 6.2 + * Requires at least: 6.1 * * CoBlocks is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/gruntfile.js b/gruntfile.js index 43ced3bf459..8eb262523a5 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -80,6 +80,10 @@ module.exports = function( grunt ) { from: /Tested up to:(\s*?)[a-zA-Z0-9\.\-\+]+$/m, to: 'Tested up to:$1' + pkg.tested_up_to, }, + { + from: /Requires at least:(\s*?)[a-zA-Z0-9\.\-\+]+$/m, + to: 'Requires at least:$1' + pkg.requires_at_least, + }, ], }, readme: { @@ -94,6 +98,10 @@ module.exports = function( grunt ) { from: /Tested up to:(\s*?)[a-zA-Z0-9\.\-\+]+$/m, to: 'Tested up to:$1' + pkg.tested_up_to, }, + { + from: /Requires at least:(\s*?)[a-zA-Z0-9\.\-\+]+$/m, + to: 'Requires at least:$1' + pkg.requires_at_least, + }, ], }, tests: { diff --git a/package.json b/package.json index 47026b7d2f7..75733e023db 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "CoBlocks is a suite of professional page building blocks for the WordPress Gutenberg block editor.", "version": "3.1.2", "tested_up_to": "6.3", + "requires_at_least": "6.1", "author": "GoDaddy", "license": "GPL-2.0", "repository": "godaddy-wordpress/coblocks", @@ -31,8 +32,8 @@ "json2po": "cd languages && find . -name '*.json' ! -name 'coblocks*.json' -execdir /bin/bash -c 'FROM=\"$0\" && TO=\"coblocks-`basename $0 .json`.po\" && echo \"$FROM > $TO\" && ../vendor/bin/json2po coblocks.json $FROM $TO && msgmerge --previous $TO coblocks.pot > $TO-msgmerge && mv $TO-msgmerge $TO && if [[ \"$OSTYPE\" == \"darwin\"* ]]; then sed -i \"\" -e \"/^#, fuzzy$/d\" $TO; else sed -i -e \"/^#, fuzzy$/d\" $TO; fi;' '{}' \\;", "lint:css": "wp-scripts lint-style", "lint:js": "wp-scripts lint-js", - "lint:php": "wp-env run tests-cli --env-cwd=/var/www/html 'composer run lint -d /var/www/html/wp-content/plugins/coblocks/'; #we use phpunit container because composer container only use php 8;", - "lint:php:fix": "wp-env run tests-cli --env-cwd=/var/www/html 'composer run lint:fix -d /var/www/html/wp-content/plugins/coblocks/'; #we use phpunit container because composer container only use php 8;", + "lint:php": "wp-env run tests-cli --env-cwd=/var/www/html composer run lint -d /var/www/html/wp-content/plugins/coblocks/; #we use phpunit container because composer container only use php 8;", + "lint:php:fix": "wp-env run tests-cli --env-cwd=/var/www/html composer run lint:fix -d /var/www/html/wp-content/plugins/coblocks/; #we use phpunit container because composer container only use php 8;", "makepot": "./vendor/bin/wp i18n make-pot . --skip-audit --exclude=\".dev,.github,.wordpress-org,build,docs,dist,node_modules,vendor,wordpress\" --headers='{\"Last-Translator\":\"plugins@godaddy.com\",\"Report-Msgid-Bugs-To\":\"https://github.com/godaddy-wordpress/coblocks/issues\"}' --file-comment=\"Copyright (c) $(date +'%Y') GoDaddy Operating Company, LLC. All Rights Reserved.\" languages/coblocks.pot && yarn run pot2json", "po2jed": "cd languages && find . -name '*.po' -execdir /bin/bash -c 'FROM=\"$0\" && TO=\"`basename $0 .po`-coblocks-editor.json\" && echo \"$FROM > $TO\" && po2json $FROM $TO -f jed' '{}' \\;", "po2mo": "cd languages && find . -name '*.po' -execdir /bin/bash -c 'FROM=\"$0\" && TO=\"`basename $0 .po`.mo\" && echo \"$FROM > $TO\" && msgfmt $FROM -o $TO' '{}' \\;", diff --git a/readme.txt b/readme.txt index 66edcad6248..d9f97d0108f 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Author URI: https://www.godaddy.com Contributors: godaddy, richtabor, eherman24, jonathanbardo, jrtashjian, paranoia1906, fjarrett, olivierlafleur, jasonlemay, snovosel Tags: page builder, Gutenberg blocks, WordPress blocks, gutenberg, blocks -Requires at least: 6.2 +Requires at least: 6.1 Tested up to: 6.3 Requires PHP: 7.4 Stable tag: 3.1.2 From 741a982256b95cc4d6c18034d017c7641c7f04f7 Mon Sep 17 00:00:00 2001 From: AnthonyLedesma Date: Fri, 25 Aug 2023 10:33:41 -0700 Subject: [PATCH 2/5] comment out test code to satisfy lint:js --- src/blocks/events/test/events.cypress.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/blocks/events/test/events.cypress.js b/src/blocks/events/test/events.cypress.js index 90eb0f32c66..75d9b03ba8a 100644 --- a/src/blocks/events/test/events.cypress.js +++ b/src/blocks/events/test/events.cypress.js @@ -5,13 +5,13 @@ import * as helpers from '../../../../.dev/tests/cypress/helpers'; describe( 'Block: Events', function() { // Setup events data. - const eventsData = { - color: { - textColor: '#ffffff', - textColorRGB: 'rgb(255, 255, 255)', - }, - ical: 'https://calendar.google.com/calendar/ical/8hohgb8qv19fgvjbbkcehe0ce0%40group.calendar.google.com/public/basic.ics', - }; + // const eventsData = { + // color: { + // textColor: '#ffffff', + // textColorRGB: 'rgb(255, 255, 255)', + // }, + // ical: 'https://calendar.google.com/calendar/ical/8hohgb8qv19fgvjbbkcehe0ce0%40group.calendar.google.com/public/basic.ics', + // }; beforeEach( () => { helpers.addBlockToPost( 'coblocks/events', true ); From b6a06cdd4daf5e5d99829781e05f777670bd6b6d Mon Sep 17 00:00:00 2001 From: AnthonyLedesma Date: Fri, 25 Aug 2023 11:12:57 -0700 Subject: [PATCH 3/5] add test for 6.1 to run e2e --- .github/workflows/test-e2e.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 800d86b43fb..535e49e0165 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -6,6 +6,15 @@ on: - master jobs: + chrome_e2e_major_before_previous_major: + name: Chrome with previous major WP version. + uses: ./.github/workflows/test-e2e-cypress.yml + with: + wpVersion: "WordPress/WordPress#6.1" + concurrency: + group: chrome-defaults-major-before-previous-major + cancel-in-progress: true + chrome_e2e_previous_major: name: Chrome with previous major WP version. uses: ./.github/workflows/test-e2e-cypress.yml From 322ca457483b8af9cbbe191033ae82a863856227 Mon Sep 17 00:00:00 2001 From: AnthonyLedesma Date: Fri, 25 Aug 2023 11:23:33 -0700 Subject: [PATCH 4/5] names must be different for the workflow --- .github/workflows/test-e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 535e49e0165..7a7e5b886ae 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -7,7 +7,7 @@ on: jobs: chrome_e2e_major_before_previous_major: - name: Chrome with previous major WP version. + name: Chrome with major before previous major WP version uses: ./.github/workflows/test-e2e-cypress.yml with: wpVersion: "WordPress/WordPress#6.1" @@ -16,7 +16,7 @@ jobs: cancel-in-progress: true chrome_e2e_previous_major: - name: Chrome with previous major WP version. + name: Chrome with previous major WP version uses: ./.github/workflows/test-e2e-cypress.yml with: wpVersion: "WordPress/WordPress#6.2" From 1ab9f26608b752204a53e59eb6968a8c4c4aef33 Mon Sep 17 00:00:00 2001 From: AnthonyLedesma Date: Fri, 25 Aug 2023 13:21:29 -0700 Subject: [PATCH 5/5] try adding php unit tests for other WP versions --- .github/workflows/test-e2e.yml | 17 +++++++++-------- .github/workflows/test-php-unit.yml | 5 +++++ .github/workflows/test-php.yml | 28 +++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 7a7e5b886ae..1beadaf4f4b 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -6,14 +6,15 @@ on: - master jobs: - chrome_e2e_major_before_previous_major: - name: Chrome with major before previous major WP version - uses: ./.github/workflows/test-e2e-cypress.yml - with: - wpVersion: "WordPress/WordPress#6.1" - concurrency: - group: chrome-defaults-major-before-previous-major - cancel-in-progress: true + # Requires re-working our helpers to be backward compat. + # chrome_e2e_major_before_previous_major: + # name: Chrome with major before previous major WP version + # uses: ./.github/workflows/test-e2e-cypress.yml + # with: + # wpVersion: "WordPress/WordPress#6.1" + # concurrency: + # group: chrome-defaults-major-before-previous-major + # cancel-in-progress: true chrome_e2e_previous_major: name: Chrome with previous major WP version diff --git a/.github/workflows/test-php-unit.yml b/.github/workflows/test-php-unit.yml index 8a6fe4d679e..4a4cbb1a2c5 100644 --- a/.github/workflows/test-php-unit.yml +++ b/.github/workflows/test-php-unit.yml @@ -7,6 +7,10 @@ on: required: false type: string default: '8.1' + wpVersion: + required: false + type: string + default: '' jobs: php_unit: @@ -34,6 +38,7 @@ jobs: - name: Setup wp-env uses: godaddy-wordpress/setup-wp-env@v1 with: + core: ${{ inputs.wpVersion }} phpVersion: ${{ inputs.phpVersion }} plugins: '[".","https://downloads.wordpress.org/plugin/woocommerce.zip"]' themes: '["https://downloads.wordpress.org/theme/go.zip"]' diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index 278bc43379f..5fc8a0312b2 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -7,25 +7,43 @@ on: jobs: php_unit_74: - name: PHP 7.4 + name: PHP 7.4 Current Major uses: ./.github/workflows/test-php-unit.yml with: phpVersion: '7.4' + wpVersion: 'WordPress/WordPress#6.3' php_unit_80: - name: PHP 8.0 + name: PHP 8.0 Current Major uses: ./.github/workflows/test-php-unit.yml with: phpVersion: '8.0' + wpVersion: 'WordPress/WordPress#6.3' php_unit_81: - name: PHP 8.1 + name: PHP 8.1 Current Major uses: ./.github/workflows/test-php-unit.yml with: phpVersion: '8.1' - + wpVersion: 'WordPress/WordPress#6.3' + php_unit_82: - name: PHP 8.2 + name: PHP 8.2 Current Major + uses: ./.github/workflows/test-php-unit.yml + with: + phpVersion: '8.2' + wpVersion: 'WordPress/WordPress#6.3' + + php_unit_82_wp_last_major: + name: PHP 8.2 Last Major + uses: ./.github/workflows/test-php-unit.yml + with: + phpVersion: '8.2' + wpVersion: 'WordPress/WordPress#6.2' + + php_unit_82_wp_major_before_last_major: + name: PHP 8.2 Major Before Last Major uses: ./.github/workflows/test-php-unit.yml with: phpVersion: '8.2' + wpVersion: 'WordPress/WordPress#6.1'