Skip to content

Bump codecov/codecov-action from 3 to 4 #152

Bump codecov/codecov-action from 3 to 4

Bump codecov/codecov-action from 3 to 4 #152

Workflow file for this run

name: PHPUnit
on:
push:
branches:
- master
pull_request:
jobs:
phpunit:
name: PHPUnit${{ matrix.coverage && ' with coverage' || '' }} (PHP ${{ matrix.php }}, WordPress ${{ matrix.wordpress }}, GlotPress ${{ matrix.glotpress }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
services:
mysql:
image: mysql:5.7
ports:
- 3306/tcp
env:
MYSQL_ROOT_PASSWORD: password
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
strategy:
matrix:
os: [ ubuntu-latest ]
php: [ '7.4' ]
wordpress: [ 'latest', 'nightly' ]
glotpress: [ 'develop' ]
experimental: [ false ]
include:
# - php: '8.0'
# os: ubuntu-latest
# experimental: true
- os: ubuntu-latest
php: '7.2'
wordpress: 'latest'
glotpress: 'latest'
experimental: false
- os: ubuntu-latest
php: '7.3'
wordpress: 'latest'
glotpress: 'latest'
experimental: false
- os: ubuntu-latest
php: '7.4'
wordpress: 'latest'
glotpress: 'develop'
experimental: false
coverage: true
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
tools: composer
- name: Install PHP dependencies
uses: ramsey/composer-install@v2
- name: Make Composer packages available globally
run: |
echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mkdir -p bin
mv wp-cli.phar bin/wp
echo "WP_CLI_BIN_DIR=${PWD}/bin" >> $GITHUB_ENV
- name: Install WordPress test setup
env:
WP_VERSION: ${{ matrix.wordpress }}
GP_VERSION: ${{ matrix.glotpress }}
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: bash bin/install-wp-tests.sh wordpress_test root password "127.0.0.1:$MYSQL_PORT" "$WP_VERSION" "$GP_VERSION"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run tests
if: ${{ ! matrix.coverage }}
run: composer run-script phpunit
- name: Run tests with code coverage
if: ${{ matrix.coverage }}
run: composer run-script phpunit -- --coverage-clover coverage-clover-${{ github.sha }}.xml
- name: Upload coverage to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v4
with:
file: coverage-clover-${{ github.sha }}.xml
flags: php