Merge pull request #31082 from woocommerce/add/wsl-instructions

Added WSL instructions
This commit is contained in:
Ron Rennick 2021-11-08 13:34:27 -04:00 committed by GitHub
commit 64b562e498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 0 deletions

View File

@ -97,6 +97,8 @@ Puppeteer will still automatically download Chromium when needed.
## Running tests
If you are using Windows, we recommend using [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/) for End-to-end testing. Follow the [WSL Setup Instructions](./WSL_SETUP_INSTRUCTIONS.md) first before proceeding with the steps below.
### Prep work for running tests
Run the following in a terminal/command line window

View File

@ -0,0 +1,58 @@
# Setup Instructions for Windows Subsystem for Linux (WSL)
You can set up a local development environment on Windows with [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/). The following instructions are for Ubuntu 20.04.
## Pre-requisites
You should have the following already set up on your Windows computer:
- **Docker Desktop for Windows** - https://docs.docker.com/docker-for-windows/install/
- **WSL 2** - https://docs.microsoft.com/en-us/windows/wsl/install
- **Ubuntu 20.04 set as default Linux distribution** - https://docs.microsoft.com/en-us/windows/wsl/wsl-config#list-installed-distributions
## Setup Steps
Update and upgrade packages.
```bash
sudo apt update -y && sudo apt upgrade -y
```
In order for Composer commands to work later on, you have to install the following:
- PHP
- Composer
- `php-xml`
- `php-mbstring`
```bash
sudo apt install php-cli unzip -y
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
HASH=`curl -sS https://composer.github.io/installer.sig`
echo $HASH
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer --version --no-interaction # Verify that Composer installation was successful
sudo apt install php-xml -y
sudo apt install php-mbstring -y
```
For Puppeteer to run in headless mode you'll need to install additional packages:
```bash
sudo apt install -y ca-certificates fonts-liberation gconf-service libappindicator1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
```
Add your username to the `docker` group to avoid having to type `sudo` when you run Docker commands.
```bash
sudo usermod -aG docker ${YOUR_USERNAME}
su - ${YOUR_USERNAME}
```
At this point, you're now ready to proceed with the steps in [Prep work for running tests](./README.md#prep-work-for-running-tests).