Select plugin version prototype (Not meant to be merged)#345
Open
Select plugin version prototype (Not meant to be merged)#345
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a prototype workflow to automatically build WP Rocket / BackWPup plugin ZIPs from Git refs at test startup (via APVM), so E2E runs can target specific versions without manually preparing plugin/*.zip files.
Changes:
- Add a
BeforeAllhook that builds plugin artifacts from env-provided git refs and writes them to the expected stable ZIP names in./plugin/. - Add helper logic to build via
apvm-napiand move the resulting artifact to a known path. - Add
apvm-napias a new dev dependency (with lockfile updates).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/support/hooks.ts |
Adds APVM-powered plugin build step in a global BeforeAll hook and a helper to move artifacts into plugin/ ZIP paths used by tests. |
package.json |
Adds apvm-napi dependency to enable building plugins from Git refs during test runs. |
package-lock.json |
Locks apvm-napi to a specific commit (currently via an SSH-resolved URL). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #6 and #315
This code uses https://github.com/wp-media/automation-plugin-version-manager to build plugins from Git refs (tags, branches, and commits). The repo is written in safe Rust but exposed to NodeJS JavaScript/TypeScript through napi.rs leveraging Rust safety from NodeJS with all TypeScript types defined.
This is just a test. If this approach is approved, we can find a better way of writing the code. I just used a
BeforeAllhook to build plugins there using some environment variables, but we can change this if we think of a better approach.To test this, just try the following:
For WP Rocket:
For BackWPup:
Passing existing Git tags to the environment variables.
For private repositories like BackWPup, the method
createWithTokenResolutionwill attempt to resolve any git/github authentication in the environment (SSH keys, Github tokens, etc)Recording: https://jmp.sh/Kr4DZQVl
Type of change
Detailed scenario
What was tested
Plugin building before E2E test.
How to test
Pass any gitref to the environment variables (tags, branches, or commits), the tool will build the plugins from there:
For WP Rocket:
For BackWPup:
Affected Features & Quality Assurance Scope
N/A
Technical description
Documentation
Used APVM in a
BeforeAllhook.New dependencies
Risks
N/A
Mandatory Checklist
Code validation
N/A
Code style
N/A
Unticked items justification
N/A