Skip to content

Actions CI & PHP 8.0 #101

Actions CI & PHP 8.0

Actions CI & PHP 8.0 #101

Workflow file for this run

name: Main PHP Version(s) CI
on:
push:
branches:
- develop
pull_request:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
Test:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ "8.0", "8.1", "8.2", "8.3" ]
wp-versions: [ 'latest' ]
coverage: [ true ]
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: wordpress_test
MYSQL_PASSWORD: password
MYSQL_USER: wp
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
name: WP ${{ matrix.wp-versions }} on PHP ${{ matrix.php-versions }}
env:
WORDPRESS_DB_NAME: wordpress_test
WORDPRESS_DB_PASS: password
WORDPRESS_DB_USER: wp
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # No shallow clone, we need all history!
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mysql, mysqli
coverage: xdebug
tools: composer, cs2pr, phpunit
- name: Setup WordPress ${{ matrix.wp-versions }}
run: bash bin/install-wp-tests.sh wordpress_test wp password localhost ${{ matrix.wp-versions }} true
- name: Install dependencies
run: composer update --prefer-dist --no-interaction
- name: Create all branches
run: source ./vendor/thefrosty/wp-utilities/bin/create-all-branches.sh
- name: PHPCS
run: composer phpcs
- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml
- name: PHPMD
run: composer phpmd
- name: PHPUnit
run: composer phpunit
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false