2021-03-14 00:29:15 +00:00
|
|
|
name: Run CI
|
2023-04-26 20:41:31 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- trunk
|
|
|
|
- 'release/**'
|
|
|
|
workflow_dispatch:
|
2022-05-17 18:48:24 +00:00
|
|
|
|
2021-10-13 13:15:12 +00:00
|
|
|
defaults:
|
2023-04-26 20:41:31 +00:00
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2023-01-02 17:28:11 +00:00
|
|
|
|
|
|
|
permissions: {}
|
|
|
|
|
2021-03-14 00:29:15 +00:00
|
|
|
jobs:
|
2023-04-26 20:41:31 +00:00
|
|
|
test:
|
|
|
|
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
|
|
|
timeout-minutes: 30
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php: ['7.4', '8.0']
|
|
|
|
wp: ['latest']
|
2023-07-20 08:01:28 +00:00
|
|
|
unittests: ['shard1', 'shard2']
|
2023-04-26 20:41:31 +00:00
|
|
|
include:
|
|
|
|
- wp: nightly
|
|
|
|
php: '7.4'
|
2023-07-20 08:01:28 +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-20 08:01:28 +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:
|
|
|
|
build-filters: woocommerce
|
2021-03-14 00:29:15 +00:00
|
|
|
|
2023-04-26 20:41:31 +00:00
|
|
|
- name: Tool versions
|
|
|
|
run: |
|
|
|
|
php --version
|
|
|
|
composer --version
|
2021-03-14 00:29:15 +00:00
|
|
|
|
2023-04-26 20:41:31 +00:00
|
|
|
- name: Build Admin feature config
|
|
|
|
working-directory: plugins/woocommerce
|
|
|
|
run: pnpm run build:feature-config
|
2022-03-24 06:00:43 +00:00
|
|
|
|
2023-05-15 16:47:50 +00:00
|
|
|
- id: parseMatrix
|
|
|
|
name: Parse Matrix Variables
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const parseWPVersion = require( './.github/workflows/scripts/parse-wp-version' );
|
|
|
|
parseWPVersion( '${{ matrix.wp }}' ).then( ( version ) => {
|
|
|
|
core.setOutput( 'wpVersion', version );
|
|
|
|
} );
|
2021-03-14 00:29:15 +00:00
|
|
|
|
2023-05-15 16:47:50 +00:00
|
|
|
- name: Prepare Testing Environment
|
|
|
|
env:
|
|
|
|
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
|
|
|
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
|
|
|
run: pnpm --filter=woocommerce env:test
|
2021-03-14 00:29:15 +00:00
|
|
|
|
2023-05-15 16:47:50 +00:00
|
|
|
- name: Run Tests
|
|
|
|
env:
|
|
|
|
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
|
|
|
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
2023-07-20 08:01:28 +00:00
|
|
|
run: pnpm --filter=woocommerce test:unit:env --testsuite ${{ matrix.unittests }}
|