2021-01-21 12:03:07 +00:00
|
|
|
name: Run unit tests on PR
|
2023-01-12 01:09:36 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- '**/changelog/**'
|
2021-10-13 03:51:07 +00:00
|
|
|
defaults:
|
2023-01-12 01:09:36 +00:00
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2022-04-21 16:45:12 +00:00
|
|
|
|
2023-01-02 17:28:11 +00:00
|
|
|
permissions: {}
|
|
|
|
|
2021-01-21 12:03:07 +00:00
|
|
|
jobs:
|
2023-04-26 20:41:31 +00:00
|
|
|
test:
|
2023-05-25 00:00:22 +00:00
|
|
|
if: ${{ github.event.pull_request.user.login != 'github-actions[bot]' }}
|
2023-08-17 05:23:35 +00:00
|
|
|
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - ${{ matrix.unittests }} ${{ matrix.hpos && 'HPOS' || '' }}
|
2023-04-26 20:41:31 +00:00
|
|
|
timeout-minutes: 30
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
2023-01-16 07:58:09 +00:00
|
|
|
env:
|
2023-04-26 20:41:31 +00:00
|
|
|
HPOS: ${{ matrix.hpos }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php: ['7.4', '8.0']
|
|
|
|
wp: ['latest']
|
2023-07-27 12:06:55 +00:00
|
|
|
unittests: ['shard1', 'shard2']
|
2023-04-26 20:41:31 +00:00
|
|
|
include:
|
|
|
|
- wp: nightly
|
|
|
|
php: '7.4'
|
2023-07-27 12:06:55 +00:00
|
|
|
unittests: 'shard1'
|
|
|
|
- wp: nightly
|
|
|
|
php: '7.4'
|
|
|
|
unittests: 'shard2'
|
|
|
|
- wp: '6.1'
|
|
|
|
php: 7.4
|
|
|
|
unittests: 'shard1'
|
2023-04-26 20:41:31 +00:00
|
|
|
- wp: '6.1'
|
|
|
|
php: 7.4
|
2023-07-27 12:06:55 +00:00
|
|
|
unittests: 'shard2'
|
|
|
|
- wp: 'latest'
|
|
|
|
php: '7.4'
|
|
|
|
hpos: true
|
|
|
|
unittests: 'shard1'
|
2023-04-26 20:41:31 +00:00
|
|
|
- wp: 'latest'
|
|
|
|
php: '7.4'
|
|
|
|
hpos: true
|
2023-07-27 12:06:55 +00:00
|
|
|
unittests: 'shard2'
|
2023-04-26 20:41:31 +00:00
|
|
|
services:
|
|
|
|
database:
|
|
|
|
image: mysql:5.6
|
|
|
|
env:
|
|
|
|
MYSQL_ROOT_PASSWORD: root
|
|
|
|
ports:
|
|
|
|
- 3306:3306
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-05-17 18:48:24 +00:00
|
|
|
|
2023-04-26 20:41:31 +00:00
|
|
|
- name: Setup WooCommerce Monorepo
|
|
|
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
2021-01-21 12:03:07 +00:00
|
|
|
|
2023-05-15 16:47:50 +00:00
|
|
|
- id: parseMatrix
|
|
|
|
name: Parse Matrix Variables
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
2023-07-27 12:06:55 +00:00
|
|
|
script: |
|
|
|
|
const parseWPVersion = require( './.github/workflows/scripts/parse-wp-version' );
|
|
|
|
parseWPVersion( '${{ matrix.wp }}' ).then( ( version ) => {
|
|
|
|
core.setOutput( 'wpVersion', version );
|
|
|
|
} );
|
2021-01-21 12:03:07 +00:00
|
|
|
|
2023-05-15 16:47:50 +00:00
|
|
|
- name: Prepare Testing Environment
|
|
|
|
env:
|
2023-07-27 12:06:55 +00:00
|
|
|
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
|
|
|
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
2023-05-15 16:47:50 +00:00
|
|
|
run: pnpm --filter=woocommerce env:test
|
2021-01-21 12:03:07 +00:00
|
|
|
|
2023-05-15 16:47:50 +00:00
|
|
|
- name: Run Tests
|
|
|
|
env:
|
2023-07-27 12:06:55 +00:00
|
|
|
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
|
|
|
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
|
|
|
run: pnpm --filter=woocommerce test:unit:env --testsuite ${{ matrix.unittests }}
|