Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Update product category controls to use typescript #21883

Update product category controls to use typescript

Update product category controls to use typescript #21883

Workflow file for this run

name: Unit Tests
# Since Unit Tests are required to pass for each PR,
# we cannot disable them for documentation-only changes.
on:
pull_request:
push:
branches: [trunk]
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
JSUnitTests:
name: JS Unit Tests
runs-on: ubuntu-latest
if: ${{ github.repository == 'WooCommerce/WooCommerce-Blocks' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Use desired version of NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Npm install and build
run: |
npm ci --no-optional
FORCE_REDUCED_MOTION=true npm run build
- name: blocks.ini setup
run: echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = test' > blocks.ini
- name: Run JavaScript Unit tests
run: npm run test
PHPUnitTests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
timeout-minutes: 20
if: ${{ github.repository == 'WooCommerce/WooCommerce-Blocks' || github.event_name == 'pull_request' }}
strategy:
fail-fast: true
matrix:
php:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
##
# This allows Composer dependencies to be installed using a single step.
#
# Since the tests are currently run within the Docker containers where the PHP version varies,
# the same PHP version needs to be configured for the action runner machine so that the correct
# dependency versions are installed and cached.
##
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
ini-file: development
coverage: none
# Ensure that Composer installs the correct versions of packages.
- name: Override PHP version in composer.json
run: |
composer config platform.php ${{ matrix.php }}
composer update
- name: Install npm dependencies
run: |
npm ci
npm run build
- name: Docker debug information
run: |
docker -v
docker-compose -v
- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
locale -a
- name: Start Docker environment
run: npm run wp-env start --update
- name: Log running Docker containers
run: docker ps -a
- name: Docker container debug information
run: |
npm run wp-env run tests-mysql mysql -- --version
npm run wp-env run tests-wordpress php -- --version
npm run wp-env run tests-wordpress php -- -m
npm run wp-env run tests-wordpress php -- -i
npm run wp-env run tests-wordpress locale -- -a
- name: Run PHPUnit tests
run: npm run test:php