Skip to content
code

GitHub Action

Setup WP-ENV

1.0.0 Latest version

Setup WP-ENV

code

Setup WP-ENV

Runs wp-env to setup a WordPress site for testing

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Setup WP-ENV

uses: godaddy-wordpress/setup-wp-env@1.0.0

Learn more about this action in godaddy-wordpress/setup-wp-env

Choose a version

Setup @wordpress/env (wp-env)

This Action will setup and start @wordpress/env for quick and efficient continuous integration (CI) testing with WordPress.

Usage

Use this Action in one of your project workflows steps:

jobs:
  wp-env:
    runs-on: ubuntu-latest
    name: Setup WordPress Environment
    steps:
      - name: Start wp-env
        uses: godaddy-wordpress/setup-wp-env@v1

Usage with .wp-env.json

This Action assumes that no .wp-env.json is present in the project that uses this Action in a workflow. If a .wp-env.json file is present in the project, this Action config will override that config; however, if no inputs are provided that already exist in .wp-env.json, those will be used instead (this is how @wordpress/env is designed).

If your project includes a .wp-env.json at root, it is best to explicitly add all necessary inputs in order to override the .wp-env.json which exists in the project.

Options

This action allows configuration of each option found in .wp-env.json, except the port (it is unnecessary, as each runner is encapsulated). These are added as strings, and later converted to JSON and added to .wp-env.override.json.

Examples

- name: Start wp-env
  uses: godaddy-wordpress/setup-wp-env@v1
  with:
    core: 'WordPress/WordPress#5.9'
    phpVersion: '7.4'
    plugins: '["https://downloads.wordpress.org/plugin/coblocks.zip"]'
    themes: '["https://downloads.wordpress.org/theme/go.zip"]'

Please note that when adding plugins and themes for integration testing, it is a best practice to use the official released of those projects (not development versions). This will greatly reduce the time for setup and ensures you are only downloading the necessary code for testing.


Copyright © 2022 GoDaddy Operating Company, LLC  ·  All Rights Reserved  ·  License

GoDaddy Engineering