2021-01-05 09:27:22 +00:00
|
|
|
name: Automated tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [trunk]
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
Setup:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Setup
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Npm install and build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
coverage: none
|
|
|
|
tools: composer
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Composer install
|
|
|
|
run: |
|
|
|
|
composer install
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
PHPUnitTests:
|
|
|
|
name: PHP Unit Tests
|
|
|
|
needs: Setup
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
coverage: none
|
|
|
|
tools: composer
|
|
|
|
|
|
|
|
- name: Composer install
|
|
|
|
run: |
|
|
|
|
composer install
|
|
|
|
|
|
|
|
- name: blocks.ini setup
|
|
|
|
run: |
|
2021-01-20 19:33:50 +00:00
|
|
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
2021-01-05 09:27:22 +00:00
|
|
|
|
|
|
|
- name: Run PHP Unit tests
|
|
|
|
run: |
|
|
|
|
npm run phpunit
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
JSUnitTests:
|
|
|
|
name: JS Unit Tests
|
|
|
|
needs: Setup
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
2021-01-20 19:33:50 +00:00
|
|
|
|
2021-01-05 09:27:22 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
|
|
|
|
|
|
|
- name: Npm install and build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
|
|
|
|
|
|
|
- name: blocks.ini setup
|
|
|
|
run: |
|
2021-01-20 19:33:50 +00:00
|
|
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
2021-01-05 09:27:22 +00:00
|
|
|
|
|
|
|
- name: Run JavaScript Unit tests
|
|
|
|
run: |
|
|
|
|
npm run test
|
2021-01-20 19:33:50 +00:00
|
|
|
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
JSE2ETestsWP57Gutenberg:
|
|
|
|
name: JavaScipt E2E Tests (WP 5.7 with Gutenberg plugin)
|
2021-01-05 09:27:22 +00:00
|
|
|
needs: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
|
|
|
|
|
|
|
- name: Npm install and build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
|
|
|
|
|
|
|
- name: blocks.ini setup
|
|
|
|
run: |
|
2021-01-20 19:33:50 +00:00
|
|
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
coverage: none
|
|
|
|
tools: composer
|
|
|
|
|
|
|
|
- name: Composer install
|
|
|
|
run: |
|
|
|
|
composer install
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
- name: E2E Tests (WP 5.7 with Gutenberg plugin)
|
2021-01-05 09:27:22 +00:00
|
|
|
env:
|
|
|
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
2021-03-17 15:06:36 +00:00
|
|
|
WP_VERSION: 5.7-branch
|
2021-01-05 09:27:22 +00:00
|
|
|
run: |
|
2021-03-17 15:06:36 +00:00
|
|
|
chmod -R 767 ./ #needed for permissions issues
|
|
|
|
JSON='{"plugins": ["https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip","https://github.com/WP-API/Basic-Auth/archive/master.zip","https://downloads.wordpress.org/plugin/gutenberg.latest-stable.zip", "."] }'
|
|
|
|
echo $JSON > .wp-env.override.json
|
2021-01-05 09:27:22 +00:00
|
|
|
npm run wp-env start
|
|
|
|
npm run wp-env clean all
|
2021-01-20 19:33:50 +00:00
|
|
|
npm run test:e2e
|
2021-01-05 09:27:22 +00:00
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
JSE2ETestsWP57:
|
|
|
|
name: JavaScipt E2E Tests (WP 5.7)
|
2021-01-05 09:27:22 +00:00
|
|
|
needs: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
|
|
|
|
|
|
|
- name: Npm install and build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
|
|
|
|
|
|
|
- name: blocks.ini setup
|
|
|
|
run: |
|
2021-01-20 19:33:50 +00:00
|
|
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
coverage: none
|
|
|
|
tools: composer
|
|
|
|
|
|
|
|
- name: Composer install
|
|
|
|
run: |
|
|
|
|
composer install
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
- name: E2E Tests (WP 5.7)
|
2021-01-05 09:27:22 +00:00
|
|
|
env:
|
|
|
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
2021-03-17 15:06:36 +00:00
|
|
|
WP_VERSION: 5.7-branch
|
2021-01-05 09:27:22 +00:00
|
|
|
run: |
|
|
|
|
npm run wp-env start
|
|
|
|
npm run wp-env clean all
|
|
|
|
npm run test:e2e
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
JSE2ETestsWP56:
|
|
|
|
name: JavaScipt E2E Tests (WP 5.6)
|
2021-01-05 09:27:22 +00:00
|
|
|
needs: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
|
|
|
|
|
|
|
- name: Npm install and build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
|
|
|
|
|
|
|
- name: blocks.ini setup
|
|
|
|
run: |
|
2021-01-20 19:33:50 +00:00
|
|
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
coverage: none
|
|
|
|
tools: composer
|
|
|
|
|
|
|
|
- name: Composer install
|
|
|
|
run: |
|
|
|
|
composer install
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
- name: E2E Tests (WP 5.6)
|
2021-01-05 09:27:22 +00:00
|
|
|
env:
|
|
|
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
2021-03-17 15:06:36 +00:00
|
|
|
WP_VERSION: 5.6-branch
|
2021-01-05 09:27:22 +00:00
|
|
|
run: |
|
|
|
|
JSON='{"core": "WordPress/WordPress#'"$WP_VERSION"'"}'
|
|
|
|
echo $JSON > .wp-env.override.json
|
|
|
|
npm run wp-env start
|
|
|
|
npm run wp-env clean all
|
|
|
|
npm run test:e2e
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
JSE2ETestsWP55:
|
|
|
|
name: JavaScipt E2E Tests (WP 5.5)
|
2021-01-05 09:27:22 +00:00
|
|
|
needs: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
${{ runner.os }}-
|
|
|
|
|
|
|
|
- name: Use Node.js 14.x
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.x
|
|
|
|
|
|
|
|
- name: Npm install and build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
|
|
|
|
|
|
|
- name: blocks.ini setup
|
|
|
|
run: |
|
2021-01-20 19:33:50 +00:00
|
|
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
2021-01-05 09:27:22 +00:00
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
coverage: none
|
|
|
|
tools: composer
|
|
|
|
|
|
|
|
- name: Composer install
|
|
|
|
run: |
|
|
|
|
composer install
|
|
|
|
|
2021-03-17 15:06:36 +00:00
|
|
|
- name: E2E Tests (WP 5.5)
|
2021-01-05 09:27:22 +00:00
|
|
|
env:
|
|
|
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
2021-03-17 15:06:36 +00:00
|
|
|
WP_VERSION: 5.5-branch
|
2021-01-05 09:27:22 +00:00
|
|
|
run: |
|
|
|
|
JSON='{"core": "WordPress/WordPress#'"$WP_VERSION"'"}'
|
|
|
|
echo $JSON > .wp-env.override.json
|
|
|
|
npm run wp-env start
|
|
|
|
npm run wp-env clean all
|
|
|
|
npm run test:e2e
|