2021-02-09 10:39:56 +00:00
|
|
|
name: Run code coverage on PR
|
|
|
|
on:
|
2022-05-17 19:29:16 +00:00
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
2021-10-12 13:33:04 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2022-04-21 16:45:12 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-02-09 10:39:56 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Code coverage (PHP 7.4, WP Latest)
|
2022-05-31 14:58:54 +00:00
|
|
|
timeout-minutes: 30
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-02-09 10:39:56 +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:
|
2022-05-17 18:48:24 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-03-14 01:08:46 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 100
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
|
|
|
tools: composer
|
|
|
|
extensions: mysql
|
|
|
|
coverage: none
|
|
|
|
|
|
|
|
- name: Tool versions
|
|
|
|
run: |
|
|
|
|
php --version
|
|
|
|
composer --version
|
|
|
|
|
2022-05-17 18:48:24 +00:00
|
|
|
- uses: ./.github/actions/cache-deps
|
2021-02-09 10:39:56 +00:00
|
|
|
with:
|
2022-05-17 18:48:24 +00:00
|
|
|
workflow_name: pr-code-coverage
|
|
|
|
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
|
2021-02-09 10:39:56 +00:00
|
|
|
|
2022-05-17 18:48:24 +00:00
|
|
|
- name: Install and Build
|
|
|
|
uses: ./.github/actions/install-build
|
2022-03-21 19:05:45 +00:00
|
|
|
|
|
|
|
- name: Build Admin feature config
|
|
|
|
run: |
|
2022-06-09 21:40:07 +00:00
|
|
|
pnpm build:feature-config --filter=woocommerce
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Init DB and WP
|
2022-06-09 21:40:07 +00:00
|
|
|
working-directory: plugins/woocommerce
|
|
|
|
run: bash tests/bin/install.sh woo_test root root 127.0.0.1 latest
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Run unit tests with code coverage. Allow to fail.
|
2022-06-09 21:40:07 +00:00
|
|
|
working-directory: plugins/woocommerce
|
2021-02-09 10:39:56 +00:00
|
|
|
run: |
|
2022-06-09 21:40:07 +00:00
|
|
|
RUN_CODE_COVERAGE=1 bash tests/bin/phpunit.sh
|
2021-02-09 10:39:56 +00:00
|
|
|
exit 0
|
2021-03-14 01:08:46 +00:00
|
|
|
|
|
|
|
- name: Send code coverage to Codecov.
|
|
|
|
run: |
|
|
|
|
bash <(curl -s https://codecov.io/bash)
|