mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-12 06:53:44 +03:00
121 lines
3.2 KiB
YAML
121 lines
3.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [production]
|
|
|
|
jobs:
|
|
phpcs:
|
|
name: PHP CodeSniffer
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Subversion
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y subversion
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Set up Composer caching
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-composer-dependencies
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-composer-
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '7.4'
|
|
coverage: none
|
|
tools: composer, cs2pr
|
|
|
|
- name: Install Composer dependencies
|
|
run: |
|
|
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
|
|
echo "${PWD}/mu-plugins/vendor/bin" >> $GITHUB_PATH
|
|
|
|
- name: Run PHPCS on changed files
|
|
run: |
|
|
touch $GITHUB_WORKSPACE/tmp.php
|
|
export CHANGED_FILES=$(git diff --name-only --diff-filter=AM remotes/origin/${{ github.base_ref }} | tr '\n' ' ')
|
|
phpcs -q -n --report=checkstyle $GITHUB_WORKSPACE/tmp.php $(echo $CHANGED_FILES) | cs2pr
|
|
|
|
phpunit:
|
|
name: PHP Unit Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php-version: ['7.4']
|
|
|
|
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: Install Subversion
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y subversion
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Set up Composer caching
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-composer-dependencies
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-composer-
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
coverage: none
|
|
tools: composer
|
|
|
|
- name: Install Composer dependencies
|
|
run: |
|
|
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
|
|
echo "${PWD}/mu-plugins/vendor/bin" >> $GITHUB_PATH
|
|
|
|
- name: Start mysql service
|
|
run: sudo /etc/init.d/mysql start
|
|
|
|
- name: Install WordPress
|
|
run: |
|
|
bash bin/install-wp-tests.sh wporg_5ftf_test root root 127.0.0.1 trunk
|
|
|
|
- name: Running unit tests
|
|
run: composer run-script test -- -c phpunit.xml.dist
|