Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#8317 closed enhancement (fixed)

Use @wordpress/env to ease BuddyPress contributors life

Reported by: imath's profile imath Owned by: netweb's profile netweb
Milestone: 7.0.0 Priority: high
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch dev-feedback needs-codex
Cc:

Description (last modified by imath)

I believe we should make it easier for new contributors to quickly get started.

Setting up a development environment can be a pain and is probably a major brake to contributions. Thanks to ​@wordpress/env, we can now improve this. I've just tested it: it's really awesome and we should include it asap into our repository.

What's needed ?

There's some great documentation ​there. For our specific need we can use a .wp-env.override.json to customize the .wp-env.json I've added to the patch.

For the regular .wp-env.json, I wrote it so that WordPress is latest stable, and the master branch of the BP REST API is automatically included and activated.

To test:

  1. Install Docker, launch it,
  2. Apply the patch,
  3. Update node modules running npm install
  4. run this npm run wp-env start from the command line being at the root of the BuddyPress repository
  5. Go to http://localhost:8888
  6. Tada πŸŽ‰

When, you need to stop, simply do npm run wp-env stop

Attachments (3)

8317.patch​ (2.1 KB) - added by imath 4 years ago.
8317.2.patch​ (1.7 KB) - added by imath 4 years ago.
8317.3.patch​ (9.8 KB) - added by imath 4 years ago.

Download all attachments as: .zip

Change History (13)

@imath
4 years ago

#1 @imath
4 years ago

  • Description modified (diff)

#2 @oztaser
4 years ago

Hi @imath ,

I liked the idea and I've tested your patch. It looks good.

@wordpress/env supports WP-CLI as far as I can see on the GitHub repository[1]. What do you think about including BP-CLI package to the environment like BP REST.

P.S: Default login credentials are username: admin password: password, it might be helpful.

[1] ​https://github.com/WordPress/gutenberg/tree/master/packages/env

#3 @imath
4 years ago

Thanks for your feedback @oztaser. You’re completely right, I’ll add BP CLIπŸ‘Œ

This ticket was mentioned in ​Slack in #buddypress by imath. ​View the logs.


4 years ago

#5 @mercime
4 years ago

Per meeting last Wednesday, June 17, tested patch on the following:

βœ… Windows 10 Pro and better - OK
βœ… Windows 10 Home on Insider Build with WSL 2 - OK
βœ… Ubuntu server - OK

Concerned about prospective contributors with Windows 10 Home (stable version) because Docker can't be installed on their machines.

#6 @imath
4 years ago

  • Keywords needs-codex added

Thanks a lot for your testing @mercime. It's very useful 😍. I understand your concern about users running Windows 10 home edition. But I believe it shouldn't block us to include this testing environment for all the other users.

I think we should write a codex page with the different ways you can set your development environment to start contributing to BuddyPress. It could look like this ​documentation page or include links to this documentation page.

@imath
4 years ago

#7 @imath
4 years ago

8317.2.patch is refreshing the previous patch to latest trunk

@imath
4 years ago

#8 @imath
4 years ago

I thought being able to run PHPUnit tests was missing, so I've added to the ​8317.3.patch!

Once the patch is applied (and you installed Docker...), here's how to test it:

  1. run npm install
  2. run composer update wp-phpunit/wp-phpunit
  3. Launch Docker
  4. run npm run wp-env start to build the environment (WordPress Trunk, BuddyPress Trunk, BP REST master)
  5. if you want to play with the website, you can go to http://localhost:8888
  6. Otherwise (or if you finished playing) run npm run wp-env stop
  7. To test BuddyPress on non-multisite, run npm run test-php
  8. To test BuddyPress on multisite, run npm run test-php-multisite

I love it! Let's have it in to ease contributions!

This ticket was mentioned in ​Slack in #buddypress by imath. ​View the logs.


4 years ago

#10 @imath
4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 12712:

Build/Test Tools: include @wordpress/env into BuddyPress

wp-env requires Docker and the latest Node.js LTS version. It gives us a set of new npm commands to easily generate a local WordPress environment to unit test, develop and contribute to BuddyPress code.

To enjoy wp-env, make sure you have SVN or Git, composer, Node.js and Docker installed on your computer. Get the development version of BuddyPress using our SVN repository or its GitHub read-only mirror from this URL: ​https://buddypress.org/download/#trunk, and use the command to fetch the code locally into a buddypress folder. From your terminal software, move to this folder to install the needed libraries using the following commands.
npm install
composer install

Once done, you can set up your local development environment using this single command:
npm run wp-env start

You can now access to your local environment and finish the WordPress setup (permalinks etc..) from this URL:
http://localhost:8888/wp-admin/

The administration credentials are:

  • Username: admin,
  • Password: password

To stop the environment, you can use this command:
npm run wp-env stop

To run PHP unit tests, you can use this command:
npm run test-php

To run PHP unit tests on multisite, you can use this command:
npm run test-php-multisite

You can customize your local development setup using a file named .wp-env.override.json . Our default setup is using the WordPress development version and includes the BP REST plugin. For more details about wp-env, have a look at this documentation page: ​https://developer.wordpress.org/block-editor/packages/packages-env/

Props oztaser, mercime, vapvarun

Fixes #8317

Note: See TracTickets for help on using tickets.