Merge branch 'add/experiment-subscriptions-admin-menu-1' into add/experiment-subscriptions-admin-menu-eligibility
# Conflicts: # plugins/woocommerce/src/Internal/Admin/WcPaySubscriptionsPage.php
This commit is contained in:
commit
68142596bb
|
@ -8,8 +8,12 @@ coverage:
|
||||||
range: "50...100"
|
range: "50...100"
|
||||||
|
|
||||||
status:
|
status:
|
||||||
project: off
|
project:
|
||||||
patch: off
|
default:
|
||||||
|
informational: true
|
||||||
|
patch:
|
||||||
|
default:
|
||||||
|
informational: true
|
||||||
changes: off
|
changes: off
|
||||||
|
|
||||||
parsers:
|
parsers:
|
||||||
|
|
|
@ -9,19 +9,38 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build release zip file
|
name: Build release zip file
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code.
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get cached composer and pnpm directories
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.ref || github.ref }}
|
path: |
|
||||||
- name: Build the zip file
|
~/.pnpm-store
|
||||||
id: build
|
plugins/woocommerce/packages
|
||||||
uses: woocommerce/action-build@trunk
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install PNPM
|
||||||
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Build zip
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
|
run: bash bin/build-zip.sh
|
||||||
|
|
||||||
- name: Unzip the file (prevents double zip problem)
|
- name: Unzip the file (prevents double zip problem)
|
||||||
run: unzip ${{ steps.build.outputs.zip_path }} -d zipfile
|
run: unzip plugins/woocommerce/woocommerce.zip -d zipfile
|
||||||
|
|
||||||
- name: Upload the zip file as an artifact
|
- name: Upload the zip file as an artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -5,27 +5,47 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build release asset
|
name: Build release asset
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code.
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Build
|
|
||||||
id: build
|
- name: Get cached composer and pnpm directories
|
||||||
uses: woocommerce/action-build@trunk
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install PNPM
|
||||||
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Build zip
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
|
run: bash bin/build-zip.sh
|
||||||
|
|
||||||
- name: Upload release asset
|
- name: Upload release asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ github.event.release.upload_url }}
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
asset_path: ${{ steps.build.outputs.zip_path }}
|
asset_path: plugins/woocommerce/woocommerce.zip
|
||||||
asset_name: woocommerce.zip
|
asset_name: woocommerce.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
update-code-reference:
|
update-code-reference:
|
||||||
if: github.event.release.prerelease == false && github.event.release.draft == false && github.repository_owner == 'woocommerce'
|
if: github.event.release.prerelease == false && github.event.release.draft == false && github.repository_owner == 'woocommerce'
|
||||||
name: Update Code Reference
|
name: Update Code Reference
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Invoke Code Reference build and deploy workflow
|
- name: Invoke Code Reference build and deploy workflow
|
||||||
uses: aurelien-baudet/workflow-dispatch@v2
|
uses: aurelien-baudet/workflow-dispatch@v2
|
||||||
|
@ -38,7 +58,7 @@ jobs:
|
||||||
run-release-smoke-tests:
|
run-release-smoke-tests:
|
||||||
name: Execute Smoke test release
|
name: Execute Smoke test release
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Invoke release smoke testing workflow
|
- name: Invoke release smoke testing workflow
|
||||||
uses: aurelien-baudet/workflow-dispatch@v2
|
uses: aurelien-baudet/workflow-dispatch@v2
|
||||||
|
|
|
@ -7,12 +7,14 @@ on:
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: plugins/woocommerce
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -36,7 +38,7 @@ jobs:
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
|
@ -51,29 +53,33 @@ jobs:
|
||||||
php --version
|
php --version
|
||||||
composer --version
|
composer --version
|
||||||
|
|
||||||
- name: Get cached composer directories
|
- name: Get cached composer and pnpm directories
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
./packages
|
~/.pnpm-store
|
||||||
./vendor
|
plugins/woocommerce/packages
|
||||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Install PNPM
|
||||||
run: |
|
run: npm install -g pnpm@^6.24.2
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Setup and install composer
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
run: pnpm nx composer-install woocommerce
|
run: pnpm nx composer-install woocommerce
|
||||||
|
|
||||||
- name: Build Admin feature config
|
- name: Build Admin feature config
|
||||||
working-directory: ./
|
|
||||||
run: pnpm nx build:feature-config woocommerce
|
run: pnpm nx build:feature-config woocommerce
|
||||||
|
|
||||||
- name: Add PHP8 Compatibility.
|
- name: Add PHP8 Compatibility.
|
||||||
run: |
|
run: |
|
||||||
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
||||||
|
cd plugins/woocommerce
|
||||||
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
||||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||||
composer bin phpunit config --unset platform
|
composer bin phpunit config --unset platform
|
||||||
|
@ -84,6 +90,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Init DB and WP
|
- name: Init DB and WP
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|
|
@ -6,42 +6,67 @@ jobs:
|
||||||
build:
|
build:
|
||||||
if: github.repository == 'woocommerce/woocommerce'
|
if: github.repository == 'woocommerce/woocommerce'
|
||||||
name: Build WooCommerce zip
|
name: Build WooCommerce zip
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code.
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Build
|
|
||||||
id: build
|
- name: Cache modules
|
||||||
uses: woocommerce/action-build@trunk
|
uses: actions/cache@v3
|
||||||
env:
|
id: cache-deps
|
||||||
BUILD_ENV: mirrors
|
with:
|
||||||
- name: Upload PR zip
|
path: |
|
||||||
uses: actions/upload-artifact@v2
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install PNPM
|
||||||
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Build zip
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
|
run: bash bin/build-zip.sh
|
||||||
|
|
||||||
|
- name: Upload the zip file as an artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
name: woocommerce
|
name: woocommerce
|
||||||
path: ${{ steps.build.outputs.zip_path }}
|
path: plugins/woocommerce/woocommerce.zip
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
mirror:
|
mirror:
|
||||||
if: github.repository == 'woocommerce/woocommerce'
|
if: github.repository == 'woocommerce/woocommerce'
|
||||||
name: Push to Mirror
|
name: Push to Mirror
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build]
|
needs: [build]
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Create directories
|
- name: Create directories
|
||||||
run: |
|
run: |
|
||||||
mkdir -p tmp/woocommerce-build
|
mkdir -p tmp/woocommerce-build
|
||||||
mkdir -p monorepo
|
mkdir -p monorepo
|
||||||
|
|
||||||
- name: Checkout monorepo
|
- name: Checkout monorepo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: monorepo
|
path: monorepo
|
||||||
|
|
||||||
|
- name: Copy Composer over to production
|
||||||
|
run: cp monorepo/plugins/woocommerce/composer.json tmp/woocommerce-build
|
||||||
|
|
||||||
- name: Download WooCommerce ZIP
|
- name: Download WooCommerce ZIP
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: woocommerce
|
name: woocommerce
|
||||||
path: tmp/woocommerce-build
|
path: tmp/woocommerce-build
|
||||||
|
|
||||||
- name: Extract and replace WooCommerce zip.
|
- name: Extract and replace WooCommerce zip.
|
||||||
working-directory: tmp/woocommerce-build
|
working-directory: tmp/woocommerce-build
|
||||||
run: |
|
run: |
|
||||||
|
@ -49,11 +74,13 @@ jobs:
|
||||||
unzip woocommerce.zip -d woocommerce/woocommerce-production
|
unzip woocommerce.zip -d woocommerce/woocommerce-production
|
||||||
mv woocommerce/woocommerce-production/woocommerce/* woocommerce/woocommerce-production
|
mv woocommerce/woocommerce-production/woocommerce/* woocommerce/woocommerce-production
|
||||||
rm -rf woocommerce/woocommerce-production/woocommerce
|
rm -rf woocommerce/woocommerce-production/woocommerce
|
||||||
|
|
||||||
- name: Set up mirror
|
- name: Set up mirror
|
||||||
working-directory: tmp/woocommerce-build
|
working-directory: tmp/woocommerce-build
|
||||||
run: |
|
run: |
|
||||||
touch mirrors.txt
|
touch mirrors.txt
|
||||||
echo "woocommerce/woocommerce-production" >> mirrors.txt
|
echo "woocommerce/woocommerce-production" >> mirrors.txt
|
||||||
|
|
||||||
- name: Push to mirror
|
- name: Push to mirror
|
||||||
uses: Automattic/action-push-to-mirrors@v1
|
uses: Automattic/action-push-to-mirrors@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -10,15 +10,35 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
build: [trunk]
|
build: [trunk]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ matrix.build }}
|
ref: ${{ matrix.build }}
|
||||||
- name: Build
|
|
||||||
id: build
|
- name: Get cached composer and pnpm directories
|
||||||
uses: woocommerce/action-build@trunk
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install PNPM
|
||||||
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Build zip
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
|
run: bash bin/build-zip.sh
|
||||||
|
|
||||||
- name: Deploy nightly build
|
- name: Deploy nightly build
|
||||||
uses: WebFreak001/deploy-nightly@v1.1.0
|
uses: WebFreak001/deploy-nightly@v1.1.0
|
||||||
env:
|
env:
|
||||||
|
@ -26,13 +46,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/25945111/assets{?name,label}
|
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/25945111/assets{?name,label}
|
||||||
release_id: 25945111
|
release_id: 25945111
|
||||||
asset_path: ${{ steps.build.outputs.zip_path }}
|
asset_path: plugins/woocommerce/woocommerce.zip
|
||||||
asset_name: woocommerce-${{ matrix.build }}-nightly.zip
|
asset_name: woocommerce-${{ matrix.build }}-nightly.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
max_releases: 1
|
max_releases: 1
|
||||||
update:
|
update:
|
||||||
name: Update nightly tag commit ref
|
name: Update nightly tag commit ref
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Update nightly tag
|
- name: Update nightly tag
|
||||||
uses: richardsimko/github-tag-action@v1.0.5
|
uses: richardsimko/github-tag-action@v1.0.5
|
||||||
|
|
|
@ -1,196 +1,165 @@
|
||||||
name: Build zip for PR
|
name: Run tests against PR
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
name: Build zip for PR
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Cancel Previous Runs
|
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
id: build
|
|
||||||
uses: woocommerce/action-build@trunk
|
|
||||||
env:
|
|
||||||
BUILD_ENV: e2e
|
|
||||||
|
|
||||||
- name: Upload PR zip
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
name: woocommerce
|
|
||||||
path: ${{ steps.build.outputs.zip_path }}
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
e2e-tests-run:
|
e2e-tests-run:
|
||||||
name: Runs E2E tests.
|
name: Runs E2E tests.
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [build]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Create dirs.
|
|
||||||
run: |
|
|
||||||
mkdir -p code/woocommerce
|
|
||||||
mkdir -p package/woocommerce
|
|
||||||
mkdir -p tmp/woocommerce
|
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Checkout code.
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache modules
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: package/woocommerce
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Move current directory to code. We will install zip file in this dir later.
|
- name: Install PNPM
|
||||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
- name: Download WooCommerce ZIP.
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: woocommerce
|
|
||||||
path: tmp
|
|
||||||
|
|
||||||
- name: Extract and replace WooCommerce zip.
|
|
||||||
working-directory: tmp
|
|
||||||
run: |
|
|
||||||
unzip woocommerce.zip -d woocommerce
|
|
||||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: package/woocommerce
|
run: pnpm install
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
- name: Install Composer dependencies
|
||||||
pnpm install
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
|
run: pnpm nx composer-install-no-dev woocommerce
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Run build
|
||||||
|
run: pnpm nx build woocommerce
|
||||||
|
|
||||||
- name: Load docker images and start containers.
|
- name: Load docker images and start containers.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
run: pnpx wc-e2e docker:up
|
run: pnpm exec wc-e2e docker:up
|
||||||
|
|
||||||
- name: Run tests command.
|
- name: Run tests command.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
env:
|
env:
|
||||||
WC_E2E_SCREENSHOTS: 1
|
WC_E2E_SCREENSHOTS: 1
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
|
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }}
|
E2E_SLACK_CHANNEL: ${{ secrets.E2E_SLACK_CHANNEL }}
|
||||||
run: pnpx wc-e2e test:e2e
|
run: pnpm exec wc-e2e test:e2e
|
||||||
|
|
||||||
- name: Archive E2E test screenshots
|
- name: Archive E2E test screenshots
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: E2E Screenshots
|
name: E2E Screenshots
|
||||||
path: package/woocommerce/plugins/woocommerce/tests/e2e/screenshots
|
path: plugins/woocommerce/tests/e2e/screenshots
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
api-tests-run:
|
api-tests-run:
|
||||||
name: Runs API tests.
|
name: Runs API tests.
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [build]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Create dirs.
|
|
||||||
run: |
|
|
||||||
mkdir -p code/woocommerce
|
|
||||||
mkdir -p package/woocommerce
|
|
||||||
mkdir -p tmp/woocommerce
|
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Checkout code.
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache modules
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: package/woocommerce
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Move current directory to code. We will install zip file in this dir later.
|
- name: Install PNPM
|
||||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
- name: Download WooCommerce ZIP.
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: woocommerce
|
|
||||||
path: tmp
|
|
||||||
|
|
||||||
- name: Extract and replace WooCommerce zip.
|
|
||||||
working-directory: tmp
|
|
||||||
run: |
|
|
||||||
unzip woocommerce.zip -d woocommerce
|
|
||||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: package/woocommerce
|
run: pnpm install
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
- name: Install Composer dependencies
|
||||||
pnpm install
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
|
run: pnpm nx composer-install woocommerce
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Run build
|
||||||
|
run: pnpm nx build woocommerce
|
||||||
|
|
||||||
- name: Load docker images and start containers.
|
- name: Load docker images and start containers.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
run: pnpx wc-e2e docker:up
|
run: pnpm exec wc-e2e docker:up
|
||||||
|
|
||||||
- name: Run tests command.
|
- name: Run tests command.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
env:
|
env:
|
||||||
BASE_URL: http://localhost:8084
|
BASE_URL: http://localhost:8086
|
||||||
USER_KEY: admin
|
USER_KEY: admin
|
||||||
USER_SECRET: password
|
USER_SECRET: password
|
||||||
run: pnpx wc-api-tests test api
|
run: pnpm exec wc-api-tests test api
|
||||||
|
|
||||||
- name: Upload API test report
|
- name: Upload API test report
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: api-test-report---pr-${{ github.event.number }}
|
name: api-test-report---pr-${{ github.event.number }}
|
||||||
path: |
|
path: |
|
||||||
package/woocommerce/packages/js/api-core-tests/allure-results
|
packages/js/api-core-tests/allure-results
|
||||||
package/woocommerce/packages/js/api-core-tests/allure-report
|
packages/js/api-core-tests/allure-report
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
k6-tests-run:
|
k6-tests-run:
|
||||||
name: Runs k6 Performance tests
|
name: Runs k6 Performance tests
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
needs: [build]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Create dirs.
|
|
||||||
run: |
|
|
||||||
mkdir -p code/woocommerce
|
|
||||||
mkdir -p package/woocommerce
|
|
||||||
mkdir -p tmp/woocommerce
|
|
||||||
mkdir -p node_modules
|
|
||||||
- name: Checkout code.
|
- name: Checkout code.
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache modules
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: package/woocommerce
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Move current directory to code. We will install zip file in this dir later.
|
- name: Install PNPM
|
||||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
- name: Download WooCommerce ZIP.
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: woocommerce
|
|
||||||
path: tmp
|
|
||||||
|
|
||||||
- name: Extract and replace WooCommerce zip.
|
|
||||||
working-directory: tmp
|
|
||||||
run: |
|
|
||||||
unzip woocommerce.zip -d woocommerce
|
|
||||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: package/woocommerce
|
run: pnpm install
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
- name: Install Composer dependencies
|
||||||
pnpm install
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
|
run: pnpm nx composer-install woocommerce
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '7.4'
|
||||||
|
|
||||||
|
- name: Run build
|
||||||
|
run: pnpm nx build woocommerce
|
||||||
|
|
||||||
- name: Workaround to use initialization file with prepopulated data.
|
- name: Workaround to use initialization file with prepopulated data.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce/tests/e2e/docker
|
working-directory: plugins/woocommerce/tests/e2e/docker
|
||||||
run: |
|
run: |
|
||||||
cp init-sample-products.sh initialize.sh
|
cp init-sample-products.sh initialize.sh
|
||||||
|
|
||||||
- name: Load docker images and start containers.
|
- name: Load docker images and start containers.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
run: pnpx wc-e2e docker:up
|
run: pnpm exec wc-e2e docker:up
|
||||||
|
|
||||||
- name: Install k6
|
- name: Install k6
|
||||||
run: |
|
run: |
|
||||||
|
@ -198,4 +167,4 @@ jobs:
|
||||||
|
|
||||||
- name: Run k6 tests
|
- name: Run k6 tests
|
||||||
run: |
|
run: |
|
||||||
./k6 run package/woocommerce/plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
||||||
|
|
|
@ -4,12 +4,14 @@ on:
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: plugins/woocommerce
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Code coverage (PHP 7.4, WP Latest)
|
name: Code coverage (PHP 7.4, WP Latest)
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
services:
|
services:
|
||||||
database:
|
database:
|
||||||
image: mysql:5.6
|
image: mysql:5.6
|
||||||
|
@ -19,13 +21,8 @@ jobs:
|
||||||
- 3306:3306
|
- 3306:3306
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 100
|
fetch-depth: 100
|
||||||
|
|
||||||
|
@ -42,24 +39,27 @@ jobs:
|
||||||
php --version
|
php --version
|
||||||
composer --version
|
composer --version
|
||||||
|
|
||||||
- name: Get cached composer directories
|
- name: Get cached composer and pnpm directories
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
./packages
|
~/.pnpm-store
|
||||||
./vendor
|
plugins/woocommerce/packages
|
||||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Install PNPM
|
||||||
run: |
|
run: npm install -g pnpm@^6.24.2
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Setup and install composer
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
run: pnpm nx composer-install woocommerce
|
run: pnpm nx composer-install woocommerce
|
||||||
|
|
||||||
- name: Build Admin feature config
|
- name: Build Admin feature config
|
||||||
working-directory: ./
|
|
||||||
run: |
|
run: |
|
||||||
pnpm nx build:feature-config woocommerce
|
pnpm nx build:feature-config woocommerce
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,17 @@ on:
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: plugins/woocommerce
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Code sniff (PHP 7.4, WP Latest)
|
name: Code sniff (PHP 7.4, WP Latest)
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 100
|
fetch-depth: 100
|
||||||
|
|
||||||
|
@ -32,25 +29,31 @@ jobs:
|
||||||
php --version
|
php --version
|
||||||
composer --version
|
composer --version
|
||||||
|
|
||||||
- name: Get cached composer directories
|
- name: Get cached composer and pnpm directories
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
./packages
|
~/.pnpm-store
|
||||||
./vendor
|
plugins/woocommerce/packages
|
||||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Install PNPM
|
||||||
run: |
|
run: npm install -g pnpm@^6.24.2
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Setup and install composer
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
run: pnpm nx composer-install woocommerce
|
run: pnpm nx composer-install woocommerce
|
||||||
|
|
||||||
- name: Run code sniff
|
- name: Run code sniff
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
run: ./tests/bin/phpcs.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.after }}"
|
run: ./tests/bin/phpcs.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.after }}"
|
||||||
|
|
||||||
- name: Show PHPCS results in PR
|
- name: Show PHPCS results in PR
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
run: cs2pr ./phpcs-report.xml
|
run: cs2pr ./phpcs-report.xml
|
||||||
|
|
|
@ -6,7 +6,7 @@ concurrency:
|
||||||
jobs:
|
jobs:
|
||||||
changelogger_used:
|
changelogger_used:
|
||||||
name: Changelogger use
|
name: Changelogger use
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
|
@ -6,29 +6,38 @@ on:
|
||||||
- 'packages/js/**/**'
|
- 'packages/js/**/**'
|
||||||
- 'plugins/woocommerce-admin/client/**'
|
- 'plugins/woocommerce-admin/client/**'
|
||||||
- '!**.md'
|
- '!**.md'
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-test-js:
|
lint-test-js:
|
||||||
name: Lint and Test JS
|
name: Lint and Test JS
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: '16'
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Cache modules
|
||||||
run: npm install -g pnpm && pnpm install
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
key: ${{ runner.os }}-npm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install PNPM
|
||||||
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: |
|
run: |
|
||||||
|
pnpm nx build woocommerce-admin
|
||||||
pnpm nx lint woocommerce-admin
|
pnpm nx lint woocommerce-admin
|
||||||
pnpm nx lint:js-packages woocommerce-admin
|
pnpm nx lint:js-packages woocommerce-admin
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,14 @@ on:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- synchronize
|
- synchronize
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
label_project:
|
label_project:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
|
|
||||||
- uses: actions/labeler@v3
|
- uses: actions/labeler@v3
|
||||||
with:
|
with:
|
||||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|
|
@ -1,110 +1,127 @@
|
||||||
name: Run smoke tests against pull request.
|
name: Run smoke tests against pull request.
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- trunk
|
- trunk
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prcheck:
|
prcheck:
|
||||||
name: Smoke test a pull request.
|
name: Smoke test a pull request.
|
||||||
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
|
if: "${{ contains(github.event.label.name, 'run: smoke tests') }}"
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
- name: Create dirs.
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
run: |
|
||||||
with:
|
mkdir -p code/woocommerce
|
||||||
access_token: ${{ github.token }}
|
mkdir -p package/woocommerce
|
||||||
|
mkdir -p tmp/woocommerce
|
||||||
|
|
||||||
- name: Create dirs.
|
- name: Checkout code.
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
mkdir -p code/woocommerce
|
with:
|
||||||
mkdir -p package/woocommerce
|
path: package/woocommerce
|
||||||
mkdir -p tmp/woocommerce
|
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Get cached composer and pnpm directories
|
||||||
uses: actions/checkout@v2
|
uses: actions/cache@v3
|
||||||
with:
|
id: cache-deps
|
||||||
path: package/woocommerce
|
with:
|
||||||
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
package/woocommerce/plugins/woocommerce/packages
|
||||||
|
package/woocommerce/plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-smoke-test-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Install prerequisites.
|
- name: Install PNPM
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
run: npm install -g pnpm@^6.24.2
|
||||||
id: installation
|
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
pnpm nx composer-install-no-dev woocommerce
|
|
||||||
pnpm nx build-assets woocommerce
|
|
||||||
pnpm install jest
|
|
||||||
|
|
||||||
- name: Run smoke test.
|
- name: Install dependencies
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
if: always()
|
run: pnpm install
|
||||||
env:
|
|
||||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
||||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
|
||||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
|
||||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
|
||||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
|
||||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
|
||||||
WC_E2E_SCREENSHOTS: 1
|
|
||||||
E2E_RETEST: 1
|
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
|
||||||
UPDATE_WC: 1
|
|
||||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
|
||||||
run: |
|
|
||||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
|
||||||
|
|
||||||
- name: Post Smoke tests results comment on PR
|
- name: Install Composer dependencies
|
||||||
if: always()
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
uses: actions/github-script@v5
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
env:
|
run: pnpm nx composer-install-no-dev woocommerce
|
||||||
TITLE: 'Smoke Test Results'
|
|
||||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
||||||
with:
|
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
script: |
|
|
||||||
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
|
||||||
await script({github, context})
|
|
||||||
|
|
||||||
- name: Run E2E tests.
|
- name: Install prerequisites.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
if: always()
|
id: installation
|
||||||
env:
|
run: |
|
||||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
pnpm nx build-assets woocommerce
|
||||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
pnpm install jest
|
||||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
|
||||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
|
||||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
|
||||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
|
||||||
WC_E2E_SCREENSHOTS: 1
|
|
||||||
E2E_RETEST: 1
|
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
|
||||||
UPDATE_WC: 1
|
|
||||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
|
||||||
run: |
|
|
||||||
pnpx wc-e2e test:e2e
|
|
||||||
|
|
||||||
- name: Post E2E tests results comment on PR
|
- name: Run smoke test.
|
||||||
if: always()
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
uses: actions/github-script@v5
|
if: always()
|
||||||
env:
|
env:
|
||||||
TITLE: 'E2E Test Results'
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||||
with:
|
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||||
script: |
|
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||||
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||||
await script({github, context})
|
WC_E2E_SCREENSHOTS: 1
|
||||||
|
E2E_RETEST: 1
|
||||||
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
|
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||||
|
UPDATE_WC: 1
|
||||||
|
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||||
|
run: |
|
||||||
|
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||||
|
|
||||||
- name: Remove label from pull request.
|
- name: Post Smoke tests results comment on PR
|
||||||
if: |
|
if: always()
|
||||||
always()
|
uses: actions/github-script@v5
|
||||||
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
|
env:
|
||||||
uses: actions-ecosystem/action-remove-labels@v1
|
TITLE: 'Smoke Test Results'
|
||||||
with:
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
with:
|
||||||
labels: 'run: smoke tests'
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
script: |
|
||||||
|
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||||
|
await script({github, context})
|
||||||
|
|
||||||
|
- name: Run E2E tests.
|
||||||
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
|
if: always()
|
||||||
|
env:
|
||||||
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||||
|
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||||
|
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||||
|
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||||
|
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||||
|
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||||
|
WC_E2E_SCREENSHOTS: 1
|
||||||
|
E2E_RETEST: 1
|
||||||
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
|
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||||
|
UPDATE_WC: 1
|
||||||
|
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||||
|
run: |
|
||||||
|
pnpm exec wc-e2e test:e2e
|
||||||
|
|
||||||
|
- name: Post E2E tests results comment on PR
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v5
|
||||||
|
env:
|
||||||
|
TITLE: 'E2E Test Results'
|
||||||
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||||
|
with:
|
||||||
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
script: |
|
||||||
|
const script = require( './package/woocommerce/packages/js/e2e-environment/bin/post-results-to-github-pr.js' )
|
||||||
|
await script({github, context})
|
||||||
|
|
||||||
|
- name: Remove label from pull request.
|
||||||
|
if: |
|
||||||
|
always()
|
||||||
|
&& contains( github.event.pull_request.labels.*.name, format('run{0} smoke tests', ':'))
|
||||||
|
uses: actions-ecosystem/action-remove-labels@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
labels: 'run: smoke tests'
|
||||||
|
|
|
@ -4,12 +4,15 @@ on:
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: plugins/woocommerce
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -32,11 +35,6 @@ jobs:
|
||||||
- 3306:3306
|
- 3306:3306
|
||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
|
||||||
uses: styfle/cancel-workflow-action@0.7.0
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
@ -53,37 +51,45 @@ jobs:
|
||||||
php --version
|
php --version
|
||||||
composer --version
|
composer --version
|
||||||
|
|
||||||
- name: Get cached composer directories
|
- name: Get cached composer and pnpm directories
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
|
id: cache-deps
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
./packages
|
~/.pnpm-store
|
||||||
./vendor
|
plugins/woocommerce/packages
|
||||||
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install PNPM
|
||||||
|
run: npm install -g pnpm@^6.24.2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
|
run: pnpm nx composer-install woocommerce
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
pnpm nx composer-install woocommerce
|
|
||||||
- name: Build Admin feature config
|
- name: Build Admin feature config
|
||||||
working-directory: ./
|
|
||||||
run: |
|
run: |
|
||||||
pnpm nx build:feature-config woocommerce
|
pnpm nx build:feature-config woocommerce
|
||||||
|
|
||||||
- name: Add PHP8 Compatibility.
|
- name: Add PHP8 Compatibility.
|
||||||
run: |
|
run: |
|
||||||
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
||||||
|
cd plugins/woocommerce
|
||||||
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
||||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||||
composer bin phpunit config --unset platform
|
composer bin phpunit config --unset platform
|
||||||
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
||||||
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
||||||
rm -rf ./vendor/phpunit/
|
rm -rf ./vendor/phpunit/
|
||||||
composer dump-autoload
|
pnpm nx composer-dump-autoload woocommerce
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Init DB and WP
|
- name: Init DB and WP
|
||||||
|
working-directory: plugins/woocommerce
|
||||||
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
||||||
process-pull-request-after-merge:
|
process-pull-request-after-merge:
|
||||||
name: "Process a pull request after it's merged"
|
name: "Process a pull request after it's merged"
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: "Get the action scripts"
|
- name: "Get the action scripts"
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -6,7 +6,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
maybe-create-next-milestone-and-release-branch:
|
maybe-create-next-milestone-and-release-branch:
|
||||||
name: "Maybe create next milestone and release branch"
|
name: "Maybe create next milestone and release branch"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: "Get the action script"
|
- name: "Get the action script"
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
name: Check daily smoke test site status.
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '25 7 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ping_site:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
name: Check site and notify if not found
|
||||||
|
steps:
|
||||||
|
- name: Check site status
|
||||||
|
id: sitecheck
|
||||||
|
uses: srt32/uptime@958231f4d95c117f08eb0fc70907e80d0dfedf2b
|
||||||
|
with:
|
||||||
|
url-to-hit: "${{ secrets.SMOKE_TEST_URL }}ready/"
|
||||||
|
expected-statuses: "200,301"
|
||||||
|
- name: Send message to Slack API
|
||||||
|
if: failure()
|
||||||
|
uses: archive/github-actions-slack@deecc2edc496dc642d643de1d7cf3a47f51fb27a
|
||||||
|
id: notify
|
||||||
|
with:
|
||||||
|
slack-bot-user-oauth-access-token: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
|
slack-channel: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
||||||
|
slack-text: ':warning: <!subteam^${{ secrets.SMOKE_TEST_SLACK_GROUP }}> FYI the URL ${{ secrets.SMOKE_TEST_URL }}ready/ appears to be returning `404 not found` :x:'
|
|
@ -1,154 +1,167 @@
|
||||||
name: Smoke test daily
|
name: Smoke test daily
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '25 3 * * *'
|
- cron: '25 3 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
login-run:
|
login-run:
|
||||||
name: Daily smoke test on trunk.
|
name: Daily smoke test on trunk.
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
- name: Create dirs.
|
||||||
|
run: |
|
||||||
|
mkdir -p code/woocommerce
|
||||||
|
mkdir -p package/woocommerce
|
||||||
|
mkdir -p tmp/woocommerce
|
||||||
|
|
||||||
- name: Create dirs.
|
- name: Checkout code.
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
mkdir -p code/woocommerce
|
with:
|
||||||
mkdir -p package/woocommerce
|
path: package/woocommerce
|
||||||
mkdir -p tmp/woocommerce
|
ref: trunk
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Install prerequisites.
|
||||||
uses: actions/checkout@v2
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
with:
|
run: |
|
||||||
path: package/woocommerce
|
npm install -g pnpm@^6.24.2
|
||||||
ref: trunk
|
pnpm install
|
||||||
|
pnpm nx composer-install-no-dev woocommerce
|
||||||
|
pnpm nx build-assets woocommerce
|
||||||
|
pnpm install jest
|
||||||
|
|
||||||
- name: Install prerequisites.
|
- name: Run smoke test.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
run: |
|
env:
|
||||||
npm install -g pnpm
|
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||||
pnpm install
|
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||||
pnpm nx composer-install-no-dev woocommerce
|
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||||
pnpm nx build-assets woocommerce
|
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||||
pnpm install jest
|
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||||
|
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||||
- name: Run smoke test.
|
WC_E2E_SCREENSHOTS: 1
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
E2E_RETEST: 1
|
||||||
env:
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
|
E2E_SLACK_CHANNEL: 'C01U0H617MY'
|
||||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
UPDATE_WC: 1
|
||||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||||
WC_E2E_SCREENSHOTS: 1
|
run: |
|
||||||
E2E_RETEST: 1
|
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
pnpm exec wc-e2e test:e2e
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.SMOKE_TEST_SLACK_CHANNEL }}
|
pnpm exec wc-api-tests test api
|
||||||
UPDATE_WC: 1
|
|
||||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
|
||||||
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
|
||||||
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
|
||||||
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
|
||||||
pnpx wc-e2e test:e2e
|
|
||||||
pnpx wc-api-tests test api
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build zip for PR
|
name: Build zip for PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build
|
- name: Get cached composer and pnpm directories
|
||||||
id: build
|
uses: actions/cache@v3
|
||||||
uses: woocommerce/action-build@trunk
|
id: cache-deps
|
||||||
env:
|
with:
|
||||||
BUILD_ENV: e2e
|
path: |
|
||||||
|
~/.pnpm-store
|
||||||
|
plugins/woocommerce/packages
|
||||||
|
plugins/woocommerce/**/vendor
|
||||||
|
key: ${{ runner.os }}-npm-composer-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Upload PR zip
|
- name: Install PNPM
|
||||||
uses: actions/upload-artifact@v2
|
run: npm install -g pnpm@^6.24.2
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
name: woocommerce
|
|
||||||
path: ${{ steps.build.outputs.zip_path }}
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
test-plugins:
|
|
||||||
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
needs: [build]
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- plugin: 'WooCommerce Payments'
|
|
||||||
repo: 'automattic/woocommerce-payments'
|
|
||||||
- plugin: 'WooCommerce PayPal Payments'
|
|
||||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
|
||||||
- plugin: 'WooCommerce Shipping & Tax'
|
|
||||||
repo: 'automattic/woocommerce-services'
|
|
||||||
- plugin: 'WooCommerce Subscriptions'
|
|
||||||
repo: WC_SUBSCRIPTIONS_REPO
|
|
||||||
private: true
|
|
||||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
|
||||||
repo: 'Yoast/wordpress-seo'
|
|
||||||
- plugin: 'Contact Form 7'
|
|
||||||
repo: 'takayukister/contact-form-7'
|
|
||||||
steps:
|
|
||||||
- name: Create dirs.
|
|
||||||
run: |
|
|
||||||
mkdir -p code/woocommerce
|
|
||||||
mkdir -p package/woocommerce
|
|
||||||
mkdir -p tmp/woocommerce
|
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Setup PHP
|
||||||
uses: actions/checkout@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
path: package/woocommerce
|
php-version: '7.4'
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Build zip
|
||||||
working-directory: package/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
run: |
|
run: bash bin/build-zip.sh
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Load docker images and start containers.
|
- name: Upload PR zip
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
uses: actions/upload-artifact@v3
|
||||||
run: pnpx wc-e2e docker:up
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
name: woocommerce
|
||||||
|
path: plugins/woocommerce/woocommerce.zip
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
- name: Move current directory to code. We will install zip file in this dir later.
|
test-plugins:
|
||||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
needs: [build]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- plugin: 'WooCommerce Payments'
|
||||||
|
repo: 'automattic/woocommerce-payments'
|
||||||
|
- plugin: 'WooCommerce PayPal Payments'
|
||||||
|
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||||
|
- plugin: 'WooCommerce Shipping & Tax'
|
||||||
|
repo: 'automattic/woocommerce-services'
|
||||||
|
- plugin: 'WooCommerce Subscriptions'
|
||||||
|
repo: WC_SUBSCRIPTIONS_REPO
|
||||||
|
private: true
|
||||||
|
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||||
|
repo: 'Yoast/wordpress-seo'
|
||||||
|
- plugin: 'Contact Form 7'
|
||||||
|
repo: 'takayukister/contact-form-7'
|
||||||
|
steps:
|
||||||
|
- name: Create dirs.
|
||||||
|
run: |
|
||||||
|
mkdir -p code/woocommerce
|
||||||
|
mkdir -p package/woocommerce
|
||||||
|
mkdir -p tmp/woocommerce
|
||||||
|
|
||||||
- name: Download WooCommerce ZIP.
|
- name: Checkout code.
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
name: woocommerce
|
path: package/woocommerce
|
||||||
path: tmp
|
|
||||||
|
|
||||||
- name: Extract and replace WooCommerce zip.
|
- name: Install PNPM and install dependencies
|
||||||
working-directory: tmp
|
working-directory: package/woocommerce
|
||||||
run: |
|
run: |
|
||||||
unzip woocommerce.zip -d woocommerce
|
npm install -g pnpm@^6.24.2
|
||||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
pnpm install
|
||||||
|
|
||||||
- name: Install dependencies again
|
- name: Load docker images and start containers.
|
||||||
working-directory: package/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
run: |
|
run: pnpm exec wc-e2e docker:up
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Run tests command.
|
- name: Move current directory to code. We will install zip file in this dir later.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||||
env:
|
|
||||||
WC_E2E_SCREENSHOTS: 1
|
- name: Download WooCommerce ZIP.
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
uses: actions/download-artifact@v3
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
with:
|
||||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
name: woocommerce
|
||||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
path: tmp
|
||||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
|
||||||
run: |
|
- name: Extract and replace WooCommerce zip.
|
||||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
working-directory: tmp
|
||||||
pnpx wc-e2e test:e2e
|
run: |
|
||||||
|
unzip woocommerce.zip -d woocommerce
|
||||||
|
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||||
|
|
||||||
|
- name: Install dependencies again
|
||||||
|
working-directory: package/woocommerce
|
||||||
|
run: |
|
||||||
|
npm install -g pnpm@^6.24.2
|
||||||
|
pnpm install
|
||||||
|
|
||||||
|
- name: Run tests command.
|
||||||
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
|
env:
|
||||||
|
WC_E2E_SCREENSHOTS: 1
|
||||||
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
|
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||||
|
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||||
|
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||||
|
run: |
|
||||||
|
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
||||||
|
pnpm exec wc-e2e test:e2e
|
||||||
|
|
|
@ -1,199 +1,197 @@
|
||||||
name: Smoke test release
|
name: Smoke test release
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
release_id:
|
release_id:
|
||||||
description: 'WooCommerce Release Id'
|
description: 'WooCommerce Release Id'
|
||||||
required: true
|
required: true
|
||||||
jobs:
|
jobs:
|
||||||
login-run:
|
login-run:
|
||||||
name: Daily smoke test on release.
|
name: Daily smoke test on release.
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
- name: Create dirs.
|
||||||
|
run: |
|
||||||
|
mkdir -p code/woocommerce
|
||||||
|
mkdir -p package/woocommerce
|
||||||
|
mkdir -p tmp/woocommerce
|
||||||
|
mkdir -p node_modules
|
||||||
|
|
||||||
- name: Create dirs.
|
- name: Checkout code.
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
mkdir -p code/woocommerce
|
with:
|
||||||
mkdir -p package/woocommerce
|
path: package/woocommerce
|
||||||
mkdir -p tmp/woocommerce
|
ref: trunk
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Install prerequisites.
|
||||||
uses: actions/checkout@v2
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
with:
|
run: |
|
||||||
path: package/woocommerce
|
npm install -g pnpm@^6.24.2
|
||||||
ref: trunk
|
pnpm install
|
||||||
|
pnpm nx composer-install-no-dev woocommerce
|
||||||
|
pnpm nx build-assets woocommerce
|
||||||
|
pnpm install jest
|
||||||
|
|
||||||
- name: Install prerequisites.
|
- name: Run smoke test.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
run: |
|
env:
|
||||||
npm install -g pnpm
|
SMOKE_TEST_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||||
pnpm install
|
SMOKE_TEST_ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||||
pnpm nx composer-install-no-dev woocommerce
|
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||||
pnpm nx build-assets woocommerce
|
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }}
|
||||||
pnpm install jest
|
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
||||||
|
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
||||||
- name: Run smoke test.
|
WC_E2E_SCREENSHOTS: 1
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
E2E_RETEST: 1
|
||||||
env:
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
SMOKE_TEST_URL: ${{ secrets.RELEASE_TEST_URL }}
|
E2E_SLACK_CHANNEL: 'C02DS4NE72S'
|
||||||
SMOKE_TEST_ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
TEST_RELEASE: 1
|
||||||
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
UPDATE_WC: 1
|
||||||
SMOKE_TEST_ADMIN_USER_EMAIL: ${{ secrets.RELEASE_TEST_ADMIN_USER_EMAIL }}
|
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||||
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||||
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||||
WC_E2E_SCREENSHOTS: 1
|
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||||
E2E_RETEST: 1
|
run: |
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
pnpm exec wc-e2e test:e2e
|
||||||
TEST_RELEASE: 1
|
pnpm exec wc-api-tests test api
|
||||||
UPDATE_WC: 1
|
test-wp-version:
|
||||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
name: Smoke test on L-${{ matrix.wp }} WordPress version
|
||||||
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
runs-on: ubuntu-20.04
|
||||||
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
strategy:
|
||||||
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
matrix:
|
||||||
run: |
|
wp: ['1', '2']
|
||||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/update-woocommerce.js
|
steps:
|
||||||
pnpx wc-e2e test:e2e
|
- name: Create dirs.
|
||||||
pnpx wc-api-tests test api
|
run: |
|
||||||
test-wp-version:
|
mkdir -p code/woocommerce
|
||||||
name: Smoke test on L-${{ matrix.wp }} WordPress version
|
mkdir -p package/woocommerce
|
||||||
runs-on: ubuntu-18.04
|
mkdir -p tmp/woocommerce
|
||||||
strategy:
|
mkdir -p node_modules
|
||||||
matrix:
|
|
||||||
wp: [ '1', '2' ]
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Create dirs.
|
- name: Checkout code.
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
mkdir -p code/woocommerce
|
with:
|
||||||
mkdir -p package/woocommerce
|
path: package/woocommerce
|
||||||
mkdir -p tmp/woocommerce
|
- name: Fetch Asset ID
|
||||||
mkdir -p node_modules
|
id: fetch_asset_id
|
||||||
|
uses: actions/github-script@v5
|
||||||
|
env:
|
||||||
|
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
||||||
|
await script({github, context, core})
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Install PNPM and install dependencies
|
||||||
uses: actions/checkout@v2
|
working-directory: package/woocommerce
|
||||||
with:
|
run: |
|
||||||
path: package/woocommerce
|
npm install -g pnpm@^6.24.2
|
||||||
- name: Fetch Asset ID
|
pnpm install
|
||||||
id: fetch_asset_id
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
env:
|
|
||||||
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
|
||||||
await script({github, context, core})
|
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Load docker images and start containers.
|
||||||
working-directory: package/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
run: |
|
env:
|
||||||
npm install -g pnpm
|
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
||||||
pnpm install
|
run: pnpm nx docker-up woocommerce
|
||||||
|
|
||||||
- name: Load docker images and start containers.
|
- name: Move current directory to code. We will install zip file in this dir later.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||||
env:
|
|
||||||
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
|
||||||
run: pnpm nx docker-up woocommerce
|
|
||||||
|
|
||||||
- name: Move current directory to code. We will install zip file in this dir later.
|
- name: Download WooCommerce release zip
|
||||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
working-directory: tmp
|
||||||
|
run: |
|
||||||
|
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
||||||
|
|
||||||
- name: Download WooCommerce release zip
|
unzip woocommerce.zip -d woocommerce
|
||||||
working-directory: tmp
|
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||||
run: |
|
|
||||||
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
|
||||||
|
|
||||||
unzip woocommerce.zip -d woocommerce
|
- name: Run tests command.
|
||||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
|
env:
|
||||||
|
WC_E2E_SCREENSHOTS: 1
|
||||||
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
|
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||||
|
run: pnpm nx test-e2e woocommerce
|
||||||
|
|
||||||
- name: Run tests command.
|
test-plugins:
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
||||||
env:
|
runs-on: ubuntu-20.04
|
||||||
WC_E2E_SCREENSHOTS: 1
|
strategy:
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
fail-fast: false
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
matrix:
|
||||||
run: pnpm nx test-e2e woocommerce
|
include:
|
||||||
|
- plugin: 'WooCommerce Payments'
|
||||||
|
repo: 'automattic/woocommerce-payments'
|
||||||
|
- plugin: 'WooCommerce PayPal Payments'
|
||||||
|
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||||
|
- plugin: 'WooCommerce Shipping & Tax'
|
||||||
|
repo: 'automattic/woocommerce-services'
|
||||||
|
- plugin: 'WooCommerce Subscriptions'
|
||||||
|
repo: WC_SUBSCRIPTIONS_REPO
|
||||||
|
private: true
|
||||||
|
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||||
|
repo: 'Yoast/wordpress-seo'
|
||||||
|
- plugin: 'Contact Form 7'
|
||||||
|
repo: 'takayukister/contact-form-7'
|
||||||
|
steps:
|
||||||
|
- name: Create dirs.
|
||||||
|
run: |
|
||||||
|
mkdir -p code/woocommerce
|
||||||
|
mkdir -p package/woocommerce
|
||||||
|
mkdir -p tmp/woocommerce
|
||||||
|
mkdir -p node_modules
|
||||||
|
|
||||||
test-plugins:
|
- name: Checkout code.
|
||||||
name: Smoke tests with ${{ matrix.plugin }} plugin installed
|
uses: actions/checkout@v2
|
||||||
runs-on: ubuntu-18.04
|
with:
|
||||||
strategy:
|
path: package/woocommerce
|
||||||
fail-fast: false
|
- name: Fetch Asset ID
|
||||||
matrix:
|
id: fetch_asset_id
|
||||||
include:
|
uses: actions/github-script@v5
|
||||||
- plugin: 'WooCommerce Payments'
|
env:
|
||||||
repo: 'automattic/woocommerce-payments'
|
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
||||||
- plugin: 'WooCommerce PayPal Payments'
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
REPO: ${{ github.repository }}
|
||||||
- plugin: 'WooCommerce Shipping & Tax'
|
with:
|
||||||
repo: 'automattic/woocommerce-services'
|
script: |
|
||||||
- plugin: 'WooCommerce Subscriptions'
|
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
||||||
repo: WC_SUBSCRIPTIONS_REPO
|
await script({github, context, core})
|
||||||
private: true
|
|
||||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
|
||||||
repo: 'Yoast/wordpress-seo'
|
|
||||||
- plugin: 'Contact Form 7'
|
|
||||||
repo: 'takayukister/contact-form-7'
|
|
||||||
steps:
|
|
||||||
- name: Create dirs.
|
|
||||||
run: |
|
|
||||||
mkdir -p code/woocommerce
|
|
||||||
mkdir -p package/woocommerce
|
|
||||||
mkdir -p tmp/woocommerce
|
|
||||||
mkdir -p node_modules
|
|
||||||
|
|
||||||
- name: Checkout code.
|
- name: Install PNPM and install dependencies
|
||||||
uses: actions/checkout@v2
|
working-directory: package/woocommerce
|
||||||
with:
|
run: |
|
||||||
path: package/woocommerce
|
npm install -g pnpm@^6.24.2
|
||||||
- name: Fetch Asset ID
|
pnpm install
|
||||||
id: fetch_asset_id
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
env:
|
|
||||||
RELEASE_ID: ${{ github.event.inputs.release_id }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const script = require( './package/woocommerce/.github/workflows/scripts/fetch-asset-id.js' )
|
|
||||||
await script({github, context, core})
|
|
||||||
|
|
||||||
- name: Install PNPM and install dependencies
|
- name: Load docker images and start containers.
|
||||||
working-directory: package/woocommerce
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
run: |
|
env:
|
||||||
npm install -g pnpm
|
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
||||||
pnpm install
|
run: pnpm nx docker-up woocommerce
|
||||||
|
|
||||||
- name: Load docker images and start containers.
|
- name: Move current directory to code. We will install zip file in this dir later.
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
||||||
env:
|
|
||||||
LATEST_WP_VERSION_MINUS: ${{ matrix.wp }}
|
|
||||||
run: pnpm nx docker-up woocommerce
|
|
||||||
|
|
||||||
- name: Move current directory to code. We will install zip file in this dir later.
|
- name: Download WooCommerce release zip
|
||||||
run: mv ./package/woocommerce/plugins/woocommerce/* ./code/woocommerce
|
working-directory: tmp
|
||||||
|
run: |
|
||||||
|
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
||||||
|
|
||||||
- name: Download WooCommerce release zip
|
unzip woocommerce.zip -d woocommerce
|
||||||
working-directory: tmp
|
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
||||||
run: |
|
|
||||||
curl https://api.github.com/repos/${{ github.repository }}/releases/assets/${{ steps.fetch_asset_id.outputs.asset_id }} -LJOH 'Accept: application/octet-stream'
|
|
||||||
|
|
||||||
unzip woocommerce.zip -d woocommerce
|
- name: Run tests command.
|
||||||
mv woocommerce/woocommerce/* ../package/woocommerce/plugins/woocommerce/
|
working-directory: package/woocommerce/plugins/woocommerce
|
||||||
|
env:
|
||||||
- name: Run tests command.
|
WC_E2E_SCREENSHOTS: 1
|
||||||
working-directory: package/woocommerce/plugins/woocommerce
|
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
||||||
env:
|
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||||
WC_E2E_SCREENSHOTS: 1
|
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||||
E2E_SLACK_TOKEN: ${{ secrets.SMOKE_TEST_SLACK_TOKEN }}
|
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||||
E2E_SLACK_CHANNEL: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
run: |
|
||||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
pnpm exec wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
||||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
pnpm exec wc-e2e test:e2e
|
||||||
run: |
|
|
||||||
pnpx wc-e2e test:e2e tests/e2e/specs/smoke-tests/upload-plugin.js
|
|
||||||
pnpx wc-e2e test:e2e
|
|
||||||
|
|
|
@ -7,12 +7,12 @@ jobs:
|
||||||
stale:
|
stale:
|
||||||
if: |
|
if: |
|
||||||
! contains(github.event.issue.labels.*.name, 'type: enhancement')
|
! contains(github.event.issue.labels.*.name, 'type: enhancement')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v3
|
- uses: actions/stale@v3
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: "As a part of this repository’s maintenance, this issue is being marked as stale due to inactivity. Please feel free to comment on it in case we missed something.\n\n###### After 7 days with no activity this issue will be automatically be closed."
|
stale-issue-message: "As a part of this repository's maintenance, this issue is being marked as stale due to inactivity. Please feel free to comment on it in case we missed something.\n\n###### After 7 days with no activity this issue will be automatically be closed."
|
||||||
close-issue-message: 'This issue was closed because it has been 14 days with no activity.'
|
close-issue-message: 'This issue was closed because it has been 14 days with no activity.'
|
||||||
days-before-issue-stale: 7
|
days-before-issue-stale: 7
|
||||||
days-before-issue-close: 7
|
days-before-issue-close: 7
|
||||||
|
|
|
@ -6,9 +6,9 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
add_label:
|
add_label:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions-ecosystem/action-add-labels@v1
|
- uses: actions-ecosystem/action-add-labels@v1
|
||||||
if: github.event.issue.labels[0] == null
|
if: github.event.issue.labels[0] == null
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -6,7 +6,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
add-dev-comment:
|
add-dev-comment:
|
||||||
if: "github.event.label.name == 'needs: developer feedback'"
|
if: "github.event.label.name == 'needs: developer feedback'"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
|
@ -26,7 +26,7 @@ jobs:
|
||||||
})
|
})
|
||||||
add-reproduction-comment:
|
add-reproduction-comment:
|
||||||
if: "github.event.label.name == 'status: reproduction'"
|
if: "github.event.label.name == 'status: reproduction'"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
|
@ -45,7 +45,7 @@ jobs:
|
||||||
})
|
})
|
||||||
add-support-comment:
|
add-support-comment:
|
||||||
if: "github.event.label.name == 'type: support request'"
|
if: "github.event.label.name == 'type: support request'"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
|
@ -85,7 +85,7 @@ jobs:
|
||||||
})
|
})
|
||||||
add-votes-comment:
|
add-votes-comment:
|
||||||
if: "github.event.label.name == 'needs: votes'"
|
if: "github.event.label.name == 'needs: votes'"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
|
@ -120,7 +120,7 @@ jobs:
|
||||||
})
|
})
|
||||||
fill-template-comment:
|
fill-template-comment:
|
||||||
if: "github.event.label.name == 'needs: template'"
|
if: "github.event.label.name == 'needs: template'"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
||||||
github.event.issue &&
|
github.event.issue &&
|
||||||
github.event.issue.state == 'open' &&
|
github.event.issue.state == 'open' &&
|
||||||
contains(github.event.issue.labels.*.name, 'needs: author feedback')
|
contains(github.event.issue.labels.*.name, 'needs: author feedback')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Add has feedback
|
- name: Add has feedback
|
||||||
uses: actions-ecosystem/action-add-labels@v1
|
uses: actions-ecosystem/action-add-labels@v1
|
||||||
|
|
9
nx.json
9
nx.json
|
@ -9,8 +9,7 @@
|
||||||
"build",
|
"build",
|
||||||
"test",
|
"test",
|
||||||
"lint",
|
"lint",
|
||||||
"package",
|
"package"
|
||||||
"prepare"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,12 +21,6 @@
|
||||||
"projects": "dependencies"
|
"projects": "dependencies"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prepare": [
|
|
||||||
{
|
|
||||||
"target": "prepare",
|
|
||||||
"projects": "dependencies"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"package": [
|
"package": [
|
||||||
{
|
{
|
||||||
"target": "package",
|
"target": "package",
|
||||||
|
|
131
package.json
131
package.json
|
@ -1,51 +1,84 @@
|
||||||
{
|
{
|
||||||
"name": "woocommerce-monorepo",
|
"name": "woocommerce-monorepo",
|
||||||
"title": "WooCommerce Monorepo",
|
"title": "WooCommerce Monorepo",
|
||||||
"description": "Monorepo for the WooCommerce ecosystem",
|
"description": "Monorepo for the WooCommerce ecosystem",
|
||||||
"homepage": "https://woocommerce.com/",
|
"homepage": "https://woocommerce.com/",
|
||||||
"private": true,
|
"private": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/woocommerce/woocommerce.git"
|
"url": "https://github.com/woocommerce/woocommerce.git"
|
||||||
},
|
},
|
||||||
"author": "Automattic",
|
"author": "Automattic",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"build-storybook": "build-storybook -c ./tools/storybook/.storybook",
|
||||||
"postinstall": "pnpm git:update-hooks",
|
"preinstall": "npx only-allow pnpm",
|
||||||
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install"
|
"postinstall": "pnpm git:update-hooks",
|
||||||
},
|
"git:update-hooks": "rm -r .git/hooks && mkdir -p .git/hooks && husky install",
|
||||||
"devDependencies": {
|
"storybook": "./tools/storybook/import-wp-css-storybook.sh && BABEL_ENV=storybook STORYBOOK=true start-storybook -c ./tools/storybook/.storybook -p 6007 --ci",
|
||||||
"@automattic/nx-composer": "^0.1.0",
|
"storybook-rtl": "USE_RTL_STYLE=true pnpm run storybook",
|
||||||
"@nrwl/cli": "^13.3.4",
|
"create-extension": "node ./tools/create-extension/index.js"
|
||||||
"@nrwl/devkit": "^13.1.4",
|
},
|
||||||
"@nrwl/linter": "^13.3.4",
|
"devDependencies": {
|
||||||
"@nrwl/tao": "13.3.4",
|
"@automattic/nx-composer": "^0.1.0",
|
||||||
"@nrwl/web": "^13.3.4",
|
"@babel/preset-env": "^7.16.11",
|
||||||
"@nrwl/workspace": "^13.3.4",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@types/node": "14.14.33",
|
"@nrwl/cli": "^13.3.4",
|
||||||
"@woocommerce/eslint-plugin": "workspace:*",
|
"@nrwl/devkit": "^13.1.4",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
"@nrwl/linter": "^13.3.4",
|
||||||
"@wordpress/prettier-config": "^1.1.1",
|
"@nrwl/tao": "13.3.4",
|
||||||
"chalk": "^4.1.2",
|
"@nrwl/web": "^13.3.4",
|
||||||
"glob": "^7.2.0",
|
"@nrwl/workspace": "^13.3.4",
|
||||||
"husky": "^7.0.4",
|
"@storybook/addon-a11y": "^6.4.19",
|
||||||
"jest": "^27.3.1",
|
"@storybook/addon-actions": "^6.4.19",
|
||||||
"lint-staged": "^12.3.7",
|
"@storybook/addon-console": "^1.2.3",
|
||||||
"mkdirp": "^1.0.4",
|
"@storybook/addon-controls": "^6.4.19",
|
||||||
"node-stream-zip": "^1.15.0",
|
"@storybook/addon-docs": "^6.4.19",
|
||||||
"prettier": "npm:wp-prettier@^2.2.1-beta-1",
|
"@storybook/addon-knobs": "^6.4.0",
|
||||||
"request": "^2.88.2",
|
"@storybook/addon-links": "^6.4.19",
|
||||||
"typescript": "4.2.4"
|
"@storybook/addon-storysource": "^6.4.19",
|
||||||
},
|
"@storybook/addon-viewport": "^6.4.19",
|
||||||
"dependencies": {
|
"@storybook/addons": "^6.4.19",
|
||||||
"@babel/core": "7.12.9",
|
"@storybook/api": "^6.4.19",
|
||||||
"@wordpress/babel-plugin-import-jsx-pragma": "^3.1.0",
|
"@storybook/builder-webpack5": "^6.4.19",
|
||||||
"@wordpress/babel-preset-default": "^6.4.1",
|
"@storybook/components": "^6.4.19",
|
||||||
"lodash": "^4.17.21",
|
"@storybook/core-events": "^6.4.19",
|
||||||
"wp-textdomain": "1.0.1"
|
"@storybook/manager-webpack5": "^6.4.19",
|
||||||
}
|
"@storybook/react": "^6.4.19",
|
||||||
|
"@storybook/theming": "^6.4.19",
|
||||||
|
"@types/node": "14.14.33",
|
||||||
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
|
"@wordpress/data": "^6.3.0",
|
||||||
|
"@wordpress/eslint-plugin": "^11.0.0",
|
||||||
|
"@wordpress/prettier-config": "^1.1.1",
|
||||||
|
"babel-loader": "^8.2.3",
|
||||||
|
"chalk": "^4.1.2",
|
||||||
|
"core-js": "^3.21.1",
|
||||||
|
"css-loader": "^6.7.0",
|
||||||
|
"glob": "^7.2.0",
|
||||||
|
"husky": "^7.0.4",
|
||||||
|
"jest": "^27.3.1",
|
||||||
|
"lint-staged": "^12.3.7",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"mkdirp": "^1.0.4",
|
||||||
|
"node-stream-zip": "^1.15.0",
|
||||||
|
"prettier": "npm:wp-prettier@^2.2.1-beta-1",
|
||||||
|
"postcss-loader": "^3.0.0",
|
||||||
|
"regenerator-runtime": "^0.13.9",
|
||||||
|
"request": "^2.88.2",
|
||||||
|
"sass": "^1.49.9",
|
||||||
|
"sass-loader": "^10.2.1",
|
||||||
|
"typescript": "4.2.4",
|
||||||
|
"webpack": "^5.70.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/core": "7.12.9",
|
||||||
|
"@wordpress/babel-plugin-import-jsx-pragma": "^3.1.0",
|
||||||
|
"@wordpress/babel-preset-default": "^6.4.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"wp-textdomain": "1.0.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:@woocommerce/eslint-plugin/recommended',
|
||||||
|
],
|
||||||
root: true,
|
root: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/admin-e2e-tests",
|
||||||
|
"description": "WooCommerce Admin end to end tests",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-changelogger": "3.0.2"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"changelogger": {
|
||||||
|
"formatter": {
|
||||||
|
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"fix": "Fixes an existing bug",
|
||||||
|
"add": "Adds functionality",
|
||||||
|
"update": "Update existing functionality",
|
||||||
|
"dev": "Development related task",
|
||||||
|
"tweak": "A minor adjustment to the codebase",
|
||||||
|
"performance": "Address performance issues",
|
||||||
|
"enhancement": "Improve existing functionality"
|
||||||
|
},
|
||||||
|
"changelog": "NEXT_CHANGELOG.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -37,7 +37,7 @@
|
||||||
"@types/puppeteer": "^5.4.5",
|
"@types/puppeteer": "^5.4.5",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||||
"@woocommerce/api": "^0.2.0",
|
"@woocommerce/api": "^0.2.0",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"jest-cli": "^27.5.1",
|
"jest-cli": "^27.5.1",
|
||||||
|
@ -50,16 +50,17 @@
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "pnpm run build",
|
"postinstall": "composer install",
|
||||||
"build": "tsc --build",
|
"build": "tsc --build",
|
||||||
"start": "tsc --build --watch",
|
"start": "tsc --build --watch",
|
||||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
"lint:fix": "eslint src --fix",
|
||||||
"prepack": "pnpm run clean && pnpm run build"
|
"prepack": "pnpm run clean && pnpm run build"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(t|j)s?(x)": [
|
"*.(t|j)s?(x)": [
|
||||||
"eslint --fix"
|
"pnpm lint:fix"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,6 @@
|
||||||
"sourceRoot": "packages/js/admin-e2e-tests/src",
|
"sourceRoot": "packages/js/admin-e2e-tests/src",
|
||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
"targets": {
|
"targets": {
|
||||||
"changelog": {
|
|
||||||
"executor": "./tools/executors/changelogger:changelog",
|
|
||||||
"options": {
|
|
||||||
"action": "add",
|
|
||||||
"cwd": "packages/js/admin-e2e-tests"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"build": {
|
"build": {
|
||||||
"executor": "@nrwl/workspace:run-script",
|
"executor": "@nrwl/workspace:run-script",
|
||||||
"options": {
|
"options": {
|
||||||
|
@ -33,12 +26,6 @@
|
||||||
"options": {
|
"options": {
|
||||||
"script": "clean"
|
"script": "clean"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"prepare": {
|
|
||||||
"executor": "@nrwl/workspace:run-script",
|
|
||||||
"options": {
|
|
||||||
"script": "prepare"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class WcSettings extends BasePage {
|
||||||
|
|
||||||
async paymentMethodIsEnabled( method = '' ): Promise< boolean > {
|
async paymentMethodIsEnabled( method = '' ): Promise< boolean > {
|
||||||
await this.navigate( 'checkout' );
|
await this.navigate( 'checkout' );
|
||||||
await waitForElementByText( 'h2', 'Payment methods' );
|
await waitForElementByText( 'th', 'Method' );
|
||||||
const className = await getAttribute(
|
const className = await getAttribute(
|
||||||
`tr[data-gateway_id=${ method }] .woocommerce-input-toggle`,
|
`tr[data-gateway_id=${ method }] .woocommerce-input-toggle`,
|
||||||
'className'
|
'className'
|
||||||
|
@ -58,7 +58,7 @@ export class WcSettings extends BasePage {
|
||||||
|
|
||||||
async cleanPaymentMethods(): Promise< void > {
|
async cleanPaymentMethods(): Promise< void > {
|
||||||
await this.navigate( 'checkout' );
|
await this.navigate( 'checkout' );
|
||||||
await waitForElementByText( 'h2', 'Payment methods' );
|
await waitForElementByText( 'th', 'Method' );
|
||||||
const paymentMethods = await page.$$( 'span.woocommerce-input-toggle' );
|
const paymentMethods = await page.$$( 'span.woocommerce-input-toggle' );
|
||||||
for ( const method of paymentMethods ) {
|
for ( const method of paymentMethods ) {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
|
||||||
|
};
|
|
@ -38,7 +38,7 @@ report() {
|
||||||
if [[ $REPORT_EXIT_CODE -eq 0 && $GITHUB_ACTIONS != "true" ]]; then
|
if [[ $REPORT_EXIT_CODE -eq 0 && $GITHUB_ACTIONS != "true" ]]; then
|
||||||
echo "To view the report on your browser, run:"
|
echo "To view the report on your browser, run:"
|
||||||
echo ""
|
echo ""
|
||||||
echo "pnpx allure open \"$ALLURE_REPORT_DIR\""
|
echo "pnpm dlx allure open \"$ALLURE_REPORT_DIR\""
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize linting: Ensure e2e packages are lintable
|
|
@ -0,0 +1,5 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
Comment: This is only updating monorepo infrastructure.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { customerBilling, customerShipping } = require('./shared');
|
const { customerBilling, customerShipping } = require( './shared' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic order.
|
* A basic order.
|
||||||
|
@ -53,10 +53,10 @@ const couponLines = {
|
||||||
/**
|
/**
|
||||||
* Builds an example order request.
|
* Builds an example order request.
|
||||||
*
|
*
|
||||||
* @returns {Object} Sample Order payload.
|
* @return {Object} Sample Order payload.
|
||||||
*/
|
*/
|
||||||
const getOrderExample = () => {
|
const getOrderExample = () => {
|
||||||
let orderExample = {
|
const orderExample = {
|
||||||
id: 0,
|
id: 0,
|
||||||
payment_method: 'cod',
|
payment_method: 'cod',
|
||||||
payment_method_title: 'Cash on Delivery',
|
payment_method_title: 'Cash on Delivery',
|
||||||
|
@ -73,7 +73,7 @@ const getOrderExample = () => {
|
||||||
coupon_lines: [ couponLines ],
|
coupon_lines: [ couponLines ],
|
||||||
};
|
};
|
||||||
return orderExample;
|
return orderExample;
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
order,
|
order,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,12 +3,12 @@
|
||||||
*
|
*
|
||||||
* Note that by default the update endpoint is limited to 100 objects to be created, updated, or deleted.
|
* Note that by default the update endpoint is limited to 100 objects to be created, updated, or deleted.
|
||||||
*
|
*
|
||||||
* @param {string} action Batch action. Must be one of: create, update, or delete.
|
* @param {string} action Batch action. Must be one of: create, update, or delete.
|
||||||
* @param {Array} resources A list of resource objects. For the delete action, this will be a list of IDs.
|
* @param {Array} resources A list of resource objects. For the delete action, this will be a list of IDs.
|
||||||
* @param {Object} payload The batch payload object. Defaults to an empty object.
|
* @param {Object} payload The batch payload object. Defaults to an empty object.
|
||||||
* @returns {Object} The payload to send to the batch endpoint.
|
* @return {Object} The payload to send to the batch endpoint.
|
||||||
*/
|
*/
|
||||||
const batch = ( action, resources = [], payload = {} ) => {
|
const batch = ( action, resources = [], payload = {} ) => {
|
||||||
if ( ! [ 'create', 'update', 'delete' ].includes( action ) ) {
|
if ( ! [ 'create', 'update', 'delete' ].includes( action ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ const errorResponse = {
|
||||||
code: '',
|
code: '',
|
||||||
message: '',
|
message: '',
|
||||||
data: {
|
data: {
|
||||||
status: 400
|
status: 400,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
const { customerBilling, customerShipping } = require('./customer');
|
const { customerBilling, customerShipping } = require( './customer' );
|
||||||
const {
|
const { batch, getBatchPayloadExample } = require( './batch-update' );
|
||||||
batch,
|
const { errorResponse } = require( './error-response' );
|
||||||
getBatchPayloadExample
|
|
||||||
} = require('./batch-update');
|
|
||||||
const { errorResponse } = require('./error-response');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
customerBilling,
|
customerBilling,
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
* - `flat_rate`
|
* - `flat_rate`
|
||||||
* - `local_pickup`
|
* - `local_pickup`
|
||||||
*
|
*
|
||||||
* @returns shipping method object that can serve as a request payload for adding a shipping method to a shipping zone.
|
* @param methodId
|
||||||
|
* @param cost
|
||||||
|
* @return shipping method object that can serve as a request payload for adding a shipping method to a shipping zone.
|
||||||
*/
|
*/
|
||||||
const getShippingMethodExample = ( methodId, cost ) => {
|
const getShippingMethodExample = ( methodId, cost ) => {
|
||||||
const shippingMethodExample = {
|
const shippingMethodExample = {
|
||||||
|
@ -15,7 +17,7 @@ const getShippingMethodExample = ( methodId, cost ) => {
|
||||||
|
|
||||||
if ( cost !== undefined ) {
|
if ( cost !== undefined ) {
|
||||||
shippingMethodExample.settings = {
|
shippingMethodExample.settings = {
|
||||||
cost: cost,
|
cost,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ const shippingZone = {
|
||||||
/**
|
/**
|
||||||
* Constructs a default shipping zone object.
|
* Constructs a default shipping zone object.
|
||||||
*
|
*
|
||||||
* @returns default shipping zone
|
* @return default shipping zone
|
||||||
*/
|
*/
|
||||||
const getShippingZoneExample = () => {
|
const getShippingZoneExample = () => {
|
||||||
return shippingZone;
|
return shippingZone;
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
const { getRequest, postRequest, putRequest, deleteRequest } = require('../utils/request');
|
const {
|
||||||
const { coupon, shared } = require('../data');
|
getRequest,
|
||||||
|
postRequest,
|
||||||
|
putRequest,
|
||||||
|
deleteRequest,
|
||||||
|
} = require( '../utils/request' );
|
||||||
|
const { coupon, shared } = require( '../data' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WooCommerce Coupon endpoints.
|
* WooCommerce Coupon endpoints.
|
||||||
|
@ -17,14 +22,15 @@ const couponsApi = {
|
||||||
path: 'coupons',
|
path: 'coupons',
|
||||||
responseCode: 201,
|
responseCode: 201,
|
||||||
payload: coupon,
|
payload: coupon,
|
||||||
coupon: async ( couponDetails ) => postRequest( 'coupons', couponDetails ),
|
coupon: async ( couponDetails ) =>
|
||||||
|
postRequest( 'coupons', couponDetails ),
|
||||||
},
|
},
|
||||||
retrieve: {
|
retrieve: {
|
||||||
name: 'Retrieve a coupon',
|
name: 'Retrieve a coupon',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: 'coupons/<id>',
|
path: 'coupons/<id>',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
coupon: async ( couponId ) => getRequest( `coupons/${couponId}` ),
|
coupon: async ( couponId ) => getRequest( `coupons/${ couponId }` ),
|
||||||
},
|
},
|
||||||
listAll: {
|
listAll: {
|
||||||
name: 'List all coupons',
|
name: 'List all coupons',
|
||||||
|
@ -39,7 +45,8 @@ const couponsApi = {
|
||||||
path: 'coupons/<id>',
|
path: 'coupons/<id>',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
payload: coupon,
|
payload: coupon,
|
||||||
coupon: async ( couponId, couponDetails ) => putRequest( `coupons/${couponId}`, couponDetails ),
|
coupon: async ( couponId, couponDetails ) =>
|
||||||
|
putRequest( `coupons/${ couponId }`, couponDetails ),
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
name: 'Delete a coupon',
|
name: 'Delete a coupon',
|
||||||
|
@ -47,9 +54,10 @@ const couponsApi = {
|
||||||
path: 'coupons/<id>',
|
path: 'coupons/<id>',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
payload: {
|
payload: {
|
||||||
force: false
|
force: false,
|
||||||
},
|
},
|
||||||
coupon: async ( couponId, deletePermanently ) => deleteRequest( `coupons/${couponId}`, deletePermanently ),
|
coupon: async ( couponId, deletePermanently ) =>
|
||||||
|
deleteRequest( `coupons/${ couponId }`, deletePermanently ),
|
||||||
},
|
},
|
||||||
batch: {
|
batch: {
|
||||||
name: 'Batch update coupons',
|
name: 'Batch update coupons',
|
||||||
|
@ -57,8 +65,9 @@ const couponsApi = {
|
||||||
path: 'coupons/batch',
|
path: 'coupons/batch',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
payload: shared.getBatchPayloadExample( coupon ),
|
payload: shared.getBatchPayloadExample( coupon ),
|
||||||
coupons: async ( batchUpdatePayload ) => postRequest( `coupons/batch`, batchUpdatePayload ),
|
coupons: async ( batchUpdatePayload ) =>
|
||||||
|
postRequest( `coupons/batch`, batchUpdatePayload ),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { couponsApi };
|
module.exports = { couponsApi };
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
const { getRequest, postRequest, putRequest, deleteRequest } = require('../utils/request');
|
const {
|
||||||
|
getRequest,
|
||||||
|
postRequest,
|
||||||
|
putRequest,
|
||||||
|
deleteRequest,
|
||||||
|
} = require( '../utils/request' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WooCommerce Products endpoints.
|
* WooCommerce Products endpoints.
|
||||||
|
@ -15,28 +20,31 @@ const productsApi = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
path: 'products',
|
path: 'products',
|
||||||
responseCode: 201,
|
responseCode: 201,
|
||||||
product: async ( productDetails ) => postRequest( 'products', productDetails ),
|
product: async ( productDetails ) =>
|
||||||
|
postRequest( 'products', productDetails ),
|
||||||
},
|
},
|
||||||
retrieve: {
|
retrieve: {
|
||||||
name: 'Retrieve a product',
|
name: 'Retrieve a product',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: 'products/<id>',
|
path: 'products/<id>',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
product: async ( productId ) => getRequest( `products/${productId}` ),
|
product: async ( productId ) => getRequest( `products/${ productId }` ),
|
||||||
},
|
},
|
||||||
listAll: {
|
listAll: {
|
||||||
name: 'List all products',
|
name: 'List all products',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path: 'products',
|
path: 'products',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
products: async ( productsQuery = {} ) => getRequest( 'products', productsQuery ),
|
products: async ( productsQuery = {} ) =>
|
||||||
|
getRequest( 'products', productsQuery ),
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
name: 'Update a product',
|
name: 'Update a product',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
path: 'products/<id>',
|
path: 'products/<id>',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
product: async ( productId, productDetails ) => putRequest( `products/${productId}`, productDetails ),
|
product: async ( productId, productDetails ) =>
|
||||||
|
putRequest( `products/${ productId }`, productDetails ),
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
name: 'Delete a product',
|
name: 'Delete a product',
|
||||||
|
@ -44,16 +52,18 @@ const productsApi = {
|
||||||
path: 'products/<id>',
|
path: 'products/<id>',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
payload: {
|
payload: {
|
||||||
force: false
|
force: false,
|
||||||
},
|
},
|
||||||
product: async ( productId, deletePermanently ) => deleteRequest( `products/${productId}`, deletePermanently ),
|
product: async ( productId, deletePermanently ) =>
|
||||||
|
deleteRequest( `products/${ productId }`, deletePermanently ),
|
||||||
},
|
},
|
||||||
batch: {
|
batch: {
|
||||||
name: 'Batch update products',
|
name: 'Batch update products',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
path: 'products/batch',
|
path: 'products/batch',
|
||||||
responseCode: 200,
|
responseCode: 200,
|
||||||
products: async ( batchUpdatePayload ) => postRequest( `products/batch`, batchUpdatePayload ),
|
products: async ( batchUpdatePayload ) =>
|
||||||
|
postRequest( `products/batch`, batchUpdatePayload ),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,5 +55,5 @@ const refundsApi = {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
refundsApi: refundsApi,
|
refundsApi,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,42 +1,49 @@
|
||||||
{
|
{
|
||||||
"name": "@woocommerce/api-core-tests",
|
"name": "@woocommerce/api-core-tests",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "API tests for WooCommerce",
|
"description": "API tests for WooCommerce",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest",
|
"postinstall": "composer install",
|
||||||
"test:api": "jest --group=api",
|
"test": "jest",
|
||||||
"test:hello": "jest --group=hello",
|
"test:api": "jest --group=api",
|
||||||
"make:collection": "node utils/api-collection/build-collection.js",
|
"test:hello": "jest --group=hello",
|
||||||
"report": "allure generate --clean && allure serve"
|
"make:collection": "node utils/api-collection/build-collection.js",
|
||||||
},
|
"report": "allure generate --clean && allure serve",
|
||||||
"repository": {
|
"lint": "eslint data endpoints tests utils --ext=js,ts,tsx",
|
||||||
"type": "git",
|
"lint:fix": "eslint data endpoints tests utils --ext=js,ts,tsx --fix"
|
||||||
"url": "git+https://github.com/woocommerce/woocommerce.git"
|
},
|
||||||
},
|
"repository": {
|
||||||
"license": "GPL-3.0+",
|
"type": "git",
|
||||||
"bugs": {
|
"url": "git+https://github.com/woocommerce/woocommerce.git"
|
||||||
"url": "https://github.com/woocommerce/woocommerce/issues"
|
},
|
||||||
},
|
"license": "GPL-3.0+",
|
||||||
"homepage": "https://github.com/woocommerce/woocommerce#readme",
|
"bugs": {
|
||||||
"dependencies": {
|
"url": "https://github.com/woocommerce/woocommerce/issues"
|
||||||
"allure-commandline": "^2.17.2",
|
},
|
||||||
"dotenv": "^10.0.0",
|
"homepage": "https://github.com/woocommerce/woocommerce#readme",
|
||||||
"jest": "^25.1.0",
|
"dependencies": {
|
||||||
"jest-allure": "^0.1.3",
|
"allure-commandline": "^2.17.2",
|
||||||
"jest-runner-groups": "^2.1.0",
|
"dotenv": "^10.0.0",
|
||||||
"postman-collection": "^4.1.0",
|
"jest": "^25.1.0",
|
||||||
"supertest": "^6.1.4"
|
"jest-allure": "^0.1.3",
|
||||||
},
|
"jest-runner-groups": "^2.1.0",
|
||||||
"publishConfig": {
|
"postman-collection": "^4.1.0",
|
||||||
"access": "public"
|
"supertest": "^6.1.4"
|
||||||
},
|
},
|
||||||
"bin": {
|
"devDependencies": {
|
||||||
"wc-api-tests": "bin/wc-api-tests.sh"
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
},
|
"eslint": "^8.12.0"
|
||||||
"lint-staged": {
|
},
|
||||||
"*.(t|j)s?(x)": [
|
"publishConfig": {
|
||||||
"eslint --fix"
|
"access": "public"
|
||||||
]
|
},
|
||||||
}
|
"bin": {
|
||||||
|
"wc-api-tests": "bin/wc-api-tests.sh"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.(t|j)s?(x)": [
|
||||||
|
"eslint --fix"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { getRequest } = require('../../utils/request');
|
const { getRequest } = require( '../../utils/request' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests to verify connection to the API.
|
* Tests to verify connection to the API.
|
||||||
|
@ -6,16 +6,14 @@ const { getRequest } = require('../../utils/request');
|
||||||
* @group hello
|
* @group hello
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
describe('Test API connectivity', () => {
|
describe( 'Test API connectivity', () => {
|
||||||
|
it( 'can access a non-authenticated endpoint', async () => {
|
||||||
it('can access a non-authenticated endpoint', async () => {
|
|
||||||
const result = await getRequest( '' );
|
const result = await getRequest( '' );
|
||||||
expect( result.statusCode ).toEqual( 200 );
|
expect( result.statusCode ).toEqual( 200 );
|
||||||
});
|
} );
|
||||||
|
|
||||||
it('can access an authenticated endpoint', async () => {
|
it( 'can access an authenticated endpoint', async () => {
|
||||||
const result = await getRequest( 'system_status' );
|
const result = await getRequest( 'system_status' );
|
||||||
expect( result.statusCode ).toEqual( 200 );
|
expect( result.statusCode ).toEqual( 200 );
|
||||||
});
|
} );
|
||||||
|
} );
|
||||||
});
|
|
||||||
|
|
|
@ -341,39 +341,36 @@ describe( 'Orders API tests', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const verifyOrderPrecision = ( order, dp ) => {
|
const verifyOrderPrecision = ( order, dp ) => {
|
||||||
expectPrecisionToMatch( order[ 'discount_total' ], dp );
|
expectPrecisionToMatch( order.discount_total, dp );
|
||||||
expectPrecisionToMatch( order[ 'discount_tax' ], dp );
|
expectPrecisionToMatch( order.discount_tax, dp );
|
||||||
expectPrecisionToMatch( order[ 'shipping_total' ], dp );
|
expectPrecisionToMatch( order.shipping_total, dp );
|
||||||
expectPrecisionToMatch( order[ 'shipping_tax' ], dp );
|
expectPrecisionToMatch( order.shipping_tax, dp );
|
||||||
expectPrecisionToMatch( order[ 'cart_tax' ], dp );
|
expectPrecisionToMatch( order.cart_tax, dp );
|
||||||
expectPrecisionToMatch( order[ 'total' ], dp );
|
expectPrecisionToMatch( order.total, dp );
|
||||||
expectPrecisionToMatch( order[ 'total_tax' ], dp );
|
expectPrecisionToMatch( order.total_tax, dp );
|
||||||
|
|
||||||
order[ 'line_items' ].forEach( ( lineItem ) => {
|
order.line_items.forEach( ( lineItem ) => {
|
||||||
expectPrecisionToMatch( lineItem[ 'total' ], dp );
|
expectPrecisionToMatch( lineItem.total, dp );
|
||||||
expectPrecisionToMatch( lineItem[ 'total_tax' ], dp );
|
expectPrecisionToMatch( lineItem.total_tax, dp );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
order[ 'tax_lines' ].forEach( ( taxLine ) => {
|
order.tax_lines.forEach( ( taxLine ) => {
|
||||||
expectPrecisionToMatch( taxLine[ 'tax_total' ], dp );
|
expectPrecisionToMatch( taxLine.tax_total, dp );
|
||||||
expectPrecisionToMatch(
|
expectPrecisionToMatch( taxLine.shipping_tax_total, dp );
|
||||||
taxLine[ 'shipping_tax_total' ],
|
|
||||||
dp
|
|
||||||
);
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
order[ 'shipping_lines' ].forEach( ( shippingLine ) => {
|
order.shipping_lines.forEach( ( shippingLine ) => {
|
||||||
expectPrecisionToMatch( shippingLine[ 'total' ], dp );
|
expectPrecisionToMatch( shippingLine.total, dp );
|
||||||
expectPrecisionToMatch( shippingLine[ 'total_tax' ], dp );
|
expectPrecisionToMatch( shippingLine.total_tax, dp );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
order[ 'fee_lines' ].forEach( ( feeLine ) => {
|
order.fee_lines.forEach( ( feeLine ) => {
|
||||||
expectPrecisionToMatch( feeLine[ 'total' ], dp );
|
expectPrecisionToMatch( feeLine.total, dp );
|
||||||
expectPrecisionToMatch( feeLine[ 'total_tax' ], dp );
|
expectPrecisionToMatch( feeLine.total_tax, dp );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
order[ 'refunds' ].forEach( ( refund ) => {
|
order.refunds.forEach( ( refund ) => {
|
||||||
expectPrecisionToMatch( refund[ 'total' ], dp );
|
expectPrecisionToMatch( refund.total, dp );
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,7 @@
|
||||||
const fs = require('fs');
|
const fs = require( 'fs' );
|
||||||
const { Collection, ItemGroup, Item } = require('postman-collection');
|
const { Collection, ItemGroup, Item } = require( 'postman-collection' );
|
||||||
require('dotenv').config();
|
require( 'dotenv' ).config();
|
||||||
const {
|
const { BASE_URL, USER_KEY, USER_SECRET, USE_INDEX_PERMALINKS } = process.env;
|
||||||
BASE_URL,
|
|
||||||
USER_KEY,
|
|
||||||
USER_SECRET,
|
|
||||||
USE_INDEX_PERMALINKS
|
|
||||||
} = process.env;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a Postman collection using the API testing objects.
|
* Build a Postman collection using the API testing objects.
|
||||||
|
@ -17,10 +12,10 @@ const {
|
||||||
|
|
||||||
// Set up our empty collection
|
// Set up our empty collection
|
||||||
if ( typeof USER_KEY === 'undefined' ) {
|
if ( typeof USER_KEY === 'undefined' ) {
|
||||||
console.log('No USER_KEY was defined.');
|
console.log( 'No USER_KEY was defined.' );
|
||||||
}
|
}
|
||||||
if ( typeof USER_SECRET === 'undefined' ) {
|
if ( typeof USER_SECRET === 'undefined' ) {
|
||||||
console.log('No USER_SECRET was defined.');
|
console.log( 'No USER_SECRET was defined.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
const postmanCollection = new Collection( {
|
const postmanCollection = new Collection( {
|
||||||
|
@ -30,74 +25,72 @@ const postmanCollection = new Collection( {
|
||||||
{
|
{
|
||||||
key: 'username',
|
key: 'username',
|
||||||
value: USER_KEY,
|
value: USER_KEY,
|
||||||
type: 'string'
|
type: 'string',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'password',
|
key: 'password',
|
||||||
value: USER_SECRET,
|
value: USER_SECRET,
|
||||||
type: 'string'
|
type: 'string',
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
name: 'WooCommerce API - v3'
|
name: 'WooCommerce API - v3',
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Get the API url
|
// Get the API url
|
||||||
if ( typeof BASE_URL === 'undefined' ) {
|
if ( typeof BASE_URL === 'undefined' ) {
|
||||||
console.log('No BASE_URL was defined.');
|
console.log( 'No BASE_URL was defined.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the API path if the `USE_INDEX_PERMALINKS` flag is set
|
// Update the API path if the `USE_INDEX_PERMALINKS` flag is set
|
||||||
const useIndexPermalinks = ( USE_INDEX_PERMALINKS === 'true' );
|
const useIndexPermalinks = USE_INDEX_PERMALINKS === 'true';
|
||||||
let apiPath = `${BASE_URL}/?rest_route=/wc/v3`;
|
let apiPath = `${ BASE_URL }/?rest_route=/wc/v3`;
|
||||||
if ( useIndexPermalinks ) {
|
if ( useIndexPermalinks ) {
|
||||||
apiPath = `${BASE_URL}/wp-json/wc/v3`;
|
apiPath = `${ BASE_URL }/wp-json/wc/v3`;
|
||||||
}
|
}
|
||||||
// Set this here for use in `request.js`
|
// Set this here for use in `request.js`
|
||||||
global.API_PATH = `${apiPath}/`;
|
global.API_PATH = `${ apiPath }/`;
|
||||||
|
|
||||||
// Add the API path has a collection variable
|
// Add the API path has a collection variable
|
||||||
postmanCollection.variables.add({
|
postmanCollection.variables.add( {
|
||||||
id: 'apiBaseUrl',
|
id: 'apiBaseUrl',
|
||||||
value: apiPath,
|
value: apiPath,
|
||||||
type: 'string',
|
type: 'string',
|
||||||
});
|
} );
|
||||||
|
|
||||||
// Get the API request data
|
// Get the API request data
|
||||||
const resources = require('../../endpoints');
|
const resources = require( '../../endpoints' );
|
||||||
resourceKeys = Object.keys( resources );
|
resourceKeys = Object.keys( resources );
|
||||||
|
|
||||||
// Add the requests to folders in the collection
|
// Add the requests to folders in the collection
|
||||||
for ( const key in resources ) {
|
for ( const key in resources ) {
|
||||||
|
|
||||||
const folder = new ItemGroup( {
|
const folder = new ItemGroup( {
|
||||||
name: resources[key].name,
|
name: resources[ key ].name,
|
||||||
items: []
|
items: [],
|
||||||
} );
|
} );
|
||||||
|
|
||||||
for ( const endpoint in resources[key] ) {
|
for ( const endpoint in resources[ key ] ) {
|
||||||
|
const api = resources[ key ][ endpoint ];
|
||||||
let api = resources[key][endpoint];
|
|
||||||
|
|
||||||
// If there is no name defined, continue
|
// If there is no name defined, continue
|
||||||
if ( !api.name ) {
|
if ( ! api.name ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = new Item( {
|
const request = new Item( {
|
||||||
name: api.name,
|
name: api.name,
|
||||||
request: {
|
request: {
|
||||||
url: `{{apiBaseUrl}}/${api.path}`,
|
url: `{{apiBaseUrl}}/${ api.path }`,
|
||||||
method: api.method,
|
method: api.method,
|
||||||
body: {
|
body: {
|
||||||
mode: 'raw',
|
mode: 'raw',
|
||||||
raw: JSON.stringify( api.payload ),
|
raw: JSON.stringify( api.payload ),
|
||||||
options: {
|
options: {
|
||||||
raw: { language: 'json' }
|
raw: { language: 'json' },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
folder.items.add( request );
|
folder.items.add( request );
|
||||||
|
@ -110,9 +103,13 @@ for ( const key in resources ) {
|
||||||
const collectionJSON = postmanCollection.toJSON();
|
const collectionJSON = postmanCollection.toJSON();
|
||||||
|
|
||||||
// Create a colleciton.json file. It can be imported to postman
|
// Create a colleciton.json file. It can be imported to postman
|
||||||
fs.writeFile('./collection.json', JSON.stringify( collectionJSON ), ( err ) => {
|
fs.writeFile(
|
||||||
if ( err ) {
|
'./collection.json',
|
||||||
console.log( err );
|
JSON.stringify( collectionJSON ),
|
||||||
|
( err ) => {
|
||||||
|
if ( err ) {
|
||||||
|
console.log( err );
|
||||||
|
}
|
||||||
|
console.log( 'File saved!' );
|
||||||
}
|
}
|
||||||
console.log('File saved!');
|
);
|
||||||
});
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
require('dotenv').config();
|
require( 'dotenv' ).config();
|
||||||
const { USER_KEY, USER_SECRET } = process.env;
|
const { USER_KEY, USER_SECRET } = process.env;
|
||||||
const request = require('supertest')( API_PATH );
|
const request = require( 'supertest' )( API_PATH );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a GET request.
|
* Make a GET request.
|
||||||
*
|
*
|
||||||
* @param {string} requestPath The path of the request.
|
* @param {string} requestPath The path of the request.
|
||||||
* @param {object} queryString Optional. An object of one or more `key: value` query string parameters.
|
* @param {Object} queryString Optional. An object of one or more `key: value` query string parameters.
|
||||||
* @returns {Response}
|
* @return {Response}
|
||||||
*/
|
*/
|
||||||
const getRequest = async ( requestPath, queryString = {} ) => {
|
const getRequest = async ( requestPath, queryString = {} ) => {
|
||||||
const response = await request
|
const response = await request
|
||||||
|
@ -22,8 +22,8 @@ const getRequest = async ( requestPath, queryString = {} ) => {
|
||||||
* Make a POST request.
|
* Make a POST request.
|
||||||
*
|
*
|
||||||
* @param {string} requestPath The path of the request.
|
* @param {string} requestPath The path of the request.
|
||||||
* @param {object} requestBody The body of the request to submit.
|
* @param {Object} requestBody The body of the request to submit.
|
||||||
* @returns {Response}
|
* @return {Response}
|
||||||
*/
|
*/
|
||||||
const postRequest = async ( requestPath, requestBody ) => {
|
const postRequest = async ( requestPath, requestBody ) => {
|
||||||
const response = await request
|
const response = await request
|
||||||
|
@ -38,8 +38,8 @@ const postRequest = async ( requestPath, requestBody ) => {
|
||||||
* Make a PUT request.
|
* Make a PUT request.
|
||||||
*
|
*
|
||||||
* @param {string} requestPath The path of the request.
|
* @param {string} requestPath The path of the request.
|
||||||
* @param {object} requestBody The body of the request to submit.
|
* @param {Object} requestBody The body of the request to submit.
|
||||||
* @returns {Request}
|
* @return {Request}
|
||||||
*/
|
*/
|
||||||
const putRequest = async ( requestPath, requestBody ) => {
|
const putRequest = async ( requestPath, requestBody ) => {
|
||||||
const response = await request
|
const response = await request
|
||||||
|
@ -53,12 +53,12 @@ const putRequest = async ( requestPath, requestBody ) => {
|
||||||
/**
|
/**
|
||||||
* Make a DELETE request, optionally deleting the resource permanently.
|
* Make a DELETE request, optionally deleting the resource permanently.
|
||||||
*
|
*
|
||||||
* @param {string} requestPath The path of the request.
|
* @param {string} requestPath The path of the request.
|
||||||
* @param {boolean} deletePermanently Flag to permanently delete the resource.
|
* @param {boolean} deletePermanently Flag to permanently delete the resource.
|
||||||
* @returns {Response}
|
* @return {Response}
|
||||||
*/
|
*/
|
||||||
const deleteRequest = async ( requestPath, deletePermanently = false ) => {
|
const deleteRequest = async ( requestPath, deletePermanently = false ) => {
|
||||||
const requestBody = deletePermanently ? { force: true } : {}
|
const requestBody = deletePermanently ? { force: true } : {};
|
||||||
const response = await request
|
const response = await request
|
||||||
.delete( requestPath )
|
.delete( requestPath )
|
||||||
.set( 'Accept', 'application/json' )
|
.set( 'Accept', 'application/json' )
|
||||||
|
@ -67,4 +67,4 @@ const deleteRequest = async ( requestPath, deletePermanently = false ) => {
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { getRequest, postRequest, putRequest, deleteRequest }
|
module.exports = { getRequest, postRequest, putRequest, deleteRequest };
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,5 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
Comment: This is only updating monorepo infrastructure commands.
|
||||||
|
|
||||||
|
|
|
@ -1,61 +1,63 @@
|
||||||
{
|
{
|
||||||
"name": "@woocommerce/api",
|
"name": "@woocommerce/api",
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"author": "Automattic",
|
"author": "Automattic",
|
||||||
"description": "A simple interface for interacting with a WooCommerce installation.",
|
"description": "A simple interface for interacting with a WooCommerce installation.",
|
||||||
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/api/README.md",
|
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/api/README.md",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/woocommerce/woocommerce.git"
|
"url": "https://github.com/woocommerce/woocommerce.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"woocommerce",
|
"woocommerce",
|
||||||
"e2e"
|
"e2e"
|
||||||
],
|
],
|
||||||
"license": "GPL-3.0+",
|
"license": "GPL-3.0+",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"/dist/",
|
"/dist/",
|
||||||
"!*.ts.map",
|
"!*.ts.map",
|
||||||
"!*.tsbuildinfo",
|
"!*.tsbuildinfo",
|
||||||
"!/dist/**/__tests__/",
|
"!/dist/**/__tests__/",
|
||||||
"!/dist/**/__mocks__/",
|
"!/dist/**/__mocks__/",
|
||||||
"!/dist/**/__snapshops__/",
|
"!/dist/**/__snapshops__/",
|
||||||
"!/dist/**/__test_data__/"
|
"!/dist/**/__test_data__/"
|
||||||
],
|
],
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf ./dist ./tsconfig.tsbuildinfo",
|
"postinstall": "composer install",
|
||||||
"compile": "tsc -b",
|
"clean": "rm -rf ./dist ./tsconfig.tsbuildinfo",
|
||||||
"build": "pnpm run clean && npm run compile",
|
"compile": "tsc -b",
|
||||||
"prepare": "pnpm run build",
|
"build": "pnpm run clean && npm run compile",
|
||||||
"lint": "eslint src",
|
"prepack": "pnpm run build",
|
||||||
"test": "jest"
|
"lint": "eslint src",
|
||||||
},
|
"lint:fix": "eslint src --fix",
|
||||||
"dependencies": {
|
"test": "jest"
|
||||||
"axios": "^0.24.0",
|
},
|
||||||
"create-hmac": "1.1.7",
|
"dependencies": {
|
||||||
"oauth-1.0a": "2.2.6"
|
"axios": "^0.24.0",
|
||||||
},
|
"create-hmac": "1.1.7",
|
||||||
"devDependencies": {
|
"oauth-1.0a": "2.2.6"
|
||||||
"@types/create-hmac": "1.1.0",
|
},
|
||||||
"@types/jest": "^27.0.2",
|
"devDependencies": {
|
||||||
"@types/node": "13.13.5",
|
"@types/create-hmac": "1.1.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
"@types/jest": "^27.0.2",
|
||||||
"@typescript-eslint/parser": "^5.3.1",
|
"@types/node": "13.13.5",
|
||||||
"axios-mock-adapter": "^1.20.0",
|
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
||||||
"eslint": "^8.2.0",
|
"@typescript-eslint/parser": "^5.3.1",
|
||||||
"jest": "^25",
|
"axios-mock-adapter": "^1.20.0",
|
||||||
"ts-jest": "^25",
|
"eslint": "^8.2.0",
|
||||||
"typescript": "^4.4.4"
|
"jest": "^25",
|
||||||
},
|
"ts-jest": "^25",
|
||||||
"publishConfig": {
|
"typescript": "^4.4.4"
|
||||||
"access": "public"
|
},
|
||||||
},
|
"publishConfig": {
|
||||||
"lint-staged": {
|
"access": "public"
|
||||||
"*.(t|j)s?(x)": [
|
},
|
||||||
"eslint --fix"
|
"lint-staged": {
|
||||||
]
|
"*.(t|j)s?(x)": [
|
||||||
}
|
"pnpm lint:fix"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,6 @@
|
||||||
"script": "compile"
|
"script": "compile"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prepare": {
|
|
||||||
"executor": "@nrwl/workspace:run-script",
|
|
||||||
"options": {
|
|
||||||
"script": "prepare"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": {
|
"lint": {
|
||||||
"executor": "@nrwl/workspace:run-script",
|
"executor": "@nrwl/workspace:run-script",
|
||||||
"options": {
|
"options": {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
- Update dependency `@wordpress/hooks` to ^3.5.0
|
- Update dependency `@wordpress/hooks` to ^3.5.0
|
||||||
- Update dependency `@wordpress/icons` to ^8.1.0
|
- Update dependency `@wordpress/icons` to ^8.1.0
|
||||||
- Add `className` prop for Pill component. #32605
|
- Add `className` prop for Pill component. #32605
|
||||||
|
- Update `StepperProps` prop types. #32712
|
||||||
|
|
||||||
# 10.0.0
|
# 10.0.0
|
||||||
- Replace deprecated wp.compose.withState with wp.element.useState. #8338
|
- Replace deprecated wp.compose.withState with wp.element.useState. #8338
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/components",
|
||||||
|
"description": "WooCommerce JS component library",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-changelogger": "3.0.2"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"changelogger": {
|
||||||
|
"formatter": {
|
||||||
|
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"fix": "Fixes an existing bug",
|
||||||
|
"add": "Adds functionality",
|
||||||
|
"update": "Update existing functionality",
|
||||||
|
"dev": "Development related task",
|
||||||
|
"tweak": "A minor adjustment to the codebase",
|
||||||
|
"performance": "Address performance issues",
|
||||||
|
"enhancement": "Improve existing functionality"
|
||||||
|
},
|
||||||
|
"changelog": "NEXT_CHANGELOG.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -94,9 +94,9 @@
|
||||||
"@testing-library/jest-dom": "^5.16.2",
|
"@testing-library/jest-dom": "^5.16.2",
|
||||||
"@testing-library/react": "^12.1.3",
|
"@testing-library/react": "^12.1.3",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"@woocommerce/style-build": "workspace:*",
|
"@woocommerce/style-build": "workspace:*",
|
||||||
"@wordpress/browserslist-config": "^4.1.1",
|
"@wordpress/browserslist-config": "^4.1.1",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
|
||||||
"@wordpress/scripts": "^12.6.1",
|
"@wordpress/scripts": "^12.6.1",
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^7.0.0",
|
||||||
"css-loader": "^3.6.0",
|
"css-loader": "^3.6.0",
|
||||||
|
@ -112,11 +112,13 @@
|
||||||
"webpack-cli": "^3.3.12"
|
"webpack-cli": "^3.3.12"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "composer install",
|
||||||
"build": "pnpm run build:js && pnpm run build:css",
|
"build": "pnpm run build:js && pnpm run build:css",
|
||||||
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
||||||
"build:css": "webpack",
|
"build:css": "webpack",
|
||||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||||
"lint": "eslint src --ext=js,ts,tsx",
|
"lint": "eslint src --ext=js,ts,tsx",
|
||||||
|
"lint:fix": "eslint src --ext=js,ts,tsx --fix",
|
||||||
"prepack": "pnpm run clean && pnpm run build",
|
"prepack": "pnpm run clean && pnpm run build",
|
||||||
"start": "concurrently \"tsc --build ./tsconfig.json --watch\" \"webpack --watch\"",
|
"start": "concurrently \"tsc --build ./tsconfig.json --watch\" \"webpack --watch\"",
|
||||||
"test": "pnpm run build && pnpm run test:nobuild",
|
"test": "pnpm run build && pnpm run test:nobuild",
|
||||||
|
@ -126,7 +128,7 @@
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(t|j)s?(x)": [
|
"*.(t|j)s?(x)": [
|
||||||
"eslint --fix",
|
"pnpm lint:fix",
|
||||||
"pnpm test-staged"
|
"pnpm test-staged"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,9 @@ interface StepperProps {
|
||||||
onClick?: ( key: string ) => void;
|
onClick?: ( key: string ) => void;
|
||||||
} >;
|
} >;
|
||||||
/** If the stepper is vertical instead of horizontal. */
|
/** If the stepper is vertical instead of horizontal. */
|
||||||
isVertical: boolean;
|
isVertical?: boolean;
|
||||||
/** Optionally mark the current step as pending to show a spinner. */
|
/** Optionally mark the current step as pending to show a spinner. */
|
||||||
isPending: boolean;
|
isPending?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/csv-export",
|
||||||
|
"description": "WooCommerce CSV export package",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-changelogger": "3.0.2"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"changelogger": {
|
||||||
|
"formatter": {
|
||||||
|
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"fix": "Fixes an existing bug",
|
||||||
|
"add": "Adds functionality",
|
||||||
|
"update": "Update existing functionality",
|
||||||
|
"dev": "Development related task",
|
||||||
|
"tweak": "A minor adjustment to the codebase",
|
||||||
|
"performance": "Address performance issues",
|
||||||
|
"enhancement": "Improve existing functionality"
|
||||||
|
},
|
||||||
|
"changelog": "NEXT_CHANGELOG.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -28,18 +28,20 @@
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "composer install",
|
||||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||||
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
||||||
"start": "tsc --build --watch",
|
"start": "tsc --build --watch",
|
||||||
"prepack": "pnpm run clean && pnpm run build",
|
"prepack": "pnpm run clean && pnpm run build",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
"lint:fix": "eslint src --fix",
|
||||||
"test": "pnpm run build && pnpm run test:nobuild",
|
"test": "pnpm run build && pnpm run test:nobuild",
|
||||||
"test:nobuild": "jest --config ./jest.config.json",
|
"test:nobuild": "jest --config ./jest.config.json",
|
||||||
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.17.5",
|
"@babel/core": "^7.17.5",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"jest-cli": "^27.5.1",
|
"jest-cli": "^27.5.1",
|
||||||
|
@ -49,7 +51,7 @@
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(t|j)s?(x)": [
|
"*.(t|j)s?(x)": [
|
||||||
"eslint --fix",
|
"pnpm lint:fix",
|
||||||
"pnpm test-staged"
|
"pnpm test-staged"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/currency",
|
||||||
|
"description": "WooCommerce JS currency utils",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-changelogger": "3.0.2"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"changelogger": {
|
||||||
|
"formatter": {
|
||||||
|
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"fix": "Fixes an existing bug",
|
||||||
|
"add": "Adds functionality",
|
||||||
|
"update": "Update existing functionality",
|
||||||
|
"dev": "Development related task",
|
||||||
|
"tweak": "A minor adjustment to the codebase",
|
||||||
|
"performance": "Address performance issues",
|
||||||
|
"enhancement": "Improve existing functionality"
|
||||||
|
},
|
||||||
|
"changelog": "NEXT_CHANGELOG.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -31,18 +31,20 @@
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "composer install",
|
||||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||||
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
||||||
"start": "tsc --build --watch",
|
"start": "tsc --build --watch",
|
||||||
"prepack": "pnpm run clean && pnpm run build",
|
"prepack": "pnpm run clean && pnpm run build",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
"lint:fix": "eslint src --fix",
|
||||||
"test": "pnpm run build && pnpm run test:nobuild",
|
"test": "pnpm run build && pnpm run test:nobuild",
|
||||||
"test:nobuild": "jest --config ./jest.config.json",
|
"test:nobuild": "jest --config ./jest.config.json",
|
||||||
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.17.5",
|
"@babel/core": "^7.17.5",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"jest-cli": "^27.5.1",
|
"jest-cli": "^27.5.1",
|
||||||
|
@ -52,7 +54,7 @@
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(t|j)s?(x)": [
|
"*.(t|j)s?(x)": [
|
||||||
"eslint --fix",
|
"pnpm lint:fix",
|
||||||
"pnpm test-staged"
|
"pnpm test-staged"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/customer-effort-score",
|
||||||
|
"description": "WooCommerce utility to measure user effort.",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-changelogger": "3.0.2"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"changelogger": {
|
||||||
|
"formatter": {
|
||||||
|
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"fix": "Fixes an existing bug",
|
||||||
|
"add": "Adds functionality",
|
||||||
|
"update": "Update existing functionality",
|
||||||
|
"dev": "Development related task",
|
||||||
|
"tweak": "A minor adjustment to the codebase",
|
||||||
|
"performance": "Address performance issues",
|
||||||
|
"enhancement": "Improve existing functionality"
|
||||||
|
},
|
||||||
|
"changelog": "NEXT_CHANGELOG.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -40,8 +40,8 @@
|
||||||
"@types/prop-types": "^15.7.4",
|
"@types/prop-types": "^15.7.4",
|
||||||
"@types/wordpress__components": "^9.8.6",
|
"@types/wordpress__components": "^9.8.6",
|
||||||
"@woocommerce/style-build": "workspace:*",
|
"@woocommerce/style-build": "workspace:*",
|
||||||
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"@wordpress/browserslist-config": "^4.1.1",
|
"@wordpress/browserslist-config": "^4.1.1",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^7.0.0",
|
||||||
"css-loader": "^3.6.0",
|
"css-loader": "^3.6.0",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
"react-dom": "^17.0.0"
|
"react-dom": "^17.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "composer install",
|
||||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||||
"build": "pnpm run build:js && pnpm run build:css",
|
"build": "pnpm run build:js && pnpm run build:css",
|
||||||
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
||||||
|
@ -67,13 +68,14 @@
|
||||||
"start": "concurrently \"tsc --build --watch\" \"webpack --watch\"",
|
"start": "concurrently \"tsc --build --watch\" \"webpack --watch\"",
|
||||||
"prepack": "pnpm run clean && pnpm run build",
|
"prepack": "pnpm run clean && pnpm run build",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
"lint:fix": "eslint src --fix",
|
||||||
"test": "pnpm run build && pnpm run test:nobuild",
|
"test": "pnpm run build && pnpm run test:nobuild",
|
||||||
"test:nobuild": "jest --config ./jest.config.json",
|
"test:nobuild": "jest --config ./jest.config.json",
|
||||||
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(t|j)s?(x)": [
|
"*.(t|j)s?(x)": [
|
||||||
"eslint --fix",
|
"pnpm lint:fix",
|
||||||
"pnpm test-staged"
|
"pnpm test-staged"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
- Update dependency `@wordpress/hooks` to ^3.5.0
|
- Update dependency `@wordpress/hooks` to ^3.5.0
|
||||||
- Add `is_offline` attribute for `Plugin` type. #32467
|
- Add `is_offline` attribute for `Plugin` type. #32467
|
||||||
- Added Typescript type declarations. #32615
|
- Added Typescript type declarations. #32615
|
||||||
- Update type definitions. #32683, #32695
|
- Update type definitions. #32683, #32695, #32698, #32712
|
||||||
- Make `isResolving` param `args` optional.
|
- Make `isResolving` param `args` optional.
|
||||||
- Update `Plugin` type to reflect the latest changes.
|
- Update `Plugin` type to reflect the latest changes.
|
||||||
- Maps "raw" payment `ActionDispatchers` to the registered actions.
|
- Maps "raw" payment `ActionDispatchers` to the registered actions.
|
||||||
- Add `getTaskListsByIds` selector type
|
- Export `getTaskListsByIds`, `getTaskLists`, `getTaskList`, `getFreeExtensions` onboarding selector types
|
||||||
- Update `TaskType` & `TaskListType` types
|
- Update `TaskType` & `TaskListType` types
|
||||||
|
- Export `InstallPluginsResponse` type
|
||||||
- Convert `use-user-preferences.js` to TS. #32695
|
- Convert `use-user-preferences.js` to TS. #32695
|
||||||
|
- Added PaymentGateway type to exports #32697
|
||||||
|
- Add `@types/wordpress__compose`, `@types/wordpress__data`, `redux` types and fix related type errors. #32735
|
||||||
|
|
||||||
## Breaking change
|
## Breaking change
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Add Jetpack Changelogger
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Standardize lint scripts: add lint:fix
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "woocommerce/data",
|
||||||
|
"description": "WooCommerce Admin data store and utilities",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require-dev": {
|
||||||
|
"automattic/jetpack-changelogger": "3.0.2"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"changelogger": {
|
||||||
|
"formatter": {
|
||||||
|
"filename": "../../../tools/changelogger/PackageFormatter.php"
|
||||||
|
},
|
||||||
|
"types": {
|
||||||
|
"fix": "Fixes an existing bug",
|
||||||
|
"add": "Adds functionality",
|
||||||
|
"update": "Update existing functionality",
|
||||||
|
"dev": "Development related task",
|
||||||
|
"tweak": "A minor adjustment to the codebase",
|
||||||
|
"performance": "Address performance issues",
|
||||||
|
"enhancement": "Improve existing functionality"
|
||||||
|
},
|
||||||
|
"changelog": "NEXT_CHANGELOG.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -48,12 +48,15 @@
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@testing-library/react": "^12.1.3",
|
"@testing-library/react": "^12.1.3",
|
||||||
"@testing-library/react-hooks": "^7.0.2",
|
"@testing-library/react-hooks": "^7.0.2",
|
||||||
|
"@types/wordpress__compose": "^4.0.1",
|
||||||
"@types/wordpress__core-data": "^2.4.5",
|
"@types/wordpress__core-data": "^2.4.5",
|
||||||
|
"@types/wordpress__data": "^6.0.0",
|
||||||
"@types/wordpress__data-controls": "^2.2.0",
|
"@types/wordpress__data-controls": "^2.2.0",
|
||||||
"@wordpress/eslint-plugin": "^11.0.0",
|
"@woocommerce/eslint-plugin": "workspace:*",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "^8.12.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"jest-cli": "^27.5.1",
|
"jest-cli": "^27.5.1",
|
||||||
|
"redux": "^4.1.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"ts-jest": "^27.1.3",
|
"ts-jest": "^27.1.3",
|
||||||
"typescript": "^4.6.2"
|
"typescript": "^4.6.2"
|
||||||
|
@ -65,18 +68,20 @@
|
||||||
"react-dom": "^17.0.0"
|
"react-dom": "^17.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"postinstall": "composer install",
|
||||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||||
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
"build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
|
||||||
"start": "tsc --build --watch",
|
"start": "tsc --build --watch",
|
||||||
"prepack": "pnpm run clean && pnpm run build",
|
"prepack": "pnpm run clean && pnpm run build",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
"lint:fix": "eslint src --fix",
|
||||||
"test": "pnpm run build && pnpm run test:nobuild",
|
"test": "pnpm run build && pnpm run test:nobuild",
|
||||||
"test:nobuild": "jest --config ./jest.config.json",
|
"test:nobuild": "jest --config ./jest.config.json",
|
||||||
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(t|j)s?(x)": [
|
"*.(t|j)s?(x)": [
|
||||||
"eslint --fix",
|
"pnpm lint:fix",
|
||||||
"pnpm test-staged"
|
"pnpm test-staged"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,28 +7,35 @@ import { RestApiError } from '../types';
|
||||||
|
|
||||||
export function getLocalesSuccess( locales: Locales ) {
|
export function getLocalesSuccess( locales: Locales ) {
|
||||||
return {
|
return {
|
||||||
type: TYPES.GET_LOCALES_SUCCESS,
|
type: TYPES.GET_LOCALES_SUCCESS as const,
|
||||||
locales,
|
locales,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLocalesError( error: RestApiError ) {
|
export function getLocalesError( error: RestApiError ) {
|
||||||
return {
|
return {
|
||||||
type: TYPES.GET_LOCALES_ERROR,
|
type: TYPES.GET_LOCALES_ERROR as const,
|
||||||
error,
|
error,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCountriesSuccess( countries: Country[] ) {
|
export function getCountriesSuccess( countries: Country[] ) {
|
||||||
return {
|
return {
|
||||||
type: TYPES.GET_COUNTRIES_SUCCESS,
|
type: TYPES.GET_COUNTRIES_SUCCESS as const,
|
||||||
countries,
|
countries,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCountriesError( error: RestApiError ) {
|
export function getCountriesError( error: RestApiError ) {
|
||||||
return {
|
return {
|
||||||
type: TYPES.GET_COUNTRIES_ERROR,
|
type: TYPES.GET_COUNTRIES_ERROR as const,
|
||||||
error,
|
error,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Action = ReturnType<
|
||||||
|
| typeof getLocalesSuccess
|
||||||
|
| typeof getLocalesError
|
||||||
|
| typeof getCountriesSuccess
|
||||||
|
| typeof getCountriesError
|
||||||
|
>;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { registerStore } from '@wordpress/data';
|
import { registerStore } from '@wordpress/data';
|
||||||
import { controls } from '@wordpress/data-controls';
|
import { controls } from '@wordpress/data-controls';
|
||||||
|
import { SelectFromMap, DispatchFromMap } from '@automattic/data-stores';
|
||||||
|
import { Reducer, AnyAction } from 'redux';
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -12,10 +12,13 @@ import { STORE_NAME } from './constants';
|
||||||
import * as selectors from './selectors';
|
import * as selectors from './selectors';
|
||||||
import * as actions from './actions';
|
import * as actions from './actions';
|
||||||
import * as resolvers from './resolvers';
|
import * as resolvers from './resolvers';
|
||||||
import reducer from './reducer';
|
import reducer, { State } from './reducer';
|
||||||
|
import { WPDataSelectors } from '../types';
|
||||||
|
export * from './types';
|
||||||
|
export type { State };
|
||||||
|
|
||||||
registerStore( STORE_NAME, {
|
registerStore< State >( STORE_NAME, {
|
||||||
reducer,
|
reducer: reducer as Reducer< State, AnyAction >,
|
||||||
actions,
|
actions,
|
||||||
controls,
|
controls,
|
||||||
selectors,
|
selectors,
|
||||||
|
@ -23,3 +26,13 @@ registerStore( STORE_NAME, {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
export const COUNTRIES_STORE_NAME = STORE_NAME;
|
export const COUNTRIES_STORE_NAME = STORE_NAME;
|
||||||
|
|
||||||
|
declare module '@wordpress/data' {
|
||||||
|
// TODO: convert action.js to TS
|
||||||
|
function dispatch(
|
||||||
|
key: typeof STORE_NAME
|
||||||
|
): DispatchFromMap< typeof actions >;
|
||||||
|
function select(
|
||||||
|
key: typeof STORE_NAME
|
||||||
|
): SelectFromMap< typeof selectors > & WPDataSelectors;
|
||||||
|
}
|
||||||
|
|
|
@ -1,32 +1,29 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { Reducer } from 'redux';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
import TYPES from './action-types';
|
import TYPES from './action-types';
|
||||||
import { CountriesState, Locales, Country } from './types';
|
import { Action } from './actions';
|
||||||
|
import { CountriesState } from './types';
|
||||||
|
|
||||||
const reducer = (
|
const reducer: Reducer< CountriesState, Action > = (
|
||||||
state: CountriesState = {
|
state = {
|
||||||
errors: {},
|
errors: {},
|
||||||
locales: {},
|
locales: {},
|
||||||
countries: [],
|
countries: [],
|
||||||
},
|
},
|
||||||
{
|
action
|
||||||
type,
|
) => {
|
||||||
error,
|
switch ( action.type ) {
|
||||||
locales,
|
|
||||||
countries,
|
|
||||||
}: {
|
|
||||||
type: string;
|
|
||||||
error: string;
|
|
||||||
locales: Locales;
|
|
||||||
countries: Country[];
|
|
||||||
}
|
|
||||||
): CountriesState => {
|
|
||||||
switch ( type ) {
|
|
||||||
case TYPES.GET_LOCALES_SUCCESS:
|
case TYPES.GET_LOCALES_SUCCESS:
|
||||||
state = {
|
state = {
|
||||||
...state,
|
...state,
|
||||||
locales,
|
locales: action.locales,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case TYPES.GET_LOCALES_ERROR:
|
case TYPES.GET_LOCALES_ERROR:
|
||||||
|
@ -34,14 +31,14 @@ const reducer = (
|
||||||
...state,
|
...state,
|
||||||
errors: {
|
errors: {
|
||||||
...state.errors,
|
...state.errors,
|
||||||
locales: error,
|
locales: action.error,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case TYPES.GET_COUNTRIES_SUCCESS:
|
case TYPES.GET_COUNTRIES_SUCCESS:
|
||||||
state = {
|
state = {
|
||||||
...state,
|
...state,
|
||||||
countries,
|
countries: action.countries,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case TYPES.GET_COUNTRIES_ERROR:
|
case TYPES.GET_COUNTRIES_ERROR:
|
||||||
|
@ -49,7 +46,7 @@ const reducer = (
|
||||||
...state,
|
...state,
|
||||||
errors: {
|
errors: {
|
||||||
...state.errors,
|
...state.errors,
|
||||||
countries: error,
|
countries: action.error,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
@ -57,4 +54,5 @@ const reducer = (
|
||||||
return state;
|
return state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type State = ReturnType< typeof reducer >;
|
||||||
export default reducer;
|
export default reducer;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { RestApiError } from '../types';
|
||||||
|
|
||||||
export type SettingProperties = {
|
export type SettingProperties = {
|
||||||
label?: string;
|
label?: string;
|
||||||
label_class?: string[];
|
label_class?: string[];
|
||||||
|
@ -7,6 +12,7 @@ export type SettingProperties = {
|
||||||
priority?: number;
|
priority?: number;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
type?: string;
|
type?: string;
|
||||||
|
hidden?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Locale = {
|
export type Locale = {
|
||||||
|
@ -35,7 +41,7 @@ export type Locales = {
|
||||||
|
|
||||||
export type CountriesState = {
|
export type CountriesState = {
|
||||||
errors: {
|
errors: {
|
||||||
[ key: string ]: string;
|
[ key: string ]: string | RestApiError | undefined;
|
||||||
};
|
};
|
||||||
locales: Locales;
|
locales: Locales;
|
||||||
countries: Country[];
|
countries: Country[];
|
||||||
|
|
|
@ -3,6 +3,71 @@
|
||||||
*/
|
*/
|
||||||
import '@wordpress/core-data';
|
import '@wordpress/core-data';
|
||||||
|
|
||||||
|
// Export store names
|
||||||
|
export { SETTINGS_STORE_NAME } from './settings';
|
||||||
|
export { PLUGINS_STORE_NAME } from './plugins';
|
||||||
|
export { ONBOARDING_STORE_NAME } from './onboarding';
|
||||||
|
export { USER_STORE_NAME } from './user';
|
||||||
|
export { REVIEWS_STORE_NAME } from './reviews';
|
||||||
|
export { NOTES_STORE_NAME } from './notes';
|
||||||
|
export { REPORTS_STORE_NAME } from './reports';
|
||||||
|
export { COUNTRIES_STORE_NAME } from './countries';
|
||||||
|
export { NAVIGATION_STORE_NAME } from './navigation';
|
||||||
|
export { OPTIONS_STORE_NAME } from './options';
|
||||||
|
export { ITEMS_STORE_NAME } from './items';
|
||||||
|
export { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||||
|
export { PaymentGateway } from './payment-gateways/types';
|
||||||
|
|
||||||
|
// Export hooks
|
||||||
|
export { withSettingsHydration } from './settings/with-settings-hydration';
|
||||||
|
export { withOnboardingHydration } from './onboarding/with-onboarding-hydration';
|
||||||
|
export { withCurrentUserHydration } from './user/with-current-user-hydration';
|
||||||
|
export { withNavigationHydration } from './navigation/with-navigation-hydration';
|
||||||
|
export { withPluginsHydration } from './plugins/with-plugins-hydration';
|
||||||
|
export {
|
||||||
|
withOptionsHydration,
|
||||||
|
useOptionsHydration,
|
||||||
|
} from './options/with-options-hydration';
|
||||||
|
export { useSettings } from './settings/use-settings';
|
||||||
|
export { useUserPreferences } from './user/use-user-preferences';
|
||||||
|
export { useUser } from './user/use-user';
|
||||||
|
|
||||||
|
// Export utils
|
||||||
|
export { getVisibleTasks } from './onboarding/utils';
|
||||||
|
export { getLeaderboard, searchItemsByString } from './items/utils';
|
||||||
|
export {
|
||||||
|
getFilterQuery,
|
||||||
|
getSummaryNumbers,
|
||||||
|
getReportTableData,
|
||||||
|
getReportTableQuery,
|
||||||
|
getReportChartData,
|
||||||
|
getTooltipValueFormat,
|
||||||
|
} from './reports/utils';
|
||||||
|
|
||||||
|
// Export constants
|
||||||
|
export { pluginNames } from './plugins/constants';
|
||||||
|
export { EXPORT_STORE_NAME } from './export';
|
||||||
|
export { IMPORT_STORE_NAME } from './import';
|
||||||
|
export {
|
||||||
|
MAX_PER_PAGE,
|
||||||
|
QUERY_DEFAULTS,
|
||||||
|
NAMESPACE,
|
||||||
|
WC_ADMIN_NAMESPACE,
|
||||||
|
WCS_NAMESPACE,
|
||||||
|
SECOND,
|
||||||
|
MINUTE,
|
||||||
|
HOUR,
|
||||||
|
DAY,
|
||||||
|
WEEK,
|
||||||
|
MONTH,
|
||||||
|
} from './constants';
|
||||||
|
|
||||||
|
// Export types
|
||||||
|
export * from './types';
|
||||||
|
export * from './countries/types';
|
||||||
|
export * from './onboarding/types';
|
||||||
|
export * from './plugins/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
@ -18,80 +83,6 @@ import type { REPORTS_STORE_NAME } from './reports';
|
||||||
import type { ITEMS_STORE_NAME } from './items';
|
import type { ITEMS_STORE_NAME } from './items';
|
||||||
import type { COUNTRIES_STORE_NAME } from './countries';
|
import type { COUNTRIES_STORE_NAME } from './countries';
|
||||||
import type { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
import type { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
||||||
import { OnboardingSelectors } from './onboarding/selectors';
|
|
||||||
import { PaymentSelectors } from './payment-gateways/selectors';
|
|
||||||
import { WPDataSelectors } from './types';
|
|
||||||
import { PluginSelectors } from './plugins/selectors';
|
|
||||||
|
|
||||||
export * from './types';
|
|
||||||
export { SETTINGS_STORE_NAME } from './settings';
|
|
||||||
export { withSettingsHydration } from './settings/with-settings-hydration';
|
|
||||||
export { useSettings } from './settings/use-settings';
|
|
||||||
|
|
||||||
export { PLUGINS_STORE_NAME } from './plugins';
|
|
||||||
export type { Plugin } from './plugins/types';
|
|
||||||
export { ActionDispatchers as PluginsStoreActions } from './plugins/actions';
|
|
||||||
export { pluginNames } from './plugins/constants';
|
|
||||||
export { withPluginsHydration } from './plugins/with-plugins-hydration';
|
|
||||||
|
|
||||||
export { ONBOARDING_STORE_NAME } from './onboarding';
|
|
||||||
export { withOnboardingHydration } from './onboarding/with-onboarding-hydration';
|
|
||||||
export { getVisibleTasks } from './onboarding/utils';
|
|
||||||
export type { TaskType, TaskListType } from './onboarding/types';
|
|
||||||
|
|
||||||
export { USER_STORE_NAME } from './user';
|
|
||||||
export { withCurrentUserHydration } from './user/with-current-user-hydration';
|
|
||||||
export { useUser } from './user/use-user';
|
|
||||||
export { useUserPreferences } from './user/use-user-preferences';
|
|
||||||
|
|
||||||
export { OPTIONS_STORE_NAME } from './options';
|
|
||||||
export {
|
|
||||||
withOptionsHydration,
|
|
||||||
useOptionsHydration,
|
|
||||||
} from './options/with-options-hydration';
|
|
||||||
|
|
||||||
export { REVIEWS_STORE_NAME } from './reviews';
|
|
||||||
|
|
||||||
export { NOTES_STORE_NAME } from './notes';
|
|
||||||
|
|
||||||
export { REPORTS_STORE_NAME } from './reports';
|
|
||||||
|
|
||||||
export { ITEMS_STORE_NAME } from './items';
|
|
||||||
export { getLeaderboard, searchItemsByString } from './items/utils';
|
|
||||||
|
|
||||||
export { COUNTRIES_STORE_NAME } from './countries';
|
|
||||||
|
|
||||||
export { NAVIGATION_STORE_NAME } from './navigation';
|
|
||||||
export { withNavigationHydration } from './navigation/with-navigation-hydration';
|
|
||||||
|
|
||||||
export { PAYMENT_GATEWAYS_STORE_NAME } from './payment-gateways';
|
|
||||||
|
|
||||||
export {
|
|
||||||
getFilterQuery,
|
|
||||||
getSummaryNumbers,
|
|
||||||
getReportTableData,
|
|
||||||
getReportTableQuery,
|
|
||||||
getReportChartData,
|
|
||||||
getTooltipValueFormat,
|
|
||||||
} from './reports/utils';
|
|
||||||
|
|
||||||
export {
|
|
||||||
MAX_PER_PAGE,
|
|
||||||
QUERY_DEFAULTS,
|
|
||||||
NAMESPACE,
|
|
||||||
WC_ADMIN_NAMESPACE,
|
|
||||||
WCS_NAMESPACE,
|
|
||||||
SECOND,
|
|
||||||
MINUTE,
|
|
||||||
HOUR,
|
|
||||||
DAY,
|
|
||||||
WEEK,
|
|
||||||
MONTH,
|
|
||||||
} from './constants';
|
|
||||||
|
|
||||||
export { EXPORT_STORE_NAME } from './export';
|
|
||||||
|
|
||||||
export { IMPORT_STORE_NAME } from './import';
|
|
||||||
|
|
||||||
export type WCDataStoreName =
|
export type WCDataStoreName =
|
||||||
| typeof REVIEWS_STORE_NAME
|
| typeof REVIEWS_STORE_NAME
|
||||||
|
@ -107,6 +98,14 @@ export type WCDataStoreName =
|
||||||
| typeof COUNTRIES_STORE_NAME
|
| typeof COUNTRIES_STORE_NAME
|
||||||
| typeof PAYMENT_GATEWAYS_STORE_NAME;
|
| typeof PAYMENT_GATEWAYS_STORE_NAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { WPDataSelectors } from './types';
|
||||||
|
import { PaymentSelectors } from './payment-gateways/selectors';
|
||||||
|
import { PluginSelectors } from './plugins/selectors';
|
||||||
|
import { OnboardingSelectors } from './onboarding/selectors';
|
||||||
|
|
||||||
// As we add types to all the package selectors we can fill out these unknown types with real ones. See one
|
// As we add types to all the package selectors we can fill out these unknown types with real ones. See one
|
||||||
// of the already typed selectors for an example of how you can do this.
|
// of the already typed selectors for an example of how you can do this.
|
||||||
export type WCSelectorType< T > = T extends typeof REVIEWS_STORE_NAME
|
export type WCSelectorType< T > = T extends typeof REVIEWS_STORE_NAME
|
||||||
|
@ -138,6 +137,6 @@ export type WCSelectorType< T > = T extends typeof REVIEWS_STORE_NAME
|
||||||
export interface WCDataSelector {
|
export interface WCDataSelector {
|
||||||
< T extends WCDataStoreName >( storeName: T ): WCSelectorType< T >;
|
< T extends WCDataStoreName >( storeName: T ): WCSelectorType< T >;
|
||||||
}
|
}
|
||||||
export * from './onboarding/selectors';
|
|
||||||
export * from './onboarding/types';
|
// Other exports
|
||||||
export * from './countries/types';
|
export { ActionDispatchers as PluginsStoreActions } from './plugins/actions';
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
/**
|
|
||||||
* External dependencies
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { registerStore } from '@wordpress/data';
|
|
||||||
import { controls } from '@wordpress/data-controls';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal dependencies
|
|
||||||
*/
|
|
||||||
import { STORE_NAME } from './constants';
|
|
||||||
import * as selectors from './selectors';
|
|
||||||
import * as actions from './actions';
|
|
||||||
import * as resolvers from './resolvers';
|
|
||||||
import reducer from './reducer';
|
|
||||||
|
|
||||||
registerStore( STORE_NAME, {
|
|
||||||
reducer,
|
|
||||||
actions,
|
|
||||||
controls,
|
|
||||||
selectors,
|
|
||||||
resolvers,
|
|
||||||
} );
|
|
||||||
|
|
||||||
export const ONBOARDING_STORE_NAME = STORE_NAME;
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { registerStore } from '@wordpress/data';
|
||||||
|
import { controls } from '@wordpress/data-controls';
|
||||||
|
import { SelectFromMap, DispatchFromMap } from '@automattic/data-stores';
|
||||||
|
import { Reducer, AnyAction } from 'redux';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { STORE_NAME } from './constants';
|
||||||
|
import * as selectors from './selectors';
|
||||||
|
import * as actions from './actions';
|
||||||
|
import * as resolvers from './resolvers';
|
||||||
|
import reducer from './reducer';
|
||||||
|
import { WPDataSelectors } from '../types';
|
||||||
|
|
||||||
|
registerStore( STORE_NAME, {
|
||||||
|
reducer: reducer as Reducer< ReturnType< Reducer >, AnyAction >,
|
||||||
|
actions,
|
||||||
|
controls,
|
||||||
|
selectors,
|
||||||
|
resolvers,
|
||||||
|
} );
|
||||||
|
|
||||||
|
export const ONBOARDING_STORE_NAME = STORE_NAME;
|
||||||
|
|
||||||
|
export type OnboardingSelector = SelectFromMap< typeof selectors >;
|
||||||
|
|
||||||
|
declare module '@wordpress/data' {
|
||||||
|
// TODO: convert action.js to TS
|
||||||
|
function dispatch( key: typeof STORE_NAME ): DispatchFromMap< AnyAction >;
|
||||||
|
function select(
|
||||||
|
key: typeof STORE_NAME
|
||||||
|
): SelectFromMap< typeof selectors > & WPDataSelectors;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue