Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Compat Checker library for versioning and compatibility checks #79

Merged
merged 62 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
0d7442a
Adds IDE files to gitignore.
ibndawood Aug 15, 2023
cd1ea5a
Adds `composer.json` file
ibndawood Aug 15, 2023
4b416e4
Adds barebones `CompatChecker` class
ibndawood Aug 15, 2023
ba57001
Adds WooCommerce codesniffer rules
ibndawood Aug 15, 2023
7e128f7
Updates text domain
ibndawood Aug 15, 2023
bd90f18
Adds autoloader
ibndawood Aug 15, 2023
c652366
Removes Autoloader
ibndawood Aug 24, 2023
7028dfd
Adds `IncompatibleException` class
ibndawood Aug 24, 2023
44e456e
Adds WooCommerce compatibility check.
ibndawood Aug 24, 2023
317dce6
Fixes phpcs violations.
ibndawood Aug 25, 2023
dfaba2f
Adds a method to return the compatibility result.
ibndawood Aug 25, 2023
ab8cc61
Adds WordPress compatibility checks.
ibndawood Aug 25, 2023
1d00528
Fixes the return statement in `run_checks` method.
ibndawood Aug 25, 2023
2298bc1
Refactors the `is_compatible` method.
ibndawood Aug 25, 2023
d5d91d4
Refactors `run_checks` method of `WCCompatibility` class.
ibndawood Aug 25, 2023
d2723bb
Defines WooCommerce file as a constant.
ibndawood Aug 25, 2023
1e8010e
Sets L-2 support policy property.
ibndawood Aug 25, 2023
cffd18a
Refactors `is_wc_installed` method.
ibndawood Aug 25, 2023
aea1273
Adds method to get the current version of WooCommerce.
ibndawood Aug 25, 2023
b37ae0b
Refactors `is_wc_compatible` method.
ibndawood Aug 25, 2023
f23d192
Adds empty check for required WC version.
ibndawood Aug 25, 2023
59621bf
Determines if the WooCommerce version is untested.
ibndawood Aug 25, 2023
eefbb10
Adds `wc_untested` to compat check.
ibndawood Aug 25, 2023
d9a6b1f
Adds a method to get latest WC versions.
ibndawood Aug 25, 2023
52dd39a
Adds a method to get the minimum supported WC version.
ibndawood Aug 25, 2023
bfa7f98
Implements `check_wc_upgrade_recommendation` method.
ibndawood Aug 25, 2023
13b5449
Refactors `wc_fail_load` with plugin data.
ibndawood Aug 25, 2023
4b1a428
Removes hardcoded values in `wc_out_of_date` method.
ibndawood Aug 25, 2023
8cbad41
Adds notice for untested WooCommerce.
ibndawood Aug 25, 2023
de9eea8
Adds notice for WooCommerce upgrade recommendation.
ibndawood Aug 25, 2023
888882c
Adds method to get plugin data from the plugin header.
ibndawood Aug 25, 2023
60f8c51
Adds the main `is_compatible` method.
ibndawood Aug 25, 2023
c4e116d
Adds barebones instructions for compat checker.
ibndawood Aug 25, 2023
1d4f691
Add Compat Checker PHP package (#1)
ibndawood Aug 25, 2023
1d43069
Workflow to publish to compat-checker branch. (#2)
ibndawood Aug 25, 2023
88d89b9
Update github-action-publish-compat-checker.yml
ibndawood Aug 25, 2023
8a2ea75
Update composer.json
ibndawood Aug 25, 2023
e7bc3c8
Update composer.json
ibndawood Aug 25, 2023
36c80a5
Fixes admin notices not thrown in compat checker.
ibndawood Aug 25, 2023
23df5f1
Fixes admin notices not thrown in compat checker. (#3)
ibndawood Aug 25, 2023
2678aff
Fixes WooCommerce required version check.
ibndawood Aug 25, 2023
67fa700
Merge pull request #4 from ibndawood/fix/wc-compat-check
ibndawood Aug 25, 2023
4cfd120
Adds compat checker instructions
ibndawood Aug 25, 2023
4d2c4c6
Refine instructions
ibndawood Aug 25, 2023
4f61875
Adds compat checker instructions (#5)
ibndawood Aug 25, 2023
bdac793
Merges compat checker changes from fork to branch (#78)
ibndawood Aug 28, 2023
1dd730f
Limit recommendation check to admin requests only.
ibndawood Aug 28, 2023
f33d099
Adds caching for `get_file_data` results.
ibndawood Aug 28, 2023
edbd12d
Sets the transient expiration time
ibndawood Aug 28, 2023
f156369
Adds changes to calling the `is_compatible` method.
ibndawood Aug 28, 2023
7d4cc92
Adds version information to namespace.
ibndawood Aug 31, 2023
7f48a09
Corrects second parameter to calling `get_plugin_data`.
ibndawood Aug 31, 2023
4df11a8
Updates compatiblility checks for major versions.
ibndawood Aug 31, 2023
4d36d8e
Fixes indentation issues.
ibndawood Aug 31, 2023
ff9981f
Adds additional steps to the `README.md` file.
ibndawood Aug 31, 2023
f993752
Uses plugin basename for the transient key.
ibndawood Sep 20, 2023
394a108
Adds plugin table anchor to the update core URL fragment.
ibndawood Sep 20, 2023
efbbd19
Replaces updated URL with link to core update page.
ibndawood Sep 20, 2023
115cbc9
Pad .0 if the min WC is not in semvar format.
ibndawood Sep 21, 2023
c8c50e0
Make the warning notice dismissible.
ibndawood Sep 21, 2023
e7bf974
Adds clarification to the notice text.
ibndawood Sep 29, 2023
a8579b7
Adds filter to show admin notice
ibndawood Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/github-action-publish-compat-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish Compat Checker package
on:
push:
branches:
- trunk

jobs:
deploy:
name: Publish Compat Checker package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Deploy
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: compat-checker
FOLDER: packages/php/compat-checker
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ vendor/

# All zip files
*.zip

# IDE files
.vscode/*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The packages here are too experimental or too Grow-specific to be shared Woo-wid
- [`/packages/js/generator-grow`](packages/js/generator-grow/README.md) - Yeoman Generator for extension repository boilerplate.
- [`/packages/js/storybook`](packages/js/storybook/README.md) - Storybook dependencies and basic scripts
- [`/packages/js/tracking-jsdoc`](packages/js/tracking-jsdoc/README.md) - `jsdoc` plugin to document Tracking Events in markdown
- [`/packages/php/compat-checker`](packages/php/compat-checker/README.md) - Library to run compatibility checks for WooCommerce extensions.

## List of plugins

Expand Down
42 changes: 42 additions & 0 deletions packages/php/compat-checker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Compat Checker for WooCommerce Extensions

A simple library to run compatibility checks for WooCommerce extensions.

## Getting Started

1. Include this library in your WooCommerce plugin's `composer.json` like shown below:

```json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/woocommerce/grow"
}
],
"require": {
"woocommerce/grow": "dev-compat-checker"
}
}
```
2. Run `composer update` to include the `woocommerce/grow` repo in the `vendor` folder.

3. In the main plugin file that contains the plugin header, add the compatibility check like the below example:

```php
require __DIR__ . '/vendor/autoload.php';

use Automattic\WooCommerce\Grow\Tools\CompatChecker\v0_0_1\Checker;

add_action( 'plugins_loaded', 'wc_plugin_init' );

function wc_plugin_init() {
define( 'WC_BRANDS_VERSION', '1.6.56' ); // WRCS: DEFINED_VERSION.

if ( ! Checker::instance()->is_compatible( __FILE__, WC_BRANDS_VERSION ) ) {
return;
}

// Continue initializing the plugin.
}
```
21 changes: 21 additions & 0 deletions packages/php/compat-checker/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "woogrow/compat-checker",
"description": "Compatibility checker for Woo Grow extensions",
"version": "0.0.1",
"license": "GPL-3.0",
"minimum-stability": "stable",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Automattic\\WooCommerce\\Grow\\Tools\\CompatChecker\\v0_0_1\\": "src/"
}
},
"require-dev": {
"woocommerce/woocommerce-sniffs": "^0.1.3"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading