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-01-16 07:58:09 +00:00
|
|
|
test:
|
2023-03-09 23:10:33 +00:00
|
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
|
2023-02-24 11:32:05 +00:00
|
|
|
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} ${{ matrix.hpos && 'HPOS' || '' }}
|
2023-01-16 07:58:09 +00:00
|
|
|
timeout-minutes: 30
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
2023-02-24 11:27:51 +00:00
|
|
|
env:
|
|
|
|
HPOS: ${{ matrix.hpos }}
|
2023-01-16 07:58:09 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php: [ '7.4', '8.0' ]
|
|
|
|
wp: [ "latest" ]
|
|
|
|
include:
|
|
|
|
- wp: nightly
|
|
|
|
php: '7.4'
|
|
|
|
- wp: '6.0'
|
|
|
|
php: 7.4
|
|
|
|
- wp: '5.9'
|
|
|
|
php: 7.4
|
2023-02-24 11:32:36 +00:00
|
|
|
- wp: 'latest'
|
2023-02-24 11:27:51 +00:00
|
|
|
php: '7.4'
|
|
|
|
hpos: true
|
2023-01-16 07:58:09 +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-01-16 07:58:09 +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-01-16 07:58:09 +00:00
|
|
|
- name: Tool versions
|
|
|
|
run: |
|
|
|
|
php --version
|
|
|
|
composer --version
|
2021-01-21 12:03:07 +00:00
|
|
|
|
2023-01-16 07:58:09 +00:00
|
|
|
- name: Init DB and WP
|
|
|
|
working-directory: plugins/woocommerce
|
|
|
|
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
2021-01-21 12:03:07 +00:00
|
|
|
|
2023-01-16 07:58:09 +00:00
|
|
|
- name: Run tests
|
|
|
|
working-directory: plugins/woocommerce
|
|
|
|
run: pnpm run test --filter=woocommerce --color
|