five-for-the-future/.github/workflows/ci.yml

72 lines
1.7 KiB
YAML

name: CI
on:
pull_request:
push:
branches: [production]
jobs:
phpcs:
name: PHP CodeSniffer
runs-on: ubuntu-latest
steps:
- name: composer install
run: |
composer install
- name: Lint PHP
run: |
touch ./tmp.php
CHANGED_FILES=$(git diff --name-only --diff-filter=AM ${{ github.base_ref }} | tr '\n' ' ')
composer run-script phpcs ./tmp.php $(echo $CHANGED_FILES) -- -n
phpunit:
name: PHP Unit Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['7.4'] # 8.0 -- Add back to matrix when 8.0 is supported.
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wcorg_test
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer:v1
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Install dependencies
run: composer install
- name: Install WordPress
run: |
bash .docker/bin/install-wp-tests.sh wporg_5ftf_test root root 127.0.0.1 trunk
- name: Install required plugins
run: |
svn export https://plugins.svn.wordpress.org/jetpack/trunk public_html/wp-content/plugins/jetpack
- name: Running unit tests
run: composer run-script test -- -c phpunit.xml.dist