Tools: Move from Travis to GitHub Actions for CI checks

This commit is contained in:
Kelly Dwan 2020-12-09 17:22:50 -05:00
parent 13a417ce8e
commit 4409caa336
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
2 changed files with 71 additions and 16 deletions

71
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,71 @@
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

View file

@ -1,16 +0,0 @@
sudo: required
dist: trusty
language: php
php: 7.2
env: WP_VERSION=latest WP_MULTISITE=1 WP_CORE_DIR=/tmp/wordpress
install:
- bash bin/install-wp-tests.sh wporg_5ftf_test root '' localhost $WP_VERSION
- composer install
script:
- composer run-script test -- --version
- composer run-script test -- -c phpunit.xml.dist
- touch $TRAVIS_BUILD_DIR/tmp.php
- export CHANGED_FILES=$(git diff --name-only --diff-filter=AM $TRAVIS_BRANCH...HEAD | tr '\n' ' ')
- composer run-script phpcs $TRAVIS_BUILD_DIR/tmp.php $(echo $CHANGED_FILES) -- -n