woocommerce/.github/workflows/pr-code-coverage.yml

69 lines
1.7 KiB
YAML

name: Run code coverage on PR
on:
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Code coverage (PHP 7.4, WP Latest)
timeout-minutes: 30
runs-on: ubuntu-20.04
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
with:
fetch-depth: 100
- 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
- uses: ./.github/actions/cache-deps
with:
workflow_name: pr-code-coverage
workflow_cache: ${{ secrets.WORKFLOW_CACHE }}
- name: Install and Build
uses: ./.github/actions/install-build
with:
composer_no_dev: 0
- name: Build Admin feature config
run: |
pnpm build:feature-config --filter=woocommerce
- name: Init DB and WP
working-directory: plugins/woocommerce
run: bash tests/bin/install.sh woo_test root root 127.0.0.1 latest
- name: Run unit tests with code coverage. Allow to fail.
working-directory: plugins/woocommerce
run: |
RUN_CODE_COVERAGE=1 bash tests/bin/phpunit.sh
exit 0
- name: Send code coverage to Codecov.
run: |
bash <(curl -s https://codecov.io/bash)