woocommerce/tools/code-analyzer
Adrian Moldovan 13ab9007f6
[testing workflows] Add workflow_call trigger in CI workflow - support daily and other types of runs (#47612)
* Add workflow_call event

* Add tests-daily-run.yml

* Remove workflow version

* Update input value

* Remove secrets from caller workflow

* Rename job

* Check context

* Check context

* Check workflow_call inputs

* Override github.event_name with inputs.trigger

* Fix input name

* Add config for daily e2e tests with Gutenberg

* Update env commands for Gutenberg run

* Add disableHpos env variable in ci-utils

* Revert the trigger to push

* Revert the env variable setting in ci-jobs

* Revert the env variable setting in ci-jobs

* Rebuild utils

* Update test env start command

* Define the Gutenberg Playwright project

* Use path relative to workspace root

* Update events for test projects

* Update events for test projects

* Add changelogs

* Remove the e2e tests with Gutenberg tests from daily runs

* Set the schedule and workflow_dispatch triggers

* Add --project default flag to only run the default tests in CI

* Renamed snapshots to match the new Playwright project name
2024-05-22 11:04:44 -07:00
..
src Update @woo.com email addresses to @woocommerce.com (#46387) 2024-04-19 21:11:01 +00:00
.eslintignore CLI tool and GH workflow to highlight PR changes (#32063) 2022-05-17 13:47:17 +12:00
.eslintrc.js Monorepo CLI tooling: Set folder organisation (#37561) 2023-04-12 09:26:21 +12:00
README.md Removed Unnecessary `run` From `pnpm` 2023-12-09 14:36:22 -08:00
index.ts Extract the scanning functionality from code-analyzer, move common code into a separate package (#34600) 2022-09-11 09:55:53 +12:00
jest.config.js Code analyzer: find multiple hooks in single patch, add tests (#39566) 2023-08-09 13:05:00 +12:00
package.json [testing workflows] Add workflow_call trigger in CI workflow - support daily and other types of runs (#47612) 2024-05-22 11:04:44 -07:00
tsconfig.json Revert "Refactoring Task Infrastructure" (#41928) 2023-12-06 11:36:12 -08:00

README.md

Code Analyzer

Description

code-analyzer is a CLI tool designed to analyze change information about plugins in the WooCommerce monorepo.

Commands

Currently there are 3 commands:

  1. lint. Analyzer is used as a linter for PRs to check if hook/template/db changes were introduced. It produces output either directly on CI or via setting output variables in GH actions.

Here is an example analyzer command, run from this directory:

pnpm analyzer lint "release/6.8" "6.8.0" -b release/6.7

In this command we compare the release/6.7 and release/6.8 branches to find differences, and we're looking for changes introduced since 6.8.0 (using the @since tag).

To find out more about the other arguments to the command you can run pnpm analyzer -- --help

  1. major-minor. This simple CLI tool gives you the latest .0 major/minor released version of a plugin's mainfile based on Woo release conventions.

Here is an example major-minor command, run from this directory:

pnpm analyzer major-minor "release/6.8" "plugins/woocommerce/woocommerce.php"

In this command we checkout the branch release/6.8 and check the version of the woocommerce.php mainfile located at the path passed. Note that at the time of writing the main file in this particular branch reports 6.8.1 so the output of this command is 6.8.0.

This command is particularly useful combined with the analyzer, allowing you to determine the last major/minor.0 version of a branch or ref before passing that as the version argument to analyzer.

  1. scan. Scan is like lint but lets you scan for a specific change type. e.g. you can scan just for hook changes if you wish.

Here is an example of the scan command run to look for hook changes:

pnpm analyzer scan hooks "release/6.8" "release/6.7" --since "6.8.0"
In this command we compare the release/6.7 and release/6.8 branches to find hook changes, and we're looking for changes introduced since 6.8.0 (using the @since tag).