Try: Make code coverage work #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Codecov on PR | |
on: | |
pull_request | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
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: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up PHP 8.1 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
tools: composer | |
extensions: mysql | |
coverage: xdebug | |
- name: Get cached composer directories | |
uses: actions/cache@v2 | |
with: | |
path: ./vendor | |
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }} | |
- name: Install dependencies | |
run: composer self-update && composer install && composer dump-autoload | |
- name: Init database and WordPress | |
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 latest | |
- name: Run tests and collect coverage | |
run: ./vendor/bin/phpunit -c ./tests/phpunit.xml.dist --coverage-clover coverage.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4-beta | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} |